Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2018-08-07 04:40:28
Size: 311
Comment:
Revision 5 as of 2018-08-07 17:33:18
Size: 4728
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
 *
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step1|Step 1: Use GstLAL in your python script]]
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step3|Step 3: Extract channels and make a new frame file]]
 * For the initialization and running the pipeline, please refer [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step1|step1]]
 * Here only the pipeline description part is shown
 * Access frame cache file by specifying frame_cache and instrument(=K1)
{{{#!python
instrument = 'K1'
src = pp.mklalcachesrc(pipeline, location = frame_cache, cache_dsc_regex = instrument)
}}}
 * Define a demultiplexer(demux) to extract data in channel_list
{{{#!python
channel_list = []
headkeys = []
head_dict = {}
channel_list.append((instrument, 'GRD-LSC_MICH_STATE_N'))
demux = pp.mkframecppchanneldemux(pipeline, src, do_file_checksum = do_file_checksum, skip_bad_files = skip_bad_files, channel_list = map("%s:%s".__mod__, channel_list))
}}}
 * Get channel data into head_dict
{{{#!python
headkeys.append("FLG")
for key, chan in zip(headkeys, channel_list):
    head_dict[key] = cp.hook_up(pipeline, demux, chan[1],instrument, buf_length)
}}}
 * Define a caps by specifying sampling rate(channel_rate) and resample rate(out_rate)
{{{#!python
caps = "audio/x-raw, format=F64LE, rate=%d" % int(channel_rate)
capsr = "audio/x-raw, format=F64LE, rate=%d" % int(out_rate)
for key in headkeys:
    head_dict[key] = cp.caps_and_progress(pipeline, head_dict[key], caps, key)
    head_dict[key] = cp.mkresample(pipeline, head_dict[key], 0, False, capsr)
}}}
 * Dump the lock flag into a specified file(output)
{{{#!python
pp.mknxydumpsink(pipeline, head_dict["FLG"], output)
}}}
 * The python script is available at git repository
{{{
> kagra-cal/Observation/Phase1/tutorials/flag --help
Usage: flag [options]

Options:
  -h, --help show this help message and exit
  --cache=cache Set the name of the LAL cache listing the frame files
  --ifo=name Name of the IFO (default= K1)
  --channel=name Set channel name to dump (default= GRD-LSC_MICH_STATE_N)
  --output=name Set output file name (default= flag.txt)
  --ch-rate=rate Set input channel data rate (default= 16)
  --out-rate=rate Set output data rate (default= 1)
}}}
{{{
> kagra-cal/Observation/Phase1/tutorials/flag --cache=k1.cache
GPS: 1209288320 1209288352
seeking GPS start and stop times ...
setting pipeline state to playing ...
set to playing successfully
running pipeline ...
progress_src_FLG (00:00:01): 1209288352 / 32 seconds (3779026100.0 %)
FLAG: 1209288320 1000
}}}
<<Anchor(Optional)>>
 * (Optional) After running on all the (or many of) frame files in phase-1 run (12087* ~ 12096*), you can generate frame cache files based on the lock flag
{{{
> kagra-cal/Observation/Phase1/tutorials/lcache --help
Usage: lcache [options]

Options:
  -h, --help show this help message and exit
  --lock=lock.dat File name containing lock flag list (default= lock.dat)
  --frlist=cache/list List of the frame file names to be searched
  --outdir=cache/lock Directory name where the output files are stored
}}}
{{{
> kagra-cal/Observation/Phase1/tutorials/lcache --outdir=cache/lock
1208761495 1208761531 36 1208761472 1208761504 2
1208761814 1208762443 629 1208761792 1208762432 21
1208762460 1208764322 1862 1208762432 1208764320 60
1208770528 1208771616 1088 1208770528 1208771616 35
1208771932 1208772607 675 1208771904 1208772576 22
1208772696 1208772735 39 1208772672 1208772704 2
1208773299 1208773317 18 1208773280 1208773312 2
1208775247 1208777094 1847 1208775232 1208777088 59
...
}}}
 * Check the contents of one of the produced frame cache file
{{{
> head cache/lock/1208762460-1208764322
K K1_C 1208762432 32 file://localhost/data/full/12087/K-K1_C-1208762432-32.gwf
K K1_C 1208762464 32 file://localhost/data/full/12087/K-K1_C-1208762464-32.gwf
K K1_C 1208762496 32 file://localhost/data/full/12087/K-K1_C-1208762496-32.gwf
K K1_C 1208762528 32 file://localhost/data/full/12087/K-K1_C-1208762528-32.gwf
K K1_C 1208762560 32 file://localhost/data/full/12087/K-K1_C-1208762560-32.gwf
K K1_C 1208762592 32 file://localhost/data/full/12087/K-K1_C-1208762592-32.gwf
K K1_C 1208762624 32 file://localhost/data/full/12087/K-K1_C-1208762624-32.gwf
K K1_C 1208762656 32 file://localhost/data/full/12087/K-K1_C-1208762656-32.gwf
K K1_C 1208762688 32 file://localhost/data/full/12087/K-K1_C-1208762688-32.gwf
K K1_C 1208762720 32 file://localhost/data/full/12087/K-K1_C-1208762720-32.gwf
}}}

 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step3|(Next) Step 3: Extract channels and make a new frame file]]
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step1|(Prev) Step 1: Use GstLAL in your python script]]

Step 2: Dump lock flags from a frame cache file

  • For the initialization and running the pipeline, please refer step1

  • Here only the pipeline description part is shown
  • Access frame cache file by specifying frame_cache and instrument(=K1)

   1 instrument = 'K1'
   2 src = pp.mklalcachesrc(pipeline, location = frame_cache, cache_dsc_regex = instrument)
  • Define a demultiplexer(demux) to extract data in channel_list

   1 channel_list = []
   2 headkeys     = []
   3 head_dict    = {}
   4 channel_list.append((instrument, 'GRD-LSC_MICH_STATE_N'))
   5 demux = pp.mkframecppchanneldemux(pipeline, src, do_file_checksum = do_file_checksum, skip_bad_files = skip_bad_files, channel_list = map("%s:%s".__mod__, channel_list))
  • Get channel data into head_dict

   1 headkeys.append("FLG")
   2 for key, chan in zip(headkeys, channel_list):
   3     head_dict[key] = cp.hook_up(pipeline, demux, chan[1],instrument, buf_length)
  • Define a caps by specifying sampling rate(channel_rate) and resample rate(out_rate)

   1 caps  = "audio/x-raw, format=F64LE, rate=%d" % int(channel_rate)
   2 capsr = "audio/x-raw, format=F64LE, rate=%d" % int(out_rate)
   3 for key in headkeys:
   4     head_dict[key] = cp.caps_and_progress(pipeline, head_dict[key], caps, key)
   5     head_dict[key] = cp.mkresample(pipeline, head_dict[key], 0, False, capsr)
  • Dump the lock flag into a specified file(output)

   1 pp.mknxydumpsink(pipeline, head_dict["FLG"], output)
  • The python script is available at git repository

> kagra-cal/Observation/Phase1/tutorials/flag --help
Usage: flag [options]

Options:
  -h, --help       show this help message and exit
  --cache=cache    Set the name of the LAL cache listing the frame files
  --ifo=name       Name of the IFO (default= K1)
  --channel=name   Set channel name to dump (default= GRD-LSC_MICH_STATE_N)
  --output=name    Set output file name (default= flag.txt)
  --ch-rate=rate   Set input channel data rate (default= 16)
  --out-rate=rate  Set output data rate (default= 1)

> kagra-cal/Observation/Phase1/tutorials/flag --cache=k1.cache
GPS:  1209288320 1209288352
seeking GPS start and stop times ...
setting pipeline state to playing ...
set to playing successfully
running pipeline ...
progress_src_FLG (00:00:01): 1209288352 / 32 seconds (3779026100.0 %)
FLAG:  1209288320 1000

  • (Optional) After running on all the (or many of) frame files in phase-1 run (12087* ~ 12096*), you can generate frame cache files based on the lock flag

> kagra-cal/Observation/Phase1/tutorials/lcache --help
Usage: lcache [options]

Options:
  -h, --help           show this help message and exit
  --lock=lock.dat      File name containing lock flag list (default= lock.dat)
  --frlist=cache/list  List of the frame file names to be searched
  --outdir=cache/lock  Directory name where the output files are stored

> kagra-cal/Observation/Phase1/tutorials/lcache --outdir=cache/lock
1208761495 1208761531    36 1208761472 1208761504 2
1208761814 1208762443   629 1208761792 1208762432 21
1208762460 1208764322  1862 1208762432 1208764320 60
1208770528 1208771616  1088 1208770528 1208771616 35
1208771932 1208772607   675 1208771904 1208772576 22
1208772696 1208772735    39 1208772672 1208772704 2
1208773299 1208773317    18 1208773280 1208773312 2
1208775247 1208777094  1847 1208775232 1208777088 59
...
  • Check the contents of one of the produced frame cache file

> head cache/lock/1208762460-1208764322                       
K K1_C 1208762432 32 file://localhost/data/full/12087/K-K1_C-1208762432-32.gwf
K K1_C 1208762464 32 file://localhost/data/full/12087/K-K1_C-1208762464-32.gwf
K K1_C 1208762496 32 file://localhost/data/full/12087/K-K1_C-1208762496-32.gwf
K K1_C 1208762528 32 file://localhost/data/full/12087/K-K1_C-1208762528-32.gwf
K K1_C 1208762560 32 file://localhost/data/full/12087/K-K1_C-1208762560-32.gwf
K K1_C 1208762592 32 file://localhost/data/full/12087/K-K1_C-1208762592-32.gwf
K K1_C 1208762624 32 file://localhost/data/full/12087/K-K1_C-1208762624-32.gwf
K K1_C 1208762656 32 file://localhost/data/full/12087/K-K1_C-1208762656-32.gwf
K K1_C 1208762688 32 file://localhost/data/full/12087/K-K1_C-1208762688-32.gwf
K K1_C 1208762720 32 file://localhost/data/full/12087/K-K1_C-1208762720-32.gwf

KAGRA/Subgroups/CAL/GstLAL/tutorials/step2 (last edited 2018-08-08 00:09:49 by SadakazuHaino)