예제 #1
0
def lal_smoothkappas_02(pipeline, name):

	#
	# This is similar to the above test, and makes sure the element treats gaps correctly
	#

	rate = 1000	     # Hz
	width = 64	      # bytes
	wave = 5
	freq = 0.1	      # Hz
	volume = 0.03
	buffer_length = 1.0     # seconds
	test_duration = 10.0    # seconds
	gap_frequency = 0.2     # Hz
	gap_threshold = 0.5     # Hz
	control_dump_filename = "control_smoothkappas_02.dump"

	#
	# build pipeline
	#

	src = test_common.gapped_test_src(pipeline, channels = 2, buffer_length = buffer_length, rate = rate, width = width, test_duration = test_duration, wave = wave, freq = freq, volume = volume, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename = control_dump_filename)
        head = pipeparts.mktogglecomplex(pipeline, src)
        head = pipeparts.mktee(pipeline, head)
        pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head), "%s_in.dump" % name)
        median_avg = pipeparts.mkgeneric(pipeline, head, "lal_smoothkappas", array_size = 3, avg_array_size = 2, default_kappa_im = 0, default_kappa_re = 1, track_bad_kappa = False, default_to_median = True)
        kappa_track = pipeparts.mkgeneric(pipeline, head, "lal_smoothkappas", array_size = 30, avg_array_size = 160, default_kappa_im = 0, default_kappa_re = 1, track_bad_kappa = True, default_to_median = True)
        pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, median_avg), "%s_median_avg.dump" % name)
        pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, kappa_track), "%s_kappa_track.dump" % name)

	#
	# done
	#

	return pipeline
예제 #2
0
def lal_smoothkappas_04(pipeline, name):

	rate = 2000          # Hz
        width = 64            # bytes
        wave = 5
        freq = 0.1            # Hz
        volume = 0.03
        buffer_length = 1.0     # seconds
        test_duration = 10.0    # seconds
        gap_frequency = 0.1     # Hz
        gap_threshold = 0.5     # Hz
        control_dump_filename = "control_smoothkappas_02.dump"

        #
        # build pipeline
        #

        src = test_common.gapped_test_src(pipeline, channels = 1, buffer_length = buffer_length, rate = rate, width = width, test_duration = test_duration, wave = wave, freq = freq, volume = volume, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename = control_dump_filename)
	head = pipeparts.mkmatrixmixer(pipeline, src, matrix = [[1000]])
	head = pipeparts.mkgeneric(pipeline, head, "lal_add_constant", value = 340)
        head = pipeparts.mktee(pipeline, head)
        pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head), "%s_in.dump" % name)
        median_avg = pipeparts.mkgeneric(pipeline, head, "lal_smoothkappas", array_size = 3, avg_array_size = 2, default_kappa_im = 0, default_kappa_re = 330, track_bad_kappa = False, default_to_median = True)
        kappa_track = pipeparts.mkgeneric(pipeline, head, "lal_smoothkappas", array_size = 2049, avg_array_size = 160, default_kappa_im = 0, default_kappa_re = 330, track_bad_kappa = True, default_to_median = True)
        pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, median_avg), "%s_median_avg.dump" % name)
        pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, kappa_track), "%s_kappa_track.dump" % name)

        #
        # done
        #

	return pipeline
예제 #3
0
def lal_insertgap_test_02(pipeline, name):
    #
    # This tests the element's treatment of complex data streams.
    #

    rate = 1000  # Hz
    width = 32
    buffer_length = 1.0  # seconds
    test_duration = 100.0  # seconds
    gap_frequency = 0.1  # Hz
    gap_threshold = 0.0
    control_dump_filename = "control_insertgap_test_01.dump"
    #bad_data_intervals = numpy.random.random((4,)).astype("float64")
    #bad_data_intervals2 = numpy.random.random((4,)).astype("float64")
    bad_data_intervals = [-1e35, -1.0, -0.5, 1e35]
    bad_data_intervals2 = [-1e35, 0.5, 1.0, 1e35]

    head = test_common.gapped_test_src(
        pipeline,
        buffer_length=buffer_length,
        rate=rate,
        width=width,
        channels=2,
        test_duration=test_duration,
        wave=0,
        freq=1,
        volume=1,
        gap_frequency=gap_frequency,
        gap_threshold=gap_threshold,
        control_dump_filename=control_dump_filename)
    head = pipeparts.mktogglecomplex(pipeline, head)
    #head = test_common.test_src(pipeline, buffer_length = buffer_length, rate = rate, width = width, channels = 1, test_duration = test_duration, wave = 5, freq = 0, volume = 1)
    head = pipeparts.mkgeneric(pipeline,
                               head,
                               "lal_insertgap",
                               bad_data_intervals=bad_data_intervals,
                               insert_gap=True,
                               fill_discont=True,
                               replace_value=3.0)
    head = pipeparts.mktee(pipeline, head)
    pipeparts.mknxydumpsink(pipeline, head, "%s_in.dump" % name)
    head = pipeparts.mkgeneric(pipeline,
                               head,
                               "lal_insertgap",
                               bad_data_intervals=bad_data_intervals2,
                               insert_gap=True,
                               remove_gap=True,
                               fill_discont=True,
                               replace_value=7.0)
    pipeparts.mknxydumpsink(pipeline, head, "%s_out.dump" % name)

    #
    # done
    #

    return pipeline
예제 #4
0
def lal_insertgap_test_01(pipeline, name):
    #
    # This test should first replace negative numbers with zeros, and then replace them.
    #

    rate = 1000  # Hz
    width = 64
    buffer_length = 1.0  # seconds
    test_duration = 100.0  # seconds
    gap_frequency = 0.1  # Hz
    gap_threshold = 0.0
    control_dump_filename = "control_insertgap_test_01.dump"
    #bad_data_intervals = numpy.random.random((4,)).astype("float64")
    #bad_data_intervals2 = numpy.random.random((4,)).astype("float64")
    bad_data_intervals = [-1e35, -1.0, 0.0, 1e35]
    bad_data_intervals2 = [-1e35, 0.0, 0.0, 1e35]

    head = test_common.gapped_test_src(
        pipeline,
        buffer_length=buffer_length,
        rate=rate,
        width=width,
        channels=1,
        test_duration=test_duration,
        wave=0,
        freq=1,
        volume=1,
        gap_frequency=gap_frequency,
        gap_threshold=gap_threshold,
        control_dump_filename=control_dump_filename)
    #head = test_common.test_src(pipeline, buffer_length = buffer_length, rate = rate, width = width, channels = 1, test_duration = test_duration, wave = 5, freq = 0, volume = 1)
    head = pipeparts.mkgeneric(pipeline,
                               head,
                               "lal_insertgap",
                               bad_data_intervals=bad_data_intervals,
                               insert_gap=False,
                               fill_discont=True,
                               replace_value=0.0)
    head = pipeparts.mktee(pipeline, head)
    pipeparts.mknxydumpsink(pipeline, head, "%s_in.dump" % name)
    head = pipeparts.mkgeneric(pipeline,
                               head,
                               "lal_insertgap",
                               bad_data_intervals=bad_data_intervals2,
                               insert_gap=True,
                               fill_discont=True,
                               replace_value=7.0)
    pipeparts.mknxydumpsink(pipeline, head, "%s_out.dump" % name)

    #
    # done
    #

    return pipeline
예제 #5
0
def lal_constantupsample_04(pipeline, name):
    #
    # This is a simple test to see that the element treats gaps correctly for complex data
    #

    in_rate = 10  # Hz
    out_rate = 20  # Hz
    buffer_length = 1.0  # seconds
    test_duration = 10.0  # seconds
    gap_frequency = 0.1  # Hz
    gap_threshold = 0.02  # Hz
    control_dump_filename = "control.dump"

    #
    # build pipeline
    #

    src = test_common.gapped_test_src(
        pipeline,
        buffer_length=buffer_length,
        channels=2,
        rate=in_rate,
        test_duration=test_duration,
        width=64,
        gap_frequency=gap_frequency,
        gap_threshold=gap_threshold,
        control_dump_filename=control_dump_filename)
    test_duration = 10.0  # seconds
    togglecomplex1 = pipeparts.mktogglecomplex(pipeline, src)
    capsfilter1 = pipeparts.mkcapsfilter(
        pipeline, togglecomplex1,
        "audio/x-raw, format=Z128LE, rate=%d" % int(in_rate))
    tee1 = pipeparts.mktee(pipeline, capsfilter1)
    pipeparts.mknxydumpsink(
        pipeline,
        pipeparts.mkqueue(pipeline, pipeparts.mktogglecomplex(pipeline, tee1)),
        "%s_in.dump" % name)
    upsample = pipeparts.mkgeneric(pipeline, tee1, "lal_constantupsample")
    capsfilter2 = pipeparts.mkcapsfilter(
        pipeline, upsample,
        "audio/x-raw, format=Z128LE, rate=%d" % int(out_rate))
    #checktimestamps = pipeparts.mkchecktimestamps(pipeline, capsfilter2)
    pipeparts.mknxydumpsink(
        pipeline,
        pipeparts.mkqueue(pipeline,
                          pipeparts.mktogglecomplex(pipeline, capsfilter2)),
        "%s_out.dump" % name)

    #
    # done
    #

    return pipeline
예제 #6
0
def lal_demodulate_02(pipeline, name):
    #
    # This is similar to the above test, and makes sure the element treats gaps correctly
    #

    rate = 1000  # Hz
    buffer_length = 1.0  # seconds
    test_duration = 10.0  # seconds
    gap_frequency = 0.1  # Hz
    gap_threshold = 0.2  # Hz
    control_dump_filename = "control_demodulate_02.dump"

    src = test_common.gapped_test_src(
        pipeline,
        buffer_length=buffer_length,
        rate=rate,
        width=64,
        test_duration=test_duration,
        gap_frequency=gap_frequency,
        gap_threshold=gap_threshold,
        control_dump_filename=control_dump_filename)
    capsfilter1 = pipeparts.mkcapsfilter(
        pipeline, src, "audio/x-raw, format=F64LE, rate=%d" % int(rate))
    tee1 = pipeparts.mktee(pipeline, capsfilter1)
    pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, tee1),
                            "%s_in.dump" % name)
    demodulate = pipeparts.mkgeneric(pipeline, tee1, "lal_demodulate")
    capsfilter2 = pipeparts.mkcapsfilter(
        pipeline, demodulate,
        "audio/x-raw, format=Z128LE, rate=%d" % int(rate))
    togglecomplex = pipeparts.mktogglecomplex(pipeline, capsfilter2)
    capsfilter3 = pipeparts.mkcapsfilter(
        pipeline, togglecomplex,
        "audio/x-raw, format=F64LE, rate=%d" % int(rate))
    pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, capsfilter3),
                            "%s_out.dump" % name)

    #
    # done
    #

    return pipeline
예제 #7
0
def peak_test_01a(pipeline, name, handler):
    #
    # try changing these.  test should still work!
    #

    initial_channels = 2
    rate = 2048  #Hz
    width = 32
    sine_frequency = 1
    gap_frequency = 0.1  # Hz
    gap_threshold = 0.7  # of 1
    buffer_length = 1.0  # seconds
    test_duration = 10.0  # seconds
    peak_window = 2048  # samples
    wave = 0

    #
    # build pipeline
    #

    head = test_common.gapped_test_src(
        pipeline,
        buffer_length=buffer_length,
        rate=rate,
        width=width,
        channels=initial_channels,
        test_duration=test_duration,
        gap_frequency=gap_frequency,
        gap_threshold=gap_threshold,
        control_dump_filename="%s_control.dump" % name)
    head = pipeparts.mktogglecomplex(pipeline, head)
    head = pipeparts.mktaginject(
        pipeline, head, "instrument=H1,channel-name=LSC-STRAIN,units=strain")

    #head = test_common.gapped_complex_test_src(pipeline, buffer_length = buffer_length, rate = in_rate, test_duration = test_duration, wave = wave, freq = sine_frequency, gap_frequency = gap_frequency, gap_threshold = gap_threshold, control_dump_filename = "itac_test_01a_control.dump", tags = "instrument=H1,channel-name=LSC-STRAIN,units=strain")
    #head = tee = pipeparts.mktee(pipeline, head)
    #pipeparts.mktrigger(pipeline, head, peak_window, "test_bank.xml")

    # Does not recieve EOS, hangs
    #pipeparts.mktrigger(pipeline, head, peak_window,autocorrelation_matrix = numpy.ones((1,21), dtype=numpy.complex))

    #head = pipeparts.mkqueue(pipeline, pipeparts.mkitac(pipeline, head, peak_window, "test_bank.xml", autocorrelation_matrix = numpy.array([[0+0.j, 0+0.j, 1+1.j, 0+0.j, 0+0.j]])))
    #head = pipeparts.mkprogressreport(pipeline, head, "test")

    #
    # output the before and after
    #
    #pipeparts.mknxydumpsink(pipeline, pipeparts.mkqueue(pipeline, head), "%s_out.dump" % name)
    #pipeparts.mkfakesink(pipeline, head)

    #a = pipeparts.mkappsink(pipeline, pipeparts.mkqueue(pipeline, head))

    head = pipeparts.mkgeneric(pipeline, head, "lal_nxydump")

    sink = pipeparts.mkappsink(pipeline, head, max_buffers=1, sync=False)
    sink.connect("new-sample", handler.bufhandler)
    sink.connect("new-preroll", handler.prehandler)

    #outfile = open("itac_test_01a_out.dump", "w")

    #def dump_triggers(elem, output = outfile):
    #	for row in SnglInspiralTable.from_buffer(elem.emit("pull-buffer")):
    #		print >>outfile, row.end_time + row.end_time_ns*1e-9, row.snr, row.chisq, row.chisq_dof

    #a.connect_after("new-buffer", dump_triggers)
    #pipeparts.mknxydumpsink(pipeline, pipeparts.mktogglecomplex(pipeline, pipeparts.mkqueue(pipeline, tee)), "itac_test_01a_in.dump")

    #
    # done
    #

    #if "GST_DEBUG_DUMP_DOT_DIR" in os.environ:
    #	gst.DEBUG_BIN_TO_DOT_FILE(pipeline, gst.DEBUG_GRAPH_SHOW_ALL, "peak_test_01a")

    return pipeline