Step 10: Read channel data from shared memory

   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)

   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)

   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)

> 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)

> 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.
...

> smlist
  id      name        nBuf   lBuf     nTotal
  32  K1                1     70000         5

> 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
...

KAGRA/Subgroups/CAL/GstLAL/tutorials/step10 (last edited 2018-08-16 02:57:08 by SadakazuHaino)