gstlal 1.13.0
Loading...
Searching...
No Matches
togglecomplex_test_01.py
1#!/usr/bin/env python3
2# Copyright (C) 2014 Jolien Creighton
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
27import numpy
28import sys
29from gstlal import pipeparts
30import test_common
31import cmp_nxydumps
32
33
34#
35# =============================================================================
36#
37# Pipelines
38#
39# =============================================================================
40#
41
42
43
44def togglecomplex_test_01(pipeline, name, width, channels):
45 #
46 # try changing these. test should still work!
47 #
48
49 initial_channels = 2 # number of channels to generate
50 rate = 2048 # Hz
51 gap_frequency = 13.0 # Hz
52 gap_threshold = 0.8 # of 1
53 buffer_length = 1.0 # seconds
54 test_duration = 10.0 # seconds
55 mix = numpy.random.random((initial_channels, channels)).astype("float64")
56
57 #
58 # build pipeline
59 #
60
61 assert 1 <= initial_channels <= 2
62 head = test_common.gapped_test_src(pipeline, buffer_length = buffer_length, rate = rate, width = width, channels = initial_channels, test_duration = test_duration, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename = "%s_control.dump" % name)
63 head = pipeparts.mkmatrixmixer(pipeline, head, matrix = mix)
64 head = tee = pipeparts.mktee(pipeline, head)
65
66 head = pipeparts.mktogglecomplex(pipeline, head)
67 head = pipeparts.mkchecktimestamps(pipeline, head)
68 head = pipeparts.mktogglecomplex(pipeline, head)
69 head = pipeparts.mkchecktimestamps(pipeline, head)
70
71 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head), "%s_out.dump" % name)
72 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, tee), "%s_in.dump" % name)
73
74 #
75 # done
76 #
77
78 return pipeline
79
80
81
82#
83# =============================================================================
84#
85# Main
86#
87# =============================================================================
88#
89
90
91test_common.build_and_run(togglecomplex_test_01, "togglecomplex_test_01a", width = 64, channels = 2)
92cmp_nxydumps.compare("togglecomplex_test_01a_in.dump", "togglecomplex_test_01a_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
93test_common.build_and_run(togglecomplex_test_01, "togglecomplex_test_01b", width = 64, channels = 4)
94cmp_nxydumps.compare("togglecomplex_test_01b_in.dump", "togglecomplex_test_01b_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
95test_common.build_and_run(togglecomplex_test_01, "togglecomplex_test_01c", width = 32, channels = 2)
96cmp_nxydumps.compare("togglecomplex_test_01c_in.dump", "togglecomplex_test_01c_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
97test_common.build_and_run(togglecomplex_test_01, "togglecomplex_test_01d", width = 32, channels = 4)
98cmp_nxydumps.compare("togglecomplex_test_01d_in.dump", "togglecomplex_test_01d_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
compare(filename1, filename2, *args, **kwargs)
build_and_run(pipelinefunc, name, segment=None, **pipelinefunc_kwargs)
gapped_test_src(pipeline, buffer_length=1.0, rate=2048, width=64, channels=1, test_duration=10.0, wave=5, freq=0, gap_frequency=None, gap_threshold=None, control_dump_filename=None, tags=None, is_live=False, verbose=True)