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, sample_fuzz = cmp_nxydumps.default_sample_fuzz):
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 residual = abs((output_array - output_reference))
96 if residual[residual > sample_fuzz].any():
97 raise ValueError(
"incorrect output: expected %s, got %s\ndifference = %s" % (output_reference, output_array, residual))
110 cmp_nxydumps.compare(
"sumsquares_test_01a_in.dump",
"sumsquares_test_01a_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
112 cmp_nxydumps.compare(
"sumsquares_test_01b_in.dump",
"sumsquares_test_01b_out.dump", flags = cmp_nxydumps.COMPARE_FLAGS_EXACT_GAPS)
115 sumsquares_test_02(
"sumsquares_test_02a",
"float64", samples = 6, channels_in = 4, sample_fuzz = cmp_nxydumps.default_sample_fuzz)
116 sumsquares_test_02(
"sumsquares_test_02b",
"float32", samples = 6, channels_in = 4, 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)