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

	#
	# Very simple test of data storage in queues
	#

	rate = 1000	     # Hz
	buffer_length = 1.0     # seconds
	test_duration = 100.0   # seconds

	#
	# build pipeline
	#

	src = test_common.test_src(pipeline, buffer_length = buffer_length, rate = rate, test_duration = test_duration, width = 32)
	head = pipeparts.mkgeneric(pipeline, src, "splitcounter", name = "before_queue")
	head = calibration_parts.mkqueue(pipeline, head, 50)
	head = pipeparts.mkgeneric(pipeline, head, "splitcounter", name = "after_queue")
	pipeparts.mkfakesink(pipeline, head)

	#
	# done
	#

	return pipeline
예제 #2
0
def detect_change(pipeline, name):
    # Get the data from the frames
    data = pipeparts.mklalcachesrc(pipeline,
                                   location=options.frame_cache,
                                   cache_dsc_regex=options.ifo)
    data = pipeparts.mkframecppchanneldemux(pipeline,
                                            data,
                                            do_file_checksum=False,
                                            skip_bad_files=True,
                                            channel_list=list(
                                                map("%s:%s".__mod__,
                                                    ifo_channel_list)))

    streams = []
    for chan in channel_list:
        stream = calibration_parts.hook_up(pipeline, data, chan, options.ifo,
                                           64.0)
        streams.append(stream)
    summed_streams = calibration_parts.mkadder(pipeline, streams)

    if options.statevector_channel is not None:
        state_vector = calibration_parts.hook_up(pipeline, data,
                                                 options.statevector_channel,
                                                 options.ifo, 64.0)
        state_vector = pipeparts.mkgeneric(pipeline,
                                           state_vector,
                                           "lal_logicalundersample",
                                           required_on=1)
        summed_streams = calibration_parts.mkgate(pipeline,
                                                  summed_streams,
                                                  state_vector,
                                                  threshold=1.0)

    summed_streams = pipeparts.mkgeneric(
        pipeline,
        summed_streams,
        "lal_detectchange",
        average_samples=int(options.average_time * options.sample_rate),
        detection_threshold=options.detection_threshold,
        filename=options.filename)
    pipeparts.mkfakesink(pipeline, summed_streams)

    #
    # done
    #

    return pipeline
예제 #3
0
def lal_fcc_update_01(pipeline, name):

    #
    # This test passes an impulse through the fcc_updater
    #

    data_rate = 16384  # Hz
    fcc_rate = 16  # Hz
    fcc_default = 360  # Hz
    fcc_update = 345  # Hz
    fcc_averaging_time = 5  # seconds
    fcc_filter_duration = 1  # seconds
    fcc_filter_taper_length = 32768  # seconds
    impulse_separation = 1.0  # seconds
    buffer_length = 1.0  # seconds
    test_duration = 10.0  # seconds

    #
    # build pipeline
    #

    src = pipeparts.mktee(
        pipeline,
        test_common.test_src(pipeline,
                             buffer_length=buffer_length,
                             wave=0,
                             freq=1.0 / impulse_separation,
                             rate=data_rate,
                             test_duration=test_duration,
                             width=64))

    impulses = calibration_parts.mkinsertgap(
        pipeline,
        src,
        bad_data_intervals=[0.999999999, 1.00000001],
        block_duration=buffer_length * Gst.SECOND)
    impulses = pipeparts.mktee(pipeline, impulses)
    pipeparts.mknxydumpsink(pipeline, impulses, "%s_impulses.txt" % name)

    fcc = calibration_parts.mkresample(
        pipeline, src, 0, False, "audio/x-raw,format=F64LE,rate=%d" % fcc_rate)
    fcc = pipeparts.mkpow(pipeline, fcc, exponent=0.0)
    fcc = pipeparts.mkgeneric(pipeline,
                              fcc,
                              "lal_add_constant",
                              value=fcc_update - 1)
    fcc = pipeparts.mktee(pipeline, fcc)
    pipeparts.mknxydumpsink(pipeline, fcc, "%s_fcc.txt" % name)
    update_fcc = pipeparts.mkgeneric(pipeline,
                                     fcc,
                                     "lal_fcc_update",
                                     data_rate=data_rate,
                                     fcc_rate=fcc_rate,
                                     fcc_model=fcc_default,
                                     averaging_time=fcc_averaging_time,
                                     filter_duration=fcc_filter_duration)
    pipeparts.mkfakesink(pipeline, update_fcc)

    default_fir_matrix = numpy.zeros(
        int(
            numpy.floor(data_rate * fcc_filter_duration / 2.0 + 1) * 2.0 -
            2.0))
    latency = int(data_rate * fcc_filter_duration / 2.0 + 1)
    default_fir_matrix[latency] = 1.0
    res = pipeparts.mkgeneric(pipeline,
                              impulses,
                              "lal_tdwhiten",
                              kernel=default_fir_matrix[::-1],
                              latency=latency,
                              taper_length=fcc_filter_taper_length)
    update_fcc.connect("notify::fir-matrix", fir_matrix_update, res)
    pipeparts.mknxydumpsink(pipeline, res, "%s_out.txt" % name)

    #
    # done
    #

    return pipeline
예제 #4
0
# Set the pipeline up
#

pipeline = gst.Pipeline("veto_receiver")
mainloop = gobject.MainLoop()
handler = simplehandler.Handler(mainloop, pipeline)

# Create the tcpserversrc
tcpsrc = pipeparts.mkgeneric(pipeline, None, "tcpserversrc")
tcpsrc.set_property("protocol", "GST_TCP_PROTOCOL_GDP")
tcpsrc.set_property("host", options.tcp_host)
tcpsrc.set_property("port", options.tcp_port)

# Final destination.
if options.output_type == "fake":
    fakesink = pipeparts.mkfakesink(pipeline, tcpsrc)
    fs_pad = fakesink.get_pad("sink")
    fs_pad.add_event_probe(probeEventHandler)
    fs_pad.add_buffer_probe(probeBufferHandler)
elif options.output_type == "multicast":
    fx = pipeparts.mkgeneric(pipeline,
                             tcpsrc,
                             "gds_framexmitsink",
                             multicast_group=options.multicast_group,
                             multicast_iface=options.multicast_network,
                             port=options.multicast_port,
                             sync=False)
    if options.verbose:
        gst.debug_set_threshold_for_name('gds_framexmitsink', gst.LEVEL_LOG)
    fx_pad = fx.get_pad("sink")
    fx_pad.add_event_probe(probeEventHandler)
#

# Set the pipeline up
pipeline = gst.Pipeline("gst_idq_listener")
mainloop = gobject.MainLoop()
handler = simplehandler.Handler(mainloop,pipeline)

# Create the framexmitsrc
src = pipeparts.mkframexmitsrc(pipeline, multicast_group=options.multicast_group,
    multicast_iface=options.multicast_iface, port=options.multicast_port)
if options.verbose:
    gst.debug_set_threshold_for_name('gds_framexmitsrc', gst.LEVEL_LOG)

# Final destination.
if options.output_type == "fake":
    fakesink = pipeparts.mkfakesink(pipeline, src)    
    fs_pad = fakesink.get_pad("sink")
    fs_pad.add_event_probe(probeEventHandler)
    fs_pad.add_buffer_probe(probeBufferHandler) 
elif options.output_type == "files":
    try:
        os.makedirs(options.output_path)
    except Exception as e:
        print "Failed with %s" % e

    # Inject tags.  The framecpp_filesink element uses the tags to figure
    # out the output filename.
    src = pipeparts.mktaginject(pipeline, src, "instrument=%s" % options.instrument)

    path = options.output_path
    if path: