29 from gstlal
import pipeparts
64 head =
test_common.gapped_test_src(pipeline, buffer_length = buffer_length, rate = rate, width = width, wave = 1, freq = 0, channels = 1, test_duration = test_duration, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename =
"%s_control.dump" % name)
65 head = tee = pipeparts.mktee(pipeline, head)
67 head = pipeparts.mksumsquares(pipeline, head)
68 head = pipeparts.mkchecktimestamps(pipeline, head)
69 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head),
"%s_out.dump" % name)
70 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, tee),
"%s_in.dump" % name)
84 def sumsquares_test_02(name, dtype, samples, channels_in):
86 input_array = numpy.random.random((samples, channels_in)).astype(dtype)
88 weights = numpy.random.random((channels_in,)).astype(
"float64")
90 output_reference = ((weights.astype(dtype) * input_array)**2).sum(axis = 1)
91 output_reference.shape = output_reference.shape + (1,)
95 if (output_array != output_reference).any():
96 raise ValueError(
"incorrect output: expected %s, got %s\ndifference = %s" % (output_reference, output_array, output_array - output_reference))
109 cmp_nxydumps.compare(
"sumsquares_test_01a_in.dump",
"sumsquares_test_01a_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
111 cmp_nxydumps.compare(
"sumsquares_test_01b_in.dump",
"sumsquares_test_01b_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
114 sumsquares_test_02(
"sumsquares_test_02a",
"float64", samples = 6, channels_in = 4)
115 sumsquares_test_02(
"sumsquares_test_02b",
"float32", samples = 6, channels_in = 4)