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.mkpeak(pipeline, head, n = n)
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 peak_test_02(name, dtype, arrays, n, sample_fuzz = cmp_nxydumps.default_sample_fuzz):
88 output_reference =
None 89 for a
in range(arrays):
90 IA = numpy.random.random((n, channels_in)).astype(dtype)
93 if input_array
is not None:
94 input_array = numpy.append(input_array, IA, axis = 0)
95 output_reference = numpy.append(output_reference, OR, axis = 0)
100 output_array = numpy.reshape(numpy.ndarray.flatten(numpy.array(
test_common.transform_arrays([input_array], pipeparts.mkpeak, name, n = n))), output_reference.shape)
101 residual = abs((output_array - output_reference))
102 if residual[residual > sample_fuzz].any():
103 raise ValueError(
"incorrect output: expected %s, got %s\ndifference = %s" % (output_reference, output_array, residual))
116 cmp_nxydumps.compare(
"peak_test_01a_in.dump",
"peak_test_01a_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
118 cmp_nxydumps.compare(
"peak_test_01b_in.dump",
"peak_test_01b_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
120 peak_test_02(
"peak_test_02a",
"float64", arrays = 29, n = 117, sample_fuzz = cmp_nxydumps.default_sample_fuzz)
121 peak_test_02(
"peak_test_02b",
"float32", arrays = 29, n = 117, sample_fuzz = cmp_nxydumps.default_sample_fuzz**.5)
def compare(filename1, filename2, args, kwargs)
def build_and_run(pipelinefunc, name, segment=None, pipelinefunc_kwargs)
def 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)
def transform_arrays(input_arrays, elemfunc, name, rate=1, elemfunc_kwargs)