gstlal  0.8.1
 All Classes Namespaces Files Functions Variables Pages
gate_test_01.py
1 #!/usr/bin/env python
2 # Copyright (C) 2014 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 import numpy
28 import sys
29 from gstlal import pipeparts
30 import cmp_nxydumps
31 import test_common
32 
33 
34 #
35 # =============================================================================
36 #
37 # Pipelines
38 #
39 # =============================================================================
40 #
41 
42 
43 def gate_test_01(pipeline, name):
44  #
45  # try changing these. test should still work!
46  #
47 
48  rate = 2048 # Hz
49  gap_frequency = 13.0 # Hz
50  gap_threshold = 0.8 # of 1
51  buffer_length = 1.0 # seconds
52  test_duration = 10.0 # seconds
53 
54  #
55  # build pipeline
56  #
57 
58  head = test_common.gapped_test_src(pipeline, buffer_length = buffer_length, rate = rate, width = 64, test_duration = test_duration, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename = "%s_control.dump" % name)
59  control = test_common.gapped_test_src(pipeline, buffer_length = buffer_length / 3, rate = rate, width = 32, test_duration = test_duration, gap_frequency = gap_frequency / 3, gap_threshold = gap_threshold, verbose = False)
60 
61  head = pipeparts.mkgate(pipeline, head, control = control, threshold = float("+inf"))
62 
63  pipeparts.mkfakesink(pipeline, head)
64 
65  #
66  # done
67  #
68 
69  return pipeline
70 
71 
72 #
73 # =============================================================================
74 #
75 # Main
76 #
77 # =============================================================================
78 #
79 
80 
81 test_common.build_and_run(gate_test_01, "gate_test_01a")