29 from gstlal
import pipeparts
64 assert 1 <= channels <= 2
65 head =
test_common.gapped_test_src(pipeline, buffer_length = buffer_length, rate = rate, width = width, channels = channels, test_duration = test_duration, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename =
"%s_control.dump" % name)
66 head = tee = pipeparts.mktee(pipeline, head)
68 head = pipeparts.mkmatrixmixer(pipeline, head, numpy.identity(channels, dtype =
"double"))
69 head = pipeparts.mkchecktimestamps(pipeline, head)
70 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head),
"%s_out.dump" % name)
71 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, tee),
"%s_in.dump" % name)
85 def matrixmixer_test_02(name, dtype, samples, channels_in, channels_out):
87 input_array = numpy.random.random((samples, channels_in)).astype(dtype)
89 mix = numpy.random.random((channels_in, channels_out)).astype(
"float64")
92 output_reference = numpy.mat(input_array) * mix.astype(dtype)
96 if (output_array != output_reference).any():
97 raise ValueError(
"incorrect output: expected %s, got %s\ndifference = %s" % (output_reference, output_array, output_array - output_reference))
110 cmp_nxydumps.compare(
"matrixmixer_test_01a_in.dump",
"matrixmixer_test_01a_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
112 cmp_nxydumps.compare(
"matrixmixer_test_01b_in.dump",
"matrixmixer_test_01b_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
114 cmp_nxydumps.compare(
"matrixmixer_test_01c_in.dump",
"matrixmixer_test_01c_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
116 cmp_nxydumps.compare(
"matrixmixer_test_01d_in.dump",
"matrixmixer_test_01d_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
119 matrixmixer_test_02(
"matrixmixer_test_02a",
"float64", samples = 6, channels_in = 4, channels_out = 3)
120 matrixmixer_test_02(
"matrixmixer_test_02b",
"float32", samples = 6, channels_in = 4, channels_out = 3)