=== Step 7: Apply FIR filters and make a strain frame file === * For the initialization and running the pipeline, please refer [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step1|step1]] * Access frame cache file by specifying frame_cache and instrument as in [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step2|step2]] * Define a frame multiplexer(mux) to write channels into a frame as in [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step3|step3]] * Prepare for a filter file (filt.npz) following [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step6|step6]] * Here is the part to load the filters {{{#!python fd = numpy.load('filt.npz') afilt = fd['a'] cfilt = fd['c'] adelay = fd['dla'] # 16384 cdelay = fd['dlc'] # 4096 alatency = adelay/sample_rate clatency = cdelay/sample_rate latency = numpy.amax([alatency, clatency]) output_start = int(gps_start_time+latency) }}} * Here is the part to apply Actuation(A) and inverse-sensing(C) FIR filters on MICH_OUT(Ctrl signal) and MICH_IN(Error signal), respectively {{{#!python mco = pp.mktee(pipeline, pipe_dict["MOU"]) mci = pp.mktee(pipeline, pipe_dict["MIN"]) pipe_dict["MOU"] = mco pipe_dict["MIN"] = mci afl = pp.mkfirbank(pipeline, mco, latency = int(adelay), fir_matrix = [afilt[::-1]], time_domain = td) cfl = pp.mkfirbank(pipeline, mci, latency = int(cdelay), fir_matrix = [cfilt[::-1]], time_domain = td) }}} * Here is the part to add two channels (DELTA_TM and RESIDUAL) to produce strain (C01) and add (MICH_IN1/C and MICH_OUT*A) to produce strain (C02) {{{#!python afl = pp.mktee(pipeline, afl) cfl = pp.mktee(pipeline, cfl) dtm = pp.mktee(pipeline, pipe_dict["DTM"]) res = pp.mktee(pipeline, pipe_dict["RES"]) c01 = cp.mkadder(pipeline, cp.list_srcs(pipeline, [dtm, short_queue], [res, long_queue])) c02 = cp.mkadder(pipeline, cp.list_srcs(pipeline, [afl, short_queue], [cfl, long_queue])) c01 = pp.mkaudioamplify(pipeline, c01, 1./arm_length) c02 = pp.mkaudioamplify(pipeline, c02, 1./arm_length) }}} * The python script is available at git repository {{{ > kagra-cal/Observation/Phase1/tutorials/filt --help Usage: filt [options] Options: -h, --help show this help message and exit --cache=cache Set the name of the LAL cache listing the frame files --gps-start-time=seconds Set the start time of the segment to analyze in GPS seconds. --gps-end-time=seconds Set the end time of the segment to analyze in GPS seconds. --ifo=name Name of the IFO (default= K1) --channel=name Set channel names for MICH_IN1,MICH_OUT,MICH_RESIDUAL, MICH_DELTA_TM,C00_STRAIN (default= LSC-MICH1_IN1_DQ ,LSC-MICH1_OUT_DQ,CAL-CS_PROC_MICH_RESIDUAL_DQ,CAL- CS_PROC_MICH_DELTA_TM_DQ,CAL-CS_PROC_C00_STRAIN_DQ) --frame-type=name Set the frame type as input to the frame writing element. (Default=TEST) --output-path=name Set the output path for writing frame files. (Default=.) --format=format Set input channel(s) format (default= F64LE) --ch-rate=rate Set input channel data rate (default= 16384) --frame-duration=seconds Set the number of seconds for each frame. (Default =4) }}} * Here is an example to produce C01 and 02 from DELTA_TM+RESIDUAL and (MICH_IN1/C)+(MICH_OUT*A), respectively * Frame duration is set short because the first frame should be skipped because of the latency of applying FIR filter * It should be OK to ignore the warnings {{{ > kagra-cal/Observation/Phase1/tutorials/filt --cache=k1.cache GPS: 1209288320 1209288352 [('K1', 'LSC-MICH1_IN1_DQ'), ('K1', 'LSC-MICH1_OUT_DQ'), ('K1', 'CAL-CS_PROC_MICH_RESIDUAL_DQ'), ('K1', 'CAL-CS_PROC_MICH_DELTA_TM_DQ'), ('K1', 'CAL-CS_PROC_C00_STRAIN_DQ')] delay= 16384.0 4096.0 output_start= 1209288321 seeking GPS start and stop times ... setting pipeline state to playing ... set to playing successfully running pipeline ... (python:32371): GStreamer-WARNING **: gstpad.c:5079:store_sticky_event: Sticky event misordering, got 'segment' before 'stream-start' (python:32371): GStreamer-WARNING **: gstpad.c:5079:store_sticky_event: Sticky event misordering, got 'segment' before 'stream-start' (python:32371): GStreamer-WARNING **: gstpad.c:5079:store_sticky_event: Sticky event misordering, got 'segment' before 'stream-start' (python:32371): GStreamer-WARNING **: gstpad.c:5079:store_sticky_event: Sticky event misordering, got 'segment' before 'stream-start' (python:32371): GStreamer-WARNING **: gstpad.c:5079:store_sticky_event: Sticky event misordering, got 'segment' before 'stream-start' (python:32371): GStreamer-WARNING **: gstpad.c:5079:store_sticky_event: Sticky event misordering, got 'segment' before 'stream-start' progress_src_C00 (00:00:20): 1209288320 seconds progress_src_DTM (00:00:20): 1209288320 seconds progress_src_RES (00:00:20): 1209288320 seconds progress_src_MIN (00:00:20): 1209288352 / 32 seconds (3779026100.0 %) progress_src_MOU (00:00:20): 1209288352 / 32 seconds (3779026100.0 %) progress_src_C00 (00:00:20): 1209288352 / 32 seconds (3779026100.0 %) progress_src_DTM (00:00:20): 1209288352 / 32 seconds (3779026100.0 %) progress_src_RES (00:00:20): 1209288352 / 32 seconds (3779026100.0 %) progress_sink_K1 (00:00:24): 1209288324 seconds progress_sink_K1 (00:00:29): 1209288336 seconds progress_sink_K1 (00:00:35): 1209288348 seconds progress_sink_K1 (00:00:35): 1209288352 / 32 seconds (3779026100.0 %) }}} * Check the contents of the output frame files {{{ $LAL_PREFIX/bin/framecpp_query --list proc K-K1_TEST-1209288324-4.gwf Frame Version: 8 Frame Library: frameCPP Library Revision: 1 Originator: IGWD Frame Offset: 0 K1:CALIB_AFL K1:CALIB_C00 K1:CALIB_C01 K1:CALIB_C02 K1:CALIB_CFL K1:CALIB_DTM K1:CALIB_MIN K1:CALIB_MOU K1:CALIB_RES }}} * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step8|(Next) Step 8: Check the transfer function of FIR filters]] * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step6|(Prev) Step 6: Make FIR filters and save into a npz file]] * [[KAGRA/Subgroups/CAL/GstLAL/tutorials|Tutorials]]