gstlal  0.8.1
 All Classes Namespaces Files Functions Variables Pages
framesrc_test_01.py
1 #!/usr/bin/env python
2 # Copyright (C) 2010 Kipp Cannon
3 #
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation; either version 2 of the License, or (at your
7 # option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
12 # Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 
18 #
19 # =============================================================================
20 #
21 # Preamble
22 #
23 # =============================================================================
24 #
25 
26 
27 from gstlal import pipeparts
28 from gstlal.pipeparts import gst
29 from pylal.datatypes import LIGOTimeGPS
30 import test_common
31 
32 
33 #
34 # =============================================================================
35 #
36 # Pipelines
37 #
38 # =============================================================================
39 #
40 
41 
42 #
43 # check consistency of buffer metadata generated by framesrc, and confirm
44 # that seeking and EOS work as expected
45 #
46 
47 
48 def framesrc_test_01a(pipeline, name):
49  #
50  # change these as needed to make test run on your machine
51  #
52 
53  location = "/home/kipp/scratch_local/874100000-20000/cache/874000000-20000.cache"
54  instrument = "H1"
55  channel_name = "LSC-STRAIN"
56 
57  #
58  # build pipeline
59  #
60 
61  head = pipeparts.mkframecppchanneldemux(pipeline, pipeparts.mkcachesrc(pipeline, location = location, cache_src_regex = "%s.*" % instrument[0]))
62  elem = pipeparts.mkqueue(pipeline, None, max_size_time = 8 * gst.SECOND)
63  pipeparts.src_deferred_link(head, "%s:%s" % (instrument, channel_name), elem.get_pad("sink"))
64  head = elem
65 
66  head = pipeparts.mkprogressreport(pipeline, head, "src")
67  head = pipeparts.mkchecktimestamps(pipeline, head)
68  pipeparts.mkfakesink(pipeline, head)
69 
70  #
71  # done
72  #
73 
74  return pipeline
75 
76 
77 #
78 # =============================================================================
79 #
80 # Main
81 #
82 # =============================================================================
83 #
84 
85 
86 test_common.build_and_run(framesrc_test_01a, "framesrc_test_01a", segment = (LIGOTimeGPS(874000016), LIGOTimeGPS(874000600)))
87