gstlal  0.8.1
 All Classes Namespaces Files Functions Variables Pages
interp_test_01.py
1 #!/usr/bin/env python
2 #
3 # =============================================================================
4 #
5 # Preamble
6 #
7 # =============================================================================
8 #
9 
10 
11 import numpy
12 import sys
13 from gstlal import pipeparts
14 import test_common
15 
16 
17 #
18 # =============================================================================
19 #
20 # Pipelines
21 #
22 # =============================================================================
23 #
24 
25 
26 #
27 # check for timestamp drift in the audioresample
28 #
29 
30 
31 def interp_test_01(pipeline, name):
32  #
33  # try changing these. test should still work!
34  #
35 
36  in_rate = 64 # Hz
37  out_rate = 128 # Hz
38  gap_frequency = 0.5 # Hz
39  gap_threshold = .75 # of 1
40  buffer_length = 5.0 # seconds
41  test_duration = 20.0 # seconds
42 
43  #
44  # build pipeline
45  #
46 
47  head = test_common.gapped_test_src(pipeline, channels = 1, wave = 0, freq = 10, buffer_length = buffer_length, rate = in_rate, test_duration = test_duration, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename = "%s_control.dump" % name)
48  head = pipeparts.mkcapsfilter(pipeline, pipeparts.mkaudioconvert(pipeline, head), "audio/x-raw-float, rate=%d, width=32" % in_rate)
49  head = tee = pipeparts.mktee(pipeline, head)
50 
51  head = pipeparts.mkcapsfilter(pipeline, pipeparts.mkinterpolator(pipeline, head), "audio/x-raw-float, rate=%d" % out_rate)
52  pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head), "%s_out.dump" % name)
53  pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, tee), "%s_in.dump" % name)
54 
55  #
56  # done
57  #
58 
59  return pipeline
60 
61 
62 #
63 # =============================================================================
64 #
65 # Main
66 #
67 # =============================================================================
68 #
69 
70 
71 test_common.build_and_run(interp_test_01, "interp_test_01")
72