diff --git a/.gitattributes b/.gitattributes index 9766eb121b025e18b8b9701a153e92d5708d610e..442e7b478608a44cd4aff6f84a229ef49fc34ab3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.gwf filter=lfs diff=lfs merge=lfs -text +*.txt filter=lfs diff=lfs merge=lfs -text diff --git a/tests/tests_pytest/ASD.py b/tests/tests_pytest/ASD.py index 06e05fa1cfa955d5db4b6f7515b5ada2e51e99db..b2bbd6f2b8b312c2107b3c7f4d9ca63263352534 100755 --- a/tests/tests_pytest/ASD.py +++ b/tests/tests_pytest/ASD.py @@ -53,8 +53,8 @@ def compute_ASD_from_cache(pipeline, name): clean = calibration_parts.hook_up(pipeline, data, "GDS-CALIB_STRAIN_CLEAN", ifo, 1.0, element_name_suffix = "1") hoft = pipeparts.mkprogressreport(pipeline, hoft, "hoft") clean = pipeparts.mkprogressreport(pipeline, clean, "clean") - pipeparts.mkgeneric(pipeline, hoft, "lal_asd", filename = "tests/tests_pytest/ASD_data/hoft_asd.txt", fft_samples = 16 * 16384, overlap_samples = int(2 * 16384)) - pipeparts.mkgeneric(pipeline, clean, "lal_asd", filename = "tests/tests_pytest/ASD_data/clean_asd.txt", fft_samples = 16 * 16384, overlap_samples = int(2 * 16384)) + pipeparts.mkgeneric(pipeline, hoft, "lal_asd", filename = "tests/tests_pytest/ASD_data/hoft_asd.txt", fft_samples = 16384, overlap_samples = 8192) + pipeparts.mkgeneric(pipeline, clean, "lal_asd", filename = "tests/tests_pytest/ASD_data/clean_asd.txt", fft_samples = 16384, overlap_samples = 8192) # # done diff --git a/tests/tests_pytest/act2darm_timeseries.py b/tests/tests_pytest/act2darm_timeseries.py index 4f2c84f0fbcd7159f4b6b0aa11fed2d722a51cd1..924d281c821a44379d66a82529193b3b963b3420 100755 --- a/tests/tests_pytest/act2darm_timeseries.py +++ b/tests/tests_pytest/act2darm_timeseries.py @@ -71,10 +71,13 @@ gstlal_channels = ['GDS-CALIB_STRAIN', 'GDS-CALIB_STRAIN'] # Set list of all channels channel_list = [] act_channels = ['SUS-ETMX_L3_CAL_LINE_OUT_DQ', 'SUS-ETMX_L2_CAL_LINE_OUT_DQ', 'SUS-ETMX_L1_CAL_LINE_OUT_DQ'] +TDCF_channels = ['GDS-CALIB_KAPPA_TST_REAL', 'GDS-CALIB_KAPPA_TST_IMAGINARY', 'GDS-CALIB_KAPPA_PUM_REAL', 'GDS-CALIB_KAPPA_PUM_IMAGINARY', 'GDS-CALIB_KAPPA_UIM_REAL', 'GDS-CALIB_KAPPA_UIM_IMAGINARY'] for channel in act_channels: - channel_list.append((ifo, channel)) + channel_list.append((ifo, channel)) for channel in gstlal_channels: - channel_list.append((ifo, channel)) + channel_list.append((ifo, channel)) +for channel in TDCF_channels: + channel_list.append((ifo, channel)) # Read stuff we need from the filters file frequencies = [] @@ -83,22 +86,22 @@ act_corrections = [] act_line_names = ['ktst_esd', 'pum_act', 'uim_act'] EPICS = ['AT0_fT', 'AP0_fP', 'AU0_fU'] for i in range(len(act_line_names)): - frequencies.append(float(filters["%s_line_freq" % act_line_names[i]])) - act_corrections.append(float(filters["%s_re" % EPICS[i]])) - act_corrections.append(float(filters["%s_im" % EPICS[i]])) + frequencies.append(float(filters["%s_line_freq" % act_line_names[i]])) + act_corrections.append(float(filters["%s_re" % EPICS[i]])) + act_corrections.append(float(filters["%s_im" % EPICS[i]])) act_time_advance = 0.00006103515625 for i in range(0, len(act_corrections) // 2): - corr = act_corrections[2 * i] + 1j * act_corrections[2 * i + 1] - corr *= numpy.exp(2.0 * numpy.pi * 1j * frequencies[i] * act_time_advance) - act_corrections[2 * i] = numpy.real(corr) - act_corrections[2 * i + 1] = numpy.imag(corr) + corr = act_corrections[2 * i] + 1j * act_corrections[2 * i + 1] + corr *= numpy.exp(2.0 * numpy.pi * 1j * frequencies[i] * act_time_advance) + act_corrections[2 * i] = numpy.real(corr) + act_corrections[2 * i + 1] = numpy.imag(corr) demodulated_act_list = [] try: - arm_length = float(filters['arm_length']) + arm_length = float(filters['arm_length']) except: - arm_length = 3995.1 + arm_length = 3995.1 # demodulation and averaging parameters filter_time = 20 @@ -117,56 +120,102 @@ rate_out = 1 def act2darm(pipeline, name): # Get actuation injection channels from the raw frames - act_inj_channels = [] - raw_data = pipeparts.mklalcachesrc(pipeline, location = "tests/tests_pytest/raw_frames.cache", cache_dsc_regex = ifo) - raw_data = pipeparts.mkframecppchanneldemux(pipeline, raw_data, do_file_checksum = False, skip_bad_files = True, channel_list = list(map("%s:%s".__mod__, channel_list))) - for i in range(len(act_channels)): - act_inj_channels.append(calibration_parts.hook_up(pipeline, raw_data, act_channels[i], ifo, 1.0)) - act_inj_channels[i] = calibration_parts.caps_and_progress(pipeline, act_inj_channels[i], "audio/x-raw,format=F64LE,channels=1,channel-mask=(bitmask)0x0", "act_inj_%d" % i) - act_inj_channels[i] = pipeparts.mktee(pipeline, act_inj_channels[i]) + act_inj_channels = [] + raw_data = pipeparts.mklalcachesrc(pipeline, location = "tests/tests_pytest/raw_frames.cache", cache_dsc_regex = ifo) + raw_data = pipeparts.mkframecppchanneldemux(pipeline, raw_data, do_file_checksum = False, skip_bad_files = True, channel_list = list(map("%s:%s".__mod__, channel_list))) + for i in range(len(act_channels)): + act_inj_channels.append(calibration_parts.hook_up(pipeline, raw_data, act_channels[i], ifo, 1.0)) + act_inj_channels[i] = calibration_parts.caps_and_progress(pipeline, act_inj_channels[i], "audio/x-raw,format=F64LE,channels=1,channel-mask=(bitmask)0x0", "act_inj_%d" % i) + act_inj_channels[i] = pipeparts.mktee(pipeline, act_inj_channels[i]) # Demodulate the actuation injection channels at the lines of interest - for i in range(len(frequencies)): - demodulated_act = calibration_parts.demodulate(pipeline, act_inj_channels[i], frequencies[i], True, rate_out, filter_time, 0.5, prefactor_real = act_corrections[2 * i], prefactor_imag = act_corrections[2 * i + 1]) - demodulated_act_list.append(pipeparts.mktee(pipeline, demodulated_act)) + for i in range(len(frequencies)): + demodulated_act = calibration_parts.demodulate(pipeline, act_inj_channels[i], frequencies[i], True, rate_out, filter_time, 0.5, prefactor_real = act_corrections[2 * i], prefactor_imag = act_corrections[2 * i + 1]) + demodulated_act_list.append(pipeparts.mktee(pipeline, demodulated_act)) - cache_num = 0 - for cache, channel, in zip(gstlal_frame_cache_list, gstlal_channels): + cache_num = 0 + for cache, channel, in zip(gstlal_frame_cache_list, gstlal_channels): + version = "Approx" if "Approx" in cache else "Exact" # Get gstlal channels from the gstlal frames - hoft_data = pipeparts.mklalcachesrc(pipeline, location = cache, cache_dsc_regex = ifo) - hoft_data = pipeparts.mkframecppchanneldemux(pipeline, hoft_data, do_file_checksum = False, skip_bad_files = True, channel_list = list(map("%s:%s".__mod__, channel_list))) - hoft = calibration_parts.hook_up(pipeline, hoft_data, channel, ifo, 1.0, element_name_suffix = "_%d" % cache_num) - hoft = calibration_parts.caps_and_progress(pipeline, hoft, "audio/x-raw,format=F64LE,channels=1,channel-mask=(bitmask)0x0", "%s_%d" % (channel, cache_num)) - deltal = pipeparts.mkaudioamplify(pipeline, hoft, arm_length) - deltal = pipeparts.mktee(pipeline, deltal) - - for i in range(len(frequencies)): + hoft_data = pipeparts.mklalcachesrc(pipeline, location = cache, cache_dsc_regex = ifo) + hoft_data = pipeparts.mkframecppchanneldemux(pipeline, hoft_data, do_file_checksum = False, skip_bad_files = True, channel_list = list(map("%s:%s".__mod__, channel_list))) + hoft = calibration_parts.hook_up(pipeline, hoft_data, channel, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + hoft = calibration_parts.caps_and_progress(pipeline, hoft, "audio/x-raw,format=F64LE,channels=1,channel-mask=(bitmask)0x0", "%s_%d" % (channel, cache_num)) + deltal = pipeparts.mkaudioamplify(pipeline, hoft, arm_length) + deltal = pipeparts.mktee(pipeline, deltal) + + for i in range(len(frequencies)): # Demodulate \DeltaL at each line - demodulated_deltal = calibration_parts.demodulate(pipeline, deltal, frequencies[i], True, rate_out, filter_time, 0.5) - # Take ratio \DeltaL(f) / act(f) - deltaL_over_act = calibration_parts.complex_division(pipeline, demodulated_deltal, demodulated_act_list[i]) + demodulated_deltal = calibration_parts.demodulate(pipeline, deltal, frequencies[i], True, rate_out, filter_time, 0.5) + + # Divide by a TDCF if needed + if 'tst' in act_line_names[i] or 'esd' in act_line_names[i]: + # Get KAPPA_TST + TDCF_real = "GDS-CALIB_KAPPA_TST_REAL" + TDCF_imag = "GDS-CALIB_KAPPA_TST_IMAGINARY" + TDCF_real = calibration_parts.hook_up(pipeline, hoft_data, TDCF_real, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + TDCF_imag = calibration_parts.hook_up(pipeline, hoft_data, TDCF_imag, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + TDCF = calibration_parts.merge_into_complex(pipeline, TDCF_real, TDCF_imag) + TDCF = calibration_parts.caps_and_progress(pipeline, TDCF, "audio/x-raw,format=Z128LE,channels=1,channel-mask=(bitmask)0x0", 'KAPPA_TST_%s' % version) + TDCF = calibration_parts.mkresample(pipeline, TDCF, 3, False, rate_out) + if "Approx" in cache: + # Only divide by the magnitude + TDCF = pipeparts.mkgeneric(pipeline, TDCF, "cabs") + TDCF = pipeparts.mktogglecomplex(pipeline, calibration_parts.mkmatmix(pipeline, TDCF, matrix = [[1.0, 0.0]])) + demodulated_deltal = calibration_parts.complex_division(pipeline, demodulated_deltal, TDCF) + elif 'pum' in act_line_names[i]: + # Get KAPPA_PUM + TDCF_real = "GDS-CALIB_KAPPA_PUM_REAL" + TDCF_imag = "GDS-CALIB_KAPPA_PUM_IMAGINARY" + TDCF_real = calibration_parts.hook_up(pipeline, hoft_data, TDCF_real, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + TDCF_imag = calibration_parts.hook_up(pipeline, hoft_data, TDCF_imag, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + TDCF = calibration_parts.merge_into_complex(pipeline, TDCF_real, TDCF_imag) + TDCF = calibration_parts.caps_and_progress(pipeline, TDCF, "audio/x-raw,format=Z128LE,channels=1,channel-mask=(bitmask)0x0", 'KAPPA_PUM_%s' % version) + TDCF = calibration_parts.mkresample(pipeline, TDCF, 3, False, rate_out) + if "Approx" in cache: + # Only divide by the magnitude + TDCF = pipeparts.mkgeneric(pipeline, TDCF, "cabs") + TDCF = pipeparts.mktogglecomplex(pipeline, calibration_parts.mkmatmix(pipeline, TDCF, matrix = [[1.0, 0.0]])) + demodulated_deltal = calibration_parts.complex_division(pipeline, demodulated_deltal, TDCF) + elif 'uim' in act_line_names[i]: + # Get KAPPA_UIM + TDCF_real = "GDS-CALIB_KAPPA_UIM_REAL" + TDCF_imag = "GDS-CALIB_KAPPA_UIM_IMAGINARY" + TDCF_real = calibration_parts.hook_up(pipeline, hoft_data, TDCF_real, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + TDCF_imag = calibration_parts.hook_up(pipeline, hoft_data, TDCF_imag, ifo, 1.0, element_name_suffix = "_%d" % cache_num) + TDCF = calibration_parts.merge_into_complex(pipeline, TDCF_real, TDCF_imag) + TDCF = calibration_parts.caps_and_progress(pipeline, TDCF, "audio/x-raw,format=Z128LE,channels=1,channel-mask=(bitmask)0x0", 'KAPPA_UIM_%s' % version) + TDCF = calibration_parts.mkresample(pipeline, TDCF, 3, False, rate_out) + if "Approx" in cache: + # Only divide by the magnitude + TDCF = pipeparts.mkgeneric(pipeline, TDCF, "cabs") + TDCF = pipeparts.mktogglecomplex(pipeline, calibration_parts.mkmatmix(pipeline, TDCF, matrix = [[1.0, 0.0]])) + demodulated_deltal = calibration_parts.complex_division(pipeline, demodulated_deltal, TDCF) + + # Take ratio \DeltaL(f) / act(f) + deltaL_over_act = calibration_parts.complex_division(pipeline, demodulated_deltal, demodulated_act_list[i]) # Take a running median - deltaL_over_act = pipeparts.mkgeneric(pipeline, deltaL_over_act, "lal_smoothkappas", array_size = int(rate_out * median_time), no_default = True, filter_latency = 0.5) + deltaL_over_act = pipeparts.mkgeneric(pipeline, deltaL_over_act, "lal_smoothkappas", array_size = int(rate_out * median_time), no_default = True, filter_latency = 0.5) # The first samples are not median'ed. Remove only half, since sometimes early data is important. - deltaL_over_act = calibration_parts.mkinsertgap(pipeline, deltaL_over_act, insert_gap = False, chop_length = 500000000 * median_time) + deltaL_over_act = calibration_parts.mkinsertgap(pipeline, deltaL_over_act, insert_gap = False, chop_length = 500000000 * median_time) # Find the magnitude - deltaL_over_act = pipeparts.mktee(pipeline, deltaL_over_act) - magnitude = pipeparts.mkgeneric(pipeline, deltaL_over_act, "cabs") + deltaL_over_act = pipeparts.mktee(pipeline, deltaL_over_act) + magnitude = pipeparts.mkgeneric(pipeline, deltaL_over_act, "cabs") # Find the phase - phase = pipeparts.mkgeneric(pipeline, deltaL_over_act, "carg") - phase = pipeparts.mkaudioamplify(pipeline, phase, 180.0 / numpy.pi) + phase = pipeparts.mkgeneric(pipeline, deltaL_over_act, "carg") + phase = pipeparts.mkaudioamplify(pipeline, phase, 180.0 / numpy.pi) # Interleave - magnitude_and_phase = calibration_parts.mkinterleave(pipeline, [magnitude, phase]) - magnitude_and_phase = pipeparts.mkprogressreport(pipeline, magnitude_and_phase, name = "progress_sink_%s_%d_%d" % (channel, cache_num, i)) + magnitude_and_phase = calibration_parts.mkinterleave(pipeline, [magnitude, phase]) + magnitude_and_phase = pipeparts.mkprogressreport(pipeline, magnitude_and_phase, name = "progress_sink_%s_%d_%d" % (channel, cache_num, i)) # Write to file - pipeparts.mknxydumpsink(pipeline, magnitude_and_phase, "tests/tests_pytest/act_data/%s_%s_over_Act_%d_at_%0.1fHz.txt" % (ifo, channel.replace(' ', '_'), cache_num, frequencies[i])) - cache_num = cache_num + 1 + pipeparts.mknxydumpsink(pipeline, magnitude_and_phase, "tests/tests_pytest/act_data/%s_%s_over_Act_%d_at_%0.1fHz.txt" % (ifo, channel.replace(' ', '_'), cache_num, frequencies[i])) + cache_num = cache_num + 1 # # done # - return pipeline + return pipeline # # ============================================================================= @@ -178,8 +227,8 @@ def act2darm(pipeline, name): def Act2darm(): - test_common.build_and_run(act2darm, "act2darm", segment = segments.segment((LIGOTimeGPS(0, 1000000000 * gps_start_time), LIGOTimeGPS(0, 1000000000 * gps_end_time)))) - rms('A') - rms('A', 'E') - plot_act() + test_common.build_and_run(act2darm, "act2darm", segment = segments.segment((LIGOTimeGPS(0, 1000000000 * gps_start_time), LIGOTimeGPS(0, 1000000000 * gps_end_time)))) + plot_act() + rms('A') + rms('A', 'E') diff --git a/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_15.6Hz.txt b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_15.6Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..b517042d1cf4afc7c5934f205e3469e1c3afddcb --- /dev/null +++ b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_15.6Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e394697301673ae5bb333d17add27338ddb32ea0570fe1d8daeb7d4ca321924e +size 3279 diff --git a/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_16.4Hz.txt b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_16.4Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1de6dec9c07890c2e03031fe6119f913ab7b6a --- /dev/null +++ b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_16.4Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87cc789c09534ce236d271272bc56e5921deb2a754719c8ee734f1ad39f1a6db +size 3305 diff --git a/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_17.6Hz.txt b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_17.6Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..07983a7c127e9cf0360eeae4ab3daf51763e7571 --- /dev/null +++ b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_0_at_17.6Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acd5c9a84927ce715809766a67d8dd4cd66d6ba45c64347927b94c35a851562f +size 3302 diff --git a/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_15.6Hz.txt b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_15.6Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..a659ae1563707a040bd36b6573f71bde755901c5 --- /dev/null +++ b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_15.6Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50d9ed0921685abdd1ca989be2cc304b08844f6dc2a65288ed36d655366c6340 +size 3353 diff --git a/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_16.4Hz.txt b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_16.4Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e91d2558c6d93e98602efbfecb95154e23a6c5a --- /dev/null +++ b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_16.4Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a15f9a34038b5084de9477f4f905e1b08469b4ea704013fd6c542a88a554239c +size 3336 diff --git a/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_17.6Hz.txt b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_17.6Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..97e26e926ce825f7bfa52eaed6adeb1820de9c96 --- /dev/null +++ b/tests/tests_pytest/act_data/H1_GDS-CALIB_STRAIN_over_Act_standard_1_at_17.6Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dac43e33f278ccef349deaccd61cd056ddc85003c5238be96933ead5feb7fb88 +size 3349 diff --git a/tests/tests_pytest/error.py b/tests/tests_pytest/error.py index 2b0391e2780c34550ad562c32a08ae5ff10ee72b..458e330d73f3bcf2769ee5877d1c05a24e716f1b 100644 --- a/tests/tests_pytest/error.py +++ b/tests/tests_pytest/error.py @@ -16,11 +16,12 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import numpy as np +import sys #def rms(hoft_f='hoft_asd.txt', clean_f='clean_asd.txt'): def rms(d_type, typ='A'): - pcal_freq_list = [102.1, 1083.3, 1083.7, 17.1, 283.9, 33.4, 410.2, 410.3, 56.4, 77.7] + pcal_freq_list = [102.1, 1083.7, 17.1, 283.9, 33.4, 410.3, 77.7] act_freq_list = [15.6, 16.4, 17.6] st_f_list = [] f_list = [] @@ -58,26 +59,50 @@ def rms(d_type, typ='A'): e_file = open('tests/tests_pytest/error_results.txt', 'a') - for f in st_f_list: - standard = np.loadtxt(f) - for f in f_list: - data = np.loadtxt(f) - standard = np.transpose(standard)[-1] - data = np.transpose(data)[-1] - sum_sq = 0 - for i in range(len(standard-3)): - if standard[i] != 0: - sum_sq += abs(1 - data[i]/standard[i]) - mean_sq = sum_sq/len(data) - rms = np.sqrt(mean_sq) - #try: - #assert rms < 1 - #except AssertionError: - #s1 = 'bad ' + str(name) + ' data' + '\n' - #e_file.write(s1) - #finally: - s2 = str(name) + ' rms = ' + str(rms) + '\n' - e_file.write(s2) - e_file.close() - assert rms < 1 -#error between 1% and 10^-15 + assert len(st_f_list) == len(f_list) + for i in range(len(f_list)): + standard = np.loadtxt(st_f_list[i]) + data = np.loadtxt(f_list[i]) + sum_sq = 0 + std_idx = 0 + # Loop through the data and find values at the same time or frequency as the standard + for j in range(len(data)): + if data[j][0] == standard[std_idx][0]: + # Then check this data point + # If there are 3 columns in the file, then columns 2 and 3 are magnitude and phase + if(len(data[j]) == 3): + data_value = data[j][1] * np.exp(1j * np.pi * data[j][2] / 180) + standard_value = standard[std_idx][1] * np.exp(1j * np.pi * standard[std_idx][2] / 180) + sum_sq += (abs(1 - data_value/standard_value))**2 + std_idx += 1 + if std_idx == 57: + break + else: + data_value = data[j][1] + standard_value = standard[std_idx][1] + sum_sq += (abs(1 - data_value/standard_value))**2 + std_idx += 1 + if std_idx == 8193: + break + + # Make sure the data sets overlapped as expected + assert j > 0.8 * len(data) + if(len(data[0]) == 3): + assert std_idx == 57 + else: + assert std_idx == 8193 + + mean_sq = sum_sq / std_idx + rms = np.sqrt(mean_sq) + e_file = open('tests/tests_pytest/error_results.txt', 'a') + s2 = str(name) + ' rms error = ' + str(rms) + if 'pcal' in name: + s2 += "at %f Hz" % pcal_freq_list[i] + elif 'act' in name: + s2 += "at %f Hz" % act_freq_list[i] + e_file.write(s2 + '\n') + e_file.close() + print(s2, file = sys.stderr) + + assert rms < 0.001 + diff --git a/tests/tests_pytest/filters/gstlal_compute_strain_ApproxLaterStart_H1.ini b/tests/tests_pytest/filters/gstlal_compute_strain_ApproxLaterStart_H1.ini index 1a21d4193a74703b9d35e0a45299c339dd6879f5..c5a093250ad6207f67cd8ebee6707e7f3e151ed3 100644 --- a/tests/tests_pytest/filters/gstlal_compute_strain_ApproxLaterStart_H1.ini +++ b/tests/tests_pytest/filters/gstlal_compute_strain_ApproxLaterStart_H1.ini @@ -82,19 +82,19 @@ MonitorStatevector: No ComputeExactKappas: No ComputeKappaTST: Yes -ApplyKappaTST: No +ApplyKappaTST: Yes # Set this to have the \kappa_tst factors filter the actuation chain with an adaptive filter that corrects for both magnitude and phase errors. -ApplyComplexKappaTST: Yes +ApplyComplexKappaTST: No ComputeKappaPUM: Yes -ApplyKappaPUM: No +ApplyKappaPUM: Yes # Set this to have the \kappa_p factors the actuation chain with an adaptive filter that corrects for both magnitude and phase errors. -ApplyComplexKappaPUM: Yes +ApplyComplexKappaPUM: No ComputeKappaUIM: Yes -ApplyKappaUIM: No +ApplyKappaUIM: Yes # Set this to have the \kappa_u factors the actuation chain with an adaptive filter that corrects for both magnitude and phase errors. -ApplyComplexKappaUIM: Yes +ApplyComplexKappaUIM: No ComputeKappaC: Yes ApplyKappaC: Yes diff --git a/tests/tests_pytest/filters/gstlal_compute_strain_Approx_H1.ini b/tests/tests_pytest/filters/gstlal_compute_strain_Approx_H1.ini index 138e5c298a2ae208083e47a45286afa8f4179d2f..0105ad6876b4859b4c4739fa5636a19af37f961c 100644 --- a/tests/tests_pytest/filters/gstlal_compute_strain_Approx_H1.ini +++ b/tests/tests_pytest/filters/gstlal_compute_strain_Approx_H1.ini @@ -67,8 +67,8 @@ PipelineGraphFilename: None Verbose: Yes # Turn this on to write data presentation timestamps and real-time unix timestamps to file at the beginning and end of the pipeline, to measure latency TestLatency: No -# Turn this on if you want continuous integration to test the latency. -CITestLatency: No +# Set this directory if you want continuous integration to test the latency. Otherwise, set name equal to None +CILatencyDir: None # Turn this on to compute transfer functions for the filters by comparing output data to input data TestFilters: No # Turn this on to monitor the state vector @@ -82,19 +82,19 @@ MonitorStatevector: No ComputeExactKappas: No ComputeKappaTST: Yes -ApplyKappaTST: No +ApplyKappaTST: Yes # Set this to have the \kappa_tst factors filter the actuation chain with an adaptive filter that corrects for both magnitude and phase errors. -ApplyComplexKappaTST: Yes +ApplyComplexKappaTST: No ComputeKappaPUM: Yes -ApplyKappaPUM: No +ApplyKappaPUM: Yes # Set this to have the \kappa_p factors the actuation chain with an adaptive filter that corrects for both magnitude and phase errors. -ApplyComplexKappaPUM: Yes +ApplyComplexKappaPUM: No ComputeKappaUIM: Yes -ApplyKappaUIM: No +ApplyKappaUIM: Yes # Set this to have the \kappa_u factors the actuation chain with an adaptive filter that corrects for both magnitude and phase errors. -ApplyComplexKappaUIM: Yes +ApplyComplexKappaUIM: No ComputeKappaC: Yes ApplyKappaC: Yes diff --git a/tests/tests_pytest/filters/gstlal_compute_strain_Exact_H1.ini b/tests/tests_pytest/filters/gstlal_compute_strain_Exact_H1.ini index c57546a2810e49ad6bfdf6625d827322ec21048a..2376700b49c6493e0a8d2974f8c8d071feccd63f 100644 --- a/tests/tests_pytest/filters/gstlal_compute_strain_Exact_H1.ini +++ b/tests/tests_pytest/filters/gstlal_compute_strain_Exact_H1.ini @@ -67,8 +67,8 @@ PipelineGraphFilename: None Verbose: Yes # Turn this on to write data presentation timestamps and real-time unix timestamps to file at the beginning and end of the pipeline, to measure latency TestLatency: No -# Turn this on if you want continuous integration to test the latency. -CITestLatency: No +# Set this directory if you want continuous integration to test the latency. Otherwise, set name equal to None +CILatencyDir: None # Turn this on to compute transfer functions for the filters by comparing output data to input data TestFilters: No # Turn this on to monitor the state vector diff --git a/tests/tests_pytest/latency.py b/tests/tests_pytest/latency.py index 5106bc073419484c4d18f2a232106fea235b269c..704d3d881d5a7057e222e7550b118d5493ca5e65 100644 --- a/tests/tests_pytest/latency.py +++ b/tests/tests_pytest/latency.py @@ -38,10 +38,16 @@ def Latency(): print("{} of {} frames with latency over 6s".format(sum(i > 6 for i in lat), len(lat)), file = sys.stderr) print("Latency increased by {}s over {}s of data".format(lat_increase, o_gps[-1] - o_gps[0]), file = sys.stderr) + # 4-s latency is typical in this configuration. More than 5 s could + # indicate a problem, while less than 3 s could mean that the CI + # latency-testing pipeline is not running as it should be. assert np.mean(lat) < 5 + assert np.mean(lat) > 3 # There should be no large excursions (This may occasionally fail) assert max(lat) < 10 + assert min(lat) > 0 # There should not be numerous small excursions assert sum(i > 6 for i in lat) < 10 + assert sum(i < 2 for i in lat) < 10 assert lat_increase < 0.5 diff --git a/tests/tests_pytest/pcal2darm_timeseries.py b/tests/tests_pytest/pcal2darm_timeseries.py index 8640d87b4701978bc55b2643bb6203ed49c912c1..eee72cf6e87080c26eacf4c4fa0b71eb4670ab33 100755 --- a/tests/tests_pytest/pcal2darm_timeseries.py +++ b/tests/tests_pytest/pcal2darm_timeseries.py @@ -86,7 +86,7 @@ for name in pcal_line_names.split(','): pcal_corrections.append(float(filters["%s_corr_im" % name])) y_arm_pcal_corr = filters['y_arm_pcal_corr'] -pcalx_freqs = [410.2,1083.3,33.43,56.39,77.73,102.13,283.91] +pcalx_freqs = [33.43,77.73,102.13,283.91] x_arm_pcal_corr = -1 * filters['y_arm_pcal_corr'] for f in pcalx_freqs: pcalx_frequencies.append(float(f)) @@ -101,7 +101,7 @@ for f in pcalx_freqs: all_frequencies = frequencies + pcalx_frequencies -pcal_time_advance = 0.00006103515625 +pcal_time_advance = 0 #.00006103515625 for i in range(len(pcal_corrections) // 2): corr = pcal_corrections[2 * i] + 1j * pcal_corrections[2 * i + 1] corr *= numpy.exp(2.0 * numpy.pi * 1j * frequencies[i] * pcal_time_advance) @@ -207,7 +207,7 @@ def pcal2darm(pipeline, name): def Pcal2darm(): test_common.build_and_run(pcal2darm, "pcal2darm", segment = segments.segment((LIGOTimeGPS(0, 1000000000 * gps_start_time), LIGOTimeGPS(0, 1000000000 * gps_end_time)))) + plot_pcal() rms('P') rms('P', 'E') - plot_pcal() diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_102.1Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_102.1Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd1390983607752578905f2812bdb665ea5c53ff --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_102.1Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af10241579d1c90eb11de2cf2c46958fd705375938e6f334f6767fe77e292c63 +size 3308 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_1083.7Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_1083.7Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..d77b03bb8af7845d733c32184a3390e54d858be4 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_1083.7Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:523a0a94ff3e3540685620913cf7a4ec9f063875463cf6230fa53f379cbabcff +size 3342 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_17.1Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_17.1Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..93bbab6b31e54e99277ad78f4bdbf3daa255eb00 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_17.1Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0ba33b9499cd98473ca895daca77018f0fce0be4007d35791d8f28ef737f472 +size 3309 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_283.9Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_283.9Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee62c09e61cc73f97222eb979aa3d18890ab9f92 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_283.9Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9749a313efc910d93782fa6298c9541ed917f1274d6eff762330409ea555100d +size 3275 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_33.4Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_33.4Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4774ef31cae9be154edc26b316ac4644e326b65 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_33.4Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de664e819c2f95f160fee0050265b1e54f63b4f53222a342be6582a4af18b52c +size 3290 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_410.3Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_410.3Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ad8737aa370bced7e596fef0df26650a0b20e74 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_410.3Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27bfaa104aff521b8e34be44e20d49c71c350490d35da99bcf113a2b3ca0864f +size 3389 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_77.7Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_77.7Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..b938da2e92fbadfad22c3b894196ec86894a2d1a --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_0_at_77.7Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b11c6db1cfbcbdc785225e99b73b4f47cc3e1bd0deef66d6baeb599f176dafb +size 3330 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_102.1Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_102.1Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..55707375044a32291ace3554e892cd54a85f97b0 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_102.1Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:318706904ef0bdba2e89eb031bd2e2922c76ed0c8b0fcc291a7f6fe8f957f241 +size 3333 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_1083.7Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_1083.7Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..37a3febb814b6dc0d9082f28b96186135d5c74ca --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_1083.7Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2100a4b624dc482832ce4071de1a586dd463367b0ed45cbbc644440f8d301552 +size 3316 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_17.1Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_17.1Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ee2b1a096daad1556025c39af6a059074bfd442 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_17.1Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2299a12e2019e5edfe54a066d57b1c4a7dd28b8b3d3948fa3878c7ad83d0939 +size 3364 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_283.9Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_283.9Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..526ac5bc029840a8c08279719d4707c79760cee4 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_283.9Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a523e64e6259163f28e3b117043118f489e78c5940b11e82f868afefc6fcd998 +size 3294 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_33.4Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_33.4Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..82bc9539a605dd15feac1eda50f08c8735018a68 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_33.4Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71b4ea39219b1f24344ab0500c64bfcbf45b015b8002e8a620217d3624dd7514 +size 3240 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_410.3Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_410.3Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..851d1406e78c64f0a7c8f0c83db6822160901667 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_410.3Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf19b51ab8ba2367db07b92d6aa2191e84dd8a2a8414e618c75a5bdc6f4dc987 +size 3383 diff --git a/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_77.7Hz.txt b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_77.7Hz.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e5845655327666aa98b12744176287585bff6e3 --- /dev/null +++ b/tests/tests_pytest/pcal_data/H1_GDS-CALIB_STRAIN_over_Pcal_standard_1_at_77.7Hz.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:016fe59c55b379994d760712a77571ea3bdd447aa0f896b0bc21ae67bfbe0d42 +size 3349 diff --git a/tests/tests_pytest/test_order/test_order.py b/tests/tests_pytest/test_order/test_order.py index 8e6dcb13cc2442d14547ace09c2639045ab3442b..01593b5c8c47d9dadf3ac8cd8fe179db73e4f1d9 100644 --- a/tests/tests_pytest/test_order/test_order.py +++ b/tests/tests_pytest/test_order/test_order.py @@ -3,8 +3,8 @@ import shlex import os #from tests.tests_pytest.State_Vector import State_Vector #from tests.tests_pytest.ASD import ASD -#from tests.tests_pytest.act2darm_timeseries import Act2darm -#from tests.tests_pytest.pcal2darm_timeseries import Pcal2darm +from tests.tests_pytest.act2darm_timeseries import Act2darm +from tests.tests_pytest.pcal2darm_timeseries import Pcal2darm from tests.tests_pytest.run_calib_pipeline import Run_calib from tests.tests_pytest.diff import Diff from tests.tests_pytest.latency import Latency @@ -18,13 +18,13 @@ def test_ASD(): def test_state_vector(): State_Vector() - +''' def test_act2darm(): Act2darm() def test_pcal2darm(): Pcal2darm() -''' + def test_diff(): Diff()