30 gi.require_version(
'Gst',
'1.0')
31 from gi.repository
import GObject, Gst
32 GObject.threads_init()
36 from gstlal
import pipeparts
57 def whiten_test_01a(pipeline, name):
67 def psd_resolution_changed(elem, pspec, ignored):
68 delta_f = elem.get_property(
"delta-f")
69 f_nyquist = elem.get_property(
"f-nyquist")
70 n = int(round(f_nyquist / delta_f) + 1)
71 elem.set_property(
"mean-psd", numpy.ones((n,), dtype =
"double") / (n * delta_f))
87 head =
test_common.test_src(pipeline, buffer_length = buffer_length, rate = rate, test_duration = test_duration, wave = 9)
88 head = pipeparts.mkgeneric(pipeline, head,
"audiocheblimit", mode = 1, cutoff = 0.25)
89 head = tee = pipeparts.mktee(pipeline, head)
90 head = pipeparts.mkwhiten(pipeline, head, psd_mode = 1, zero_pad = zero_pad, fft_length = fft_length)
91 head.connect_after(
"notify::f-nyquist", psd_resolution_changed,
None)
92 head.connect_after(
"notify::delta-f", psd_resolution_changed,
None)
93 head = pipeparts.mkchecktimestamps(pipeline, head)
94 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head),
"%s_out.dump" % name)
95 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, tee, max_size_time = int(fft_length * Gst.SECOND)),
"%s_in.dump" % name)
110 def whiten_test_01b(pipeline, name):
119 test_duration = 10000.0
125 head =
test_common.test_src(pipeline, buffer_length = buffer_length, rate = rate, test_duration = test_duration, wave = 6)
126 head = pipeparts.mkwhiten(pipeline, head, psd_mode = 0, zero_pad = zero_pad, fft_length = fft_length)
127 head = pipeparts.mkchecktimestamps(pipeline, head)
128 pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head),
"%s_out.dump" % name)
149 cmp_nxydumps.compare(
"whiten_test_01a_in.dump",
"whiten_test_01a_out.dump", transients = (2.0, 2.0), sample_fuzz = 1e-2)
def compare(filename1, filename2, args, kwargs)
def build_and_run(pipelinefunc, name, segment=None, pipelinefunc_kwargs)
def test_src(pipeline, buffer_length=1.0, rate=2048, width=64, channels=1, test_duration=10.0, wave=5, freq=0, is_live=False, verbose=True)