Step 10: Read channel data from shared memory
For the initialization and running the pipeline, please refer step1
Access frame cache file by specifying frame_cache and instrument as in step2
- We make a dummy shared memory and send channel data from the frame files
First, we extract a channel data from a frame cache file and make short (1 second) frame files using step3 extr
1 import os
2
3 dbin = os.path.dirname(__file__)
4 dirn = options.dirn
5 dirn = dirn+'/' if not dirn.endswith('/') else dirn
6
7 if not os.path.exists(dirn):
8 opt = ' --cache='+options.cache+' --channel='+options.channel+\
9 ' --ch-rate='+options.ch_rate+' --frame-duration=1'+\
10 ' --frame-type=K1_TEST --output-path='+dirn
11 os.system('mkdir -p '+dirn)
12 os.system(dbin+'/extr'+opt)
- Then, with DpushRT program at GDS software, we can write channel data to shared memory
For the details of Data Pushers, please check LIGO DMT Data Distribution Sub-System
1 opt = ''
2 szm = 0
3 dl = os.listdir(dirn)
4
5 for fn in dl:
6 if fn.endswith('.gwf'):
7 opt = opt+' infile '+dirn+fn
8 sz = os.path.getsize(dirn+fn)
9 szm = sz if sz > szm else szm
10
11 bsz = 10000*int(np.floor(szm/10000.)+1)
12
13 opt = opt+' partition '+options.shared_memory_partition+' lbuf '+str(bsz)
14
15 if options.debug:
16 opt = opt+' debug'
17
18 os.system('DpushRT'+opt)
- On the receiver side, we use GstLAL to read the channel data from shared memory and dump into a file (or stdout)
1 src = pp.mklvshmsrc(pipeline, shm_name = 'K1', assumed_duration = 1)
2
3 demux = pp.mkframecppchanneldemux(pipeline, src,\
4 do_file_checksum = do_file_checksum, skip_bad_files = skip_bad_files,\
5 channel_list = map("%s:%s".__mod__, channel_list))
6
7 cin = cp.hook_up(pipeline, demux, chan_in, instrument, buf_length)
8 cin = cp.caps_and_progress(pipeline, cin, caps, "input")
9 cin = cp.mkresample(pipeline, cin, 0, False, capsr)
10
11 pp.mknxydumpsink(pipeline, cin, options.output)
- The python scripts are available at git repository
> kagra-cal/Observation/Phase1/tutorials/dpush --help Usage: dpush [options] Options: -h, --help show this help message and exit --cache=cache Set the name of the LAL cache listing the frame files (default= k1.cache) --ifo=name Name of the IFO (default= K1) --channel=name Set input channel names; numerator,denominator (default= CAL-CS_PROC_C00_STRAIN_DQ) --ch-rate=rate Set input channel data rate (default= 16384) --dirn=dir Directory name which contain output files of 1sec frames --shared-memory-partition=name Set the name of the shared memory partition to write to. --debug Show debug messages > kagra-cal/Observation/Phase1/tutorials/shmi --help Usage: shmi [options] Options: -h, --help show this help message and exit --shared-memory-partition=name Set the name of the shared memory partition to read from. --ifo=name Name of the IFO (default= K1) --channel=name Set channel name to extract (default= CAL- CS_PROC_C00_STRAIN_DQ --format=format Set input channel format (default= F64LE) --ch-rate=rate Set input channel data rate (default= 16384) --out-rate=rate Set output data rate (default= 1) --output=name Set output file name (default= /dev/stdout)
- This is an example to write a C00 strain channel data from k1.cache
> kagra-cal/Observation/Phase1/tutorials/dpush --cache=k1.cache --debug Opening partition K1 for output. Opened frame file: 1sec/K-K1_TEST-1209288320-1.gwf Read frame: file-length/rc 68771 / 68771 Opened frame file: 1sec/K-K1_TEST-1209288321-1.gwf Waiting 999881usec. Read frame: file-length/rc 65135 / 65135 Opened frame file: 1sec/K-K1_TEST-1209288322-1.gwf Waiting 999716usec. Read frame: file-length/rc 66984 / 66984 Opened frame file: 1sec/K-K1_TEST-1209288323-1.gwf Waiting 999697usec. ...
- Check if the shared memory partition is created
> smlist id name nBuf lBuf nTotal 32 K1 1 70000 5
- This is an example to read the C00 strain channel data from the shared memory and dump on stdout
> kagra-cal/Observation/Phase1/tutorials/shmi setting pipeline state to playing ... set to playing successfully 1209288326.000000000 1.882813627229751e-10 1209288327.000000000 -2.34722963288192e-10 1209288328.000000000 3.754893097840384e-12 1209288329.000000000 -1.839911834000674e-10 progress_src_input (00:00:05): 1209288330 seconds 1209288330.000000000 1.156410453506673e-10 1209288331.000000000 2.000694471204767e-10 1209288332.000000000 -9.744657164523218e-11 1209288333.000000000 2.505714385980795e-11 1209288334.000000000 -6.590048645671587e-11 progress_src_input (00:00:10): 1209288335 seconds 1209288335.000000000 6.652176726129611e-11 ...