def line_separation_test_01(pipeline, name, line_sep=0.5): # # This test measures and plots the amount of contamination a calibration line adds to the result of demodulating at a nearby frequency as a function of frequency separation. # rate = 1000 # Hz buffer_length = 1.0 # seconds test_duration = 10.0 # seconds # # build pipeline # noise = test_common.test_src(pipeline, rate=16384, test_duration=1000, wave=5, src_suffix='0') noise = pipeparts.mkaudioamplify(pipeline, noise, 2.5) noise = pipeparts.mktee(pipeline, noise) signal = test_common.test_src(pipeline, rate=16384, test_duration=1000, wave=0, freq=16.3 + line_sep, src_suffix='1') noisy_signal = calibration_parts.mkadder( pipeline, calibration_parts.list_srcs(pipeline, signal, noise)) demod_noise = calibration_parts.demodulate(pipeline, noise, 16.3, True, 16, 20, 0) demod_noise = pipeparts.mkgeneric(pipeline, demod_noise, "cabs") rms_noise = calibration_parts.compute_rms(pipeline, demod_noise, 16, 900, filter_latency=0, rate_out=1) pipeparts.mknxydumpsink(pipeline, rms_noise, "rms_noise.txt") demod_signal = calibration_parts.demodulate(pipeline, noisy_signal, 16.3, True, 16, 20, 0) demod_signal = pipeparts.mkgeneric(pipeline, demod_signal, "cabs") rms_signal = calibration_parts.compute_rms(pipeline, demod_signal, 16, 900, filter_latency=0, rate_out=1) pipeparts.mknxydumpsink(pipeline, rms_signal, "rms_signal.txt") # # done # return pipeline
def lal_matrixsolver_01(pipeline, name): # # Make a bunch of fake data at 16 Hz to pass through the exact kappas function. # rate_in = 16 # Hz buffer_length = 1.0 # seconds test_duration = 300.0 # seconds channels = 10 * 11 # inputs to lal_matrixsolver # # build pipeline # head = test_common.test_src(pipeline, buffer_length=buffer_length, rate=rate_in, width=64, channels=channels, test_duration=test_duration, wave=5, freq=0) streams = calibration_parts.mkdeinterleave(pipeline, head, channels) head = calibration_parts.mkinterleave(pipeline, streams) solutions = pipeparts.mkgeneric(pipeline, head, "lal_matrixsolver") solutions = list(calibration_parts.mkdeinterleave(pipeline, solutions, 10)) for i in range(10): pipeparts.mknxydumpsink(pipeline, solutions[i], "solutions_%d.txt" % i) # # done # return pipeline
def fill_silence_test_01(pipeline, name, line_sep=0.5): # # This test is intended to help get rid of error messages associated with adding two streams that have different start times # rate = 16 # Hz buffer_length = 1.0 # seconds test_duration = 300.0 # seconds filter_latency = 1.0 # # build pipeline # head = test_common.test_src(pipeline, rate=rate, test_duration=test_duration, wave=5) head = pipeparts.mktee(pipeline, head) smooth = calibration_parts.mkcomplexfirbank( pipeline, head, latency=int((rate * 40 - 1) * filter_latency + 0.5), fir_matrix=[numpy.ones(rate * 40)], time_domain=True) smooth = calibration_parts.mkcomplexfirbank(pipeline, smooth, latency=23, fir_matrix=[numpy.ones(45)], time_domain=True) #smooth = pipeparts.mkgeneric(pipeline, head, "lal_smoothkappas", array_size = rate * 128, avg_array_size = rate * 10, filter_latency = 1) #smooth = pipeparts.mkgeneric(pipeline, smooth, "splitcounter", name = "smooth") #head = pipeparts.mkgeneric(pipeline, head, "splitcounter", name = "unsmooth") #channelmux_input_dict = {} #channelmux_input_dict["unsmooth"] = calibration_parts.mkqueue(pipeline, head) #channelmux_input_dict["smooth"] = calibration_parts.mkqueue(pipeline, smooth) #mux = pipeparts.mkframecppchannelmux(pipeline, channelmux_input_dict, frame_duration = 64, frames_per_file = 1, compression_scheme = 6, compression_level = 3) head = calibration_parts.mkadder( pipeline, calibration_parts.list_srcs(pipeline, head, smooth)) #mux = pipeparts.mkgeneric(pipeline, mux, "splitcounter", name = "sum") #head = calibration_parts.mkgate(pipeline, smooth, head, 0) pipeparts.mknxydumpsink(pipeline, head, "%s_out.txt" % name) #pipeparts.mkframecppfilesink(pipeline, mux, frame_type = "H1DCS", instrument = "H1") # # done # return pipeline
def rms_01(pipeline, name): # # This test passes a random series of integers through rms # rate_in = 2048 # Hz buffer_length = 1.0 # seconds test_duration = 50.0 # seconds # # build pipeline # head = test_common.test_src(pipeline, buffer_length=buffer_length, rate=rate_in, width=64, test_duration=test_duration, wave=5, freq=0) white_noise = pipeparts.mktee(pipeline, head) white_noise_over10 = pipeparts.mkaudioamplify(pipeline, white_noise, 0.1) white_noise_bp100to150 = calibration_parts.bandpass(pipeline, white_noise, 2048, length=1.0, f_low=100, f_high=150) white_noise_bp250to300 = calibration_parts.bandpass(pipeline, white_noise, 2048, length=1.0, f_low=250, f_high=300) white_noise_bp450to500 = calibration_parts.bandpass(pipeline, white_noise, 2048, length=1.0, f_low=450, f_high=500) white_noise_bp400to500 = calibration_parts.bandpass(pipeline, white_noise, 2048, length=1.0, f_low=400, f_high=500) rms = calibration_parts.compute_rms(pipeline, white_noise, 1024, 1.0, f_min=100, f_max=500) rms_over10 = calibration_parts.compute_rms(pipeline, white_noise_over10, 1024, 1.0, f_min=100, f_max=500) rms_bp100to150 = calibration_parts.compute_rms(pipeline, white_noise_bp100to150, 1024, 1.0, f_min=100, f_max=500) rms_bp250to300 = calibration_parts.compute_rms(pipeline, white_noise_bp250to300, 1024, 1.0, f_min=100, f_max=500) rms_bp450to500 = calibration_parts.compute_rms(pipeline, white_noise_bp450to500, 1024, 1.0, f_min=100, f_max=500) rms_bp400to500 = calibration_parts.compute_rms(pipeline, white_noise_bp400to500, 1024, 1.0, f_min=100, f_max=500) pipeparts.mknxydumpsink(pipeline, rms, "rms.txt") pipeparts.mknxydumpsink(pipeline, rms_over10, "rms_over10.txt") pipeparts.mknxydumpsink(pipeline, rms_bp100to150, "rms_bp100to150.txt") pipeparts.mknxydumpsink(pipeline, rms_bp250to300, "rms_bp250to300.txt") pipeparts.mknxydumpsink(pipeline, rms_bp450to500, "rms_bp450to500.txt") pipeparts.mknxydumpsink(pipeline, rms_bp400to500, "rms_bp400to500.txt") # # done # return pipeline