Differences between revisions 2 and 3
Revision 2 as of 2018-08-07 04:41:06
Size: 1683
Comment:
Revision 3 as of 2018-08-07 04:46:10
Size: 1697
Comment:
Deletions are marked like this. Additions are marked like this.
Line 45: Line 45:
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step0|Step 0: Make a frame cache file]]
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step2|Step 2: Dump lock flags from a frame cache file]]
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step2|(Next) Step 2: Dump lock flags from a frame cache file]]
 * [[KAGRA/Subgroups/CAL/GstLAL/tutorials/step0|(Prev) Step 0: Make a frame cache file]]

Step 1: Use GstLAL in your python script

  • Include the following part in your python script to use GstLAL

   1 import gi
   2 gi.require_version('Gst', '1.0')
   3 from gi.repository import GObject, Gst
   4 GObject.threads_init()
   5 Gst.init(None)
   6 
   7 from gstlal import pipeparts         as pp
   8 from gstlal import calibration_parts as cp
   9 from gstlal import simplehandler
  10 from gstlal import datasource
  • Setup your pipeline by specifying frame_cache(=cache file name) and instrument(=K1)

   1 pipeline = Gst.Pipeline(name=pname)
   2 mainloop = GObject.MainLoop()
   3 handler  = simplehandler.Handler(mainloop, pipeline)
  • Run your pipeline

   1 print >>sys.stderr, "seeking GPS start and stop times ..."
   2 if pipeline.set_state(Gst.State.READY) != Gst.StateChangeReturn.SUCCESS:
   3         raise RuntimeError("pipeline failed to enter READY state")
   4 datasource.pipeline_seek_for_gps(pipeline, gps_start_time, gps_end_time)
   5 
   6 print >>sys.stderr, "setting pipeline state to playing ..."
   7 if pipeline.set_state(Gst.State.PLAYING) != Gst.StateChangeReturn.SUCCESS:
   8         raise RuntimeError("pipeline failed to enter PLAYING state")
   9 else:
  10         print >>sys.stderr, "set to playing successfully"
  11 
  12 print >>sys.stderr, "running pipeline ..."
  13 
  14 mainloop.run()
  15 
  16 if pipeline.set_state(Gst.State.NULL) != Gst.StateChangeReturn.SUCCESS:
  17         raise RuntimeError("pipeline could not be set to NULL")

KAGRA/Subgroups/CAL/GstLAL/tutorials/step1 (last edited 2018-08-07 04:50:32 by SadakazuHaino)