Skip to content
Snippets Groups Projects

Stricter Gating for the TDCFs

Merged Aaron Viets requested to merge aaron-viets/gstlal-calibration:stricter-TDCF-gating into main
2 unresolved threads
Files
7
+ 328
103
@@ -20,24 +20,24 @@
"""
This pipeline produces h(t) given DARM_ERR and DARM_CTRL or given DELTAL_RESIDUAL and DELTAL_CTRL. It can be run online in real-time or offline on frame files. It can write h(t) frames to frame files or to a shared memory partition.
The differential arm length resulting from external sources is
The differential arm length resulting from external sources is
\Delta L_{ext} = ((f^2 + f_s^2 - i * f * f_s / Q) / f^2)
* ((1 + i * f / f_cc) / (\kappa_c C_res)) * d_{err}
+ (A_tst * \kappa_tst + A_pu * \kappa_pu) * d_{ctrl}
\Delta L_{ext} = ((f^2 + f_s^2 - i * f * f_s / Q) / f^2)
* ((1 + i * f / f_cc) / (\kappa_c C_res)) * d_{err}
+ (A_tst * \kappa_tst + A_pu * \kappa_pu) * d_{ctrl}
where C is the static portion of the sensing function, A_tst is the TST actuation function, A_pu is the PUM+UIM actuation, \kappa_c is the time-dependent gain of the sensing function, \kappa_tst is the time-dependent gain of TST actuation, and \kappa_pu is the time-dependent gain of the PUM/UIM actuation. \Delta L_{ext} is divided by the average arm length (4000 m) to obtain h(t), the external strain in the detectors,
where C is the static portion of the sensing function, A_tst is the TST actuation function, A_pu is the PUM+UIM actuation, \kappa_c is the time-dependent gain of the sensing function, \kappa_tst is the time-dependent gain of TST actuation, and \kappa_pu is the time-dependent gain of the PUM/UIM actuation. \Delta L_{ext} is divided by the average arm length (4000 m) to obtain h(t), the external strain in the detectors,
h(t) = \Delta L_{ext} / L .
h(t) = \Delta L_{ext} / L.
The time-dependent gains (\kappa's) as well as the value for the coupled cavity pole f_cc and SRC detuning parameters f_s and Q are calcuated in this pipeline as well.
This pipeline will most often be run in a format where it picks up after part of the actuation and sensing functions have been applied to the appropriate channels. In this mode, the input channels are \Delta L_{res} and \Delta L_{ctrl, i}. This pipeline then applies further high frequency corrections to each of these channels, applies the appropriate time delay to each channel, adds the channels together, and divides by L.
This pipeline will most often be run in a format where it picks up after part of the actuation and sensing functions have been applied to the appropriate channels. In this mode, the input channels are \Delta L_{res} and \Delta L_{ctrl, i}. This pipeline then applies further high frequency corrections to each of these channels, applies the appropriate time delay to each channel, adds the channels together, and divides by L.
h(t) = (((f^2 + f_s^2 - i * f * f_s / Q) / f^2)
* ((1 + i * f / f_cc) / \kappa_c) * corrections * \Delta L_{res}
+ \kappa_tst * \Delta L_{ctrl, TST}
+ \kappa_pu * (\Delta L_{ctrl, P} + \Delta L_{ctrl, U})) / L
h(t) = (((f^2 + f_s^2 - i * f * f_s / Q) / f^2)
* ((1 + i * f / f_cc) / \kappa_c) * corrections * \Delta L_{res}
+ \kappa_tst * \Delta L_{ctrl, TST}
+ \kappa_pu * (\Delta L_{ctrl, P} + \Delta L_{ctrl, U})) / L
Note: The actuation \kappa's are complex numbers. Only the real part of the computed \kappa's are applied as time-dependent gain corrections.
@@ -57,6 +57,7 @@ import numpy
import time
import resource
import hashlib
import copy
from optparse import OptionParser, Option
import configparser
@@ -156,7 +157,7 @@ if options.version and options.config_file is None:
exit()
#############################################################################
######################### Config File Options ##############################
######################### Config File Options ###############################
#############################################################################
def ConfigSectionMap(section):
@@ -263,7 +264,7 @@ epics_sr = int(SampleRates["epicsrefsr"]) # Sample rate for EPICS records used f
line_amplitude_sr = int(SampleRates["lineamplitudesr"]) if "lineamplitudesr" in SampleRates else epics_sr
compute_factors_sr = int(SampleRates["computefactorssr"]) # Sample rate for computing TDCFs
record_factors_sr = int(SampleRates["recordfactorssr"]) # Sample rate for recording TDCFs
metrics_sr = int(SampleRates["metricssr"]) if "metricssr" in SampleRates else 1 # Sample rate for recording metrics from pipeline
metrics_sr = int(SampleRates["metricssr"]) if "metricssr" in SampleRates else 1 # Sample rate for recording metrics from pipeline
nonsens_subtraction_sr = int(SampleRates["nonsenssubtractionsr"]) if "nonsenssubtractionsr" in SampleRates else hoft_sr
hoft_caps = "audio/x-raw, format=F64LE, rate=%d, channel-mask=(bitmask)0x0" % hoft_sr
ctrl_caps = "audio/x-raw, format=F64LE, rate=%d, channel-mask=(bitmask)0x0" % ctrl_sr
@@ -371,6 +372,7 @@ compute_kappac = Config.getboolean("TDCFConfigurations", "computekappac")
compute_fcc = Config.getboolean("TDCFConfigurations", "computefcc")
compute_fs = Config.getboolean("TDCFConfigurations", "computefs")
compute_srcq = Config.getboolean("TDCFConfigurations", "computesrcq")
compute_any_tdcfs = compute_kappatst or compute_kappapum or compute_kappauim or compute_kappac or compute_fcc or compute_fs or compute_srcq
apply_kappatst = Config.getboolean("TDCFConfigurations", "applykappatst")
apply_complex_kappatst = Config.getboolean("TDCFConfigurations", "applycomplexkappatst")
apply_kappapum = Config.getboolean("TDCFConfigurations", "applykappapum")
@@ -383,6 +385,7 @@ apply_srcq = Config.getboolean("TDCFConfigurations", "applysrcq")
apply_fs = Config.getboolean("TDCFConfigurations", "applyfs")
minimize_adaptive_sensfilt = Config.getboolean("TDCFConfigurations", "minimizeadaptivesensingfilter") if "minimizeadaptivesensingfilter" in TDCFConfigs else False
use_coherence = Config.getboolean("TDCFConfigurations", "usecoherence")
tdcf_gate_with_excitation = Config.getboolean("TDCFConfigurations", "tdcfgatewithexcitation") if "tdcfgatewithexcitation" in TDCFConfigs else False
tdcf_default_to_median = Config.getboolean("TDCFConfigurations", "tdcfdefaulttomedian")
compute_exact_kappas = Config.getboolean("TDCFConfigurations", "computeexactkappas") if "computeexactkappas" in TDCFConfigs else False
TDCFs_use_C2_sensing_model = Config.getboolean("TDCFConfigurations", "tdcfsusec2sensingmodel") if "tdcfsusec2sensingmodel" in TDCFConfigs else False
@@ -528,15 +531,6 @@ try:
except:
if compute_kappauim or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
raise ValueError("Cannot compute kappa_UIM using the UIM actuation line, as the specified filters file does not contain that calibration line frequency")
try:
src_pcal_line_freq = float(filters["src_pcal_line_freq"])
pcal_corr_at_src_freq_real = float(filters["src_pcal_corr_re"])
pcal_corr_at_src_freq_imag = float(filters["src_pcal_corr_im"])
except:
if compute_srcq or compute_fs:
raise ValueError("Cannot compute SRC spring frequency or Q, as the calibration line frequency is not contained in the specified filters file.")
try:
high_pcal_line_freq = float(filters["high_pcal_line_freq"])
pcal_corr_at_high_line_freq_real = float(filters["high_pcal_corr_re"])
@@ -789,31 +783,47 @@ if not factors_from_filters_file:
# If we are using pre-computed coherence to gate kappas
if use_coherence:
if compute_kappatst or compute_kappapum or compute_kappauim or compute_kappac or compute_fcc or compute_fs or compute_srcq:
if compute_any_tdcfs:
channel_list.append((instrument, ChannelNames["cohuncpcalyline1channel"]))
headkeys.append("pcaly_line1_coh")
replace_value_list.append(1)
if compute_kappatst or compute_kappac or compute_fcc or compute_fs or compute_srcq:
if ChannelNames["pcalline1amplitudechannel"] != "None" if "pcalline1amplitudechannel" in ChannelNames else False:
channel_list.append((instrument, ChannelNames["pcalline1amplitudechannel"]))
headkeys.append("pcal_line1_amp")
replace_value_list.append("keep_last_good_value")
if compute_kappatst or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
channel_list.append((instrument, ChannelNames["cohuncsusline3channel"]))
headkeys.append("sus_line3_coh")
replace_value_list.append(1)
if compute_kappapum or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
if ChannelNames["susline3amplitudechannel"] != "None" if "susline3amplitudechannel" in ChannelNames else False:
channel_list.append((instrument, ChannelNames["susline3amplitudechannel"]))
headkeys.append("sus_line3_amp")
replace_value_list.append("keep_last_good_value")
if compute_kappapum or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
channel_list.append((instrument, ChannelNames["cohuncsusline2channel"]))
headkeys.append("sus_line2_coh")
replace_value_list.append(1)
if compute_kappauim or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
if ChannelNames["susline2amplitudechannel"] != "None" if "susline2amplitudechannel" in ChannelNames else False:
channel_list.append((instrument, ChannelNames["susline2amplitudechannel"]))
headkeys.append("sus_line2_amp")
replace_value_list.append("keep_last_good_value")
if compute_kappauim or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
channel_list.append((instrument, ChannelNames["cohuncsusline1channel"]))
headkeys.append("sus_line1_coh")
replace_value_list.append(1)
if compute_kappac or compute_fcc or compute_fs or compute_srcq:
if ChannelNames["susline1amplitudechannel"] != "None" if "susline1amplitudechannel" in ChannelNames else False:
channel_list.append((instrument, ChannelNames["susline1amplitudechannel"]))
headkeys.append("sus_line1_amp")
replace_value_list.append("keep_last_good_value")
if compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
channel_list.append((instrument, ChannelNames["cohuncpcalyline2channel"]))
headkeys.append("pcaly_line2_coh")
replace_value_list.append(1)
if compute_fs or compute_srcq:
if src_pcal_line_freq != act_pcal_line_freq:
channel_list.append((instrument, ChannelNames["cohuncpcalyline4channel"]))
headkeys.append("pcaly_line4_coh")
replace_value_list.append(1)
if ChannelNames["pcalline2amplitudechannel"] != "None" if "pcalline2amplitudechannel" in ChannelNames else False:
channel_list.append((instrument, ChannelNames["pcalline2amplitudechannel"]))
headkeys.append("pcal_line2_amp")
replace_value_list.append("keep_last_good_value")
# We also need excitation channels for computing kappas
if compute_kappatst or compute_kappac or compute_fcc or compute_fs or compute_srcq:
@@ -993,6 +1003,7 @@ if (ChannelNames["linewitnesschannellist"] != "None") if "linewitnesschannellist
else:
line_witness_frequency_channel_list = []
line_amplitude_list = []
line_amplitude_names = copy.deepcopy(line_amplitude_list)
# If we are using witness channels to clean h(t), add those to the channel list
witness_channel_list = []
@@ -1153,6 +1164,7 @@ for key in headkeys:
line_witness_frequency_channel_list[i][j] = head_dict[key]
elif key in [item for sublist in line_amplitude_list for item in sublist]:
head_dict[key] = calibration_parts.caps_and_progress(pipeline, head_dict[key], line_amplitude_caps, key)
head_dict[key] = pipeparts.mktee(pipeline, head_dict[key])
for i in range(len(line_amplitude_list)):
if key in line_amplitude_list[i]:
j = line_amplitude_list[i].index(key)
@@ -1167,36 +1179,70 @@ for key in headkeys:
epics_dict[key] = calibration_parts.mkresample(pipeline, epics_dict[key], 0, False, compute_calib_factors_caps)
epics_dict[key] = (pipeparts.mktee(pipeline, epics_dict[key]), float(filters[key]) if key in filters else numpy.inf)
tdcfs_use_amp = False
if use_coherence:
if compute_kappatst or compute_kappapum or compute_kappauim or compute_kappac or compute_fcc or compute_fs or compute_srcq:
if compute_any_tdcfs:
pcaly_line1_coh = calibration_parts.caps_and_progress(pipeline, head_dict["pcaly_line1_coh"], coh_caps, "pcaly_line1_coh")
pcaly_line1_coh = calibration_parts.mkresample(pipeline, pcaly_line1_coh, 0, False, compute_calib_factors_caps)
pcaly_line1_coh = pipeparts.mktee(pipeline, pcaly_line1_coh)
if compute_kappatst or compute_kappac or compute_fcc or compute_fs or compute_srcq:
if "pcal_line1_amp" in headkeys:
tdcfs_use_amp = True
# We may have already done this for the line subtraction.
if "pcal_line1_amp" in [item for sublist in line_amplitude_names for item in sublist]:
pcal_line1_amp = head_dict["pcal_line1_amp"]
else:
pcal_line1_amp = calibration_parts.caps_and_progress(pipeline, head_dict["pcal_line1_amp"], line_amplitude_caps, "pcal_line1_amp")
pcal_line1_amp = pipeparts.mktee(pipeline, pcal_line1_amp)
if compute_kappatst or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
sus_line3_coh = calibration_parts.caps_and_progress(pipeline, head_dict["sus_line3_coh"], coh_caps, "sus_line3_coh")
sus_line3_coh = calibration_parts.mkresample(pipeline, sus_line3_coh, 0, False, compute_calib_factors_caps)
sus_line3_coh = pipeparts.mktee(pipeline, sus_line3_coh)
if compute_kappapum or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
if "sus_line3_amp" in headkeys:
tdcfs_use_amp = True
# We may have already done this for the line subtraction.
if "sus_line3_amp" in [item for sublist in line_amplitude_names for item in sublist]:
sus_line3_amp = head_dict["sus_line3_amp"]
else:
sus_line3_amp = calibration_parts.caps_and_progress(pipeline, head_dict["sus_line3_amp"], line_amplitude_caps, "sus_line3_amp")
sus_line3_amp = pipeparts.mktee(pipeline, sus_line3_amp)
if compute_kappapum or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
sus_line2_coh = calibration_parts.caps_and_progress(pipeline, head_dict["sus_line2_coh"], coh_caps, "sus_line2_coh")
sus_line2_coh = calibration_parts.mkresample(pipeline, sus_line2_coh, 0, False, compute_calib_factors_caps)
sus_line2_coh = pipeparts.mktee(pipeline, sus_line2_coh)
if compute_kappauim or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
if "sus_line2_amp" in headkeys:
tdcfs_use_amp = True
# We may have already done this for the line subtraction.
if "sus_line2_amp" in [item for sublist in line_amplitude_names for item in sublist]:
sus_line2_amp = head_dict["sus_line2_amp"]
else:
sus_line2_amp = calibration_parts.caps_and_progress(pipeline, head_dict["sus_line2_amp"], line_amplitude_caps, "sus_line2_amp")
sus_line2_amp = pipeparts.mktee(pipeline, sus_line2_amp)
if compute_kappauim or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
sus_line1_coh = calibration_parts.caps_and_progress(pipeline, head_dict["sus_line1_coh"], coh_caps, "sus_line1_coh")
sus_line1_coh = calibration_parts.mkresample(pipeline, sus_line1_coh, 0, False, compute_calib_factors_caps)
sus_line1_coh = pipeparts.mktee(pipeline, sus_line1_coh)
if compute_kappac or compute_fcc or compute_fs or compute_srcq:
if "sus_line1_amp" in headkeys:
tdcfs_use_amp = True
# We may have already done this for the line subtraction.
if "sus_line1_amp" in [item for sublist in line_amplitude_names for item in sublist]:
sus_line1_amp = head_dict["sus_line1_amp"]
else:
sus_line1_amp = calibration_parts.caps_and_progress(pipeline, head_dict["sus_line1_amp"], line_amplitude_caps, "sus_line1_amp")
sus_line1_amp = pipeparts.mktee(pipeline, sus_line1_amp)
if compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
pcaly_line2_coh = calibration_parts.caps_and_progress(pipeline, head_dict["pcaly_line2_coh"], coh_caps, "pcaly_line2_coh")
pcaly_line2_coh = calibration_parts.mkresample(pipeline, pcaly_line2_coh, 0, False, compute_calib_factors_caps)
pcaly_line2_coh = pipeparts.mktee(pipeline, pcaly_line2_coh)
if compute_fs or compute_srcq:
if src_pcal_line_freq != act_pcal_line_freq:
pcaly_line4_coh = calibration_parts.caps_and_progress(pipeline, head_dict["pcaly_line4_coh"], coh_caps, "pcaly_line4_coh")
pcaly_line4_coh = calibration_parts.mkresample(pipeline, pcaly_line4_coh, 0, False, compute_calib_factors_caps)
pcaly_line4_coh = pipeparts.mktee(pipeline, pcaly_line4_coh)
else:
pcaly_line4_coh = pcaly_line1_coh
if "pcal_line2_amp" in headkeys:
tdcfs_use_amp = True
# We may have already done this for the line subtraction.
if "pcal_line2_amp" in [item for sublist in line_amplitude_names for item in sublist]:
pcal_line2_amp = head_dict["pcal_line2_amp"]
else:
pcal_line2_amp = calibration_parts.caps_and_progress(pipeline, head_dict["pcal_line2_amp"], line_amplitude_caps, "pcal_line2_amp")
pcal_line2_amp = pipeparts.mktee(pipeline, pcal_line2_amp)
if compute_kappatst or compute_exact_kappas or compute_kappac or compute_fcc or compute_fs or compute_srcq:
if compute_kappatst or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
tstexccaps = "audio/x-raw, format=F64LE, rate=%d" % tst_exc_sr
tstexc = calibration_parts.caps_and_progress(pipeline, head_dict["tstexc"], tstexccaps, "tstexc")
tstexc = pipeparts.mktee(pipeline, tstexc)
@@ -1205,7 +1251,7 @@ if compute_kappatst or compute_exact_kappas or compute_kappac or compute_fcc or
for j in range(len(line_witness_channel_list[i])):
if line_witness_channel_list[i][j] == ChannelNames["tstexcchannel"]:
line_witness_channel_list[i][j] = tstexc
if compute_kappapum or compute_exact_kappas or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
if compute_kappapum or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
pumexccaps = "audio/x-raw, format=F64LE, rate=%d" % pum_exc_sr
pumexc = calibration_parts.caps_and_progress(pipeline, head_dict["pumexc"], pumexccaps, "pumexc")
pumexc = pipeparts.mktee(pipeline, pumexc)
@@ -1214,7 +1260,7 @@ if compute_kappapum or compute_exact_kappas or (compute_kappac or compute_fcc or
for j in range(len(line_witness_channel_list[i])):
if line_witness_channel_list[i][j] == ChannelNames["pumexcchannel"]:
line_witness_channel_list[i][j] = pumexc
if compute_kappauim or compute_exact_kappas or (compute_kappac or compute_fcc or compute_fs or compute_srcq):
if compute_kappauim or compute_kappac or compute_fcc or compute_fs or compute_srcq or (compute_any_tdcfs and compute_exact_kappas):
uimexccaps = "audio/x-raw, format=F64LE, rate=%d" % uim_exc_sr
uimexc = calibration_parts.caps_and_progress(pipeline, head_dict["uimexc"], uimexccaps, "uimexc")
uimexc = pipeparts.mktee(pipeline, uimexc)
@@ -1237,6 +1283,44 @@ if compute_exact_kappas and (compute_kappatst or compute_kappapum or compute_kap
max_coh = calibration_parts.mkinterleave(pipeline, [pcaly_line1_coh, pcaly_line2_coh, sus_line1_coh, sus_line2_coh, sus_line3_coh])
max_coh = pipeparts.mkgeneric(pipeline, max_coh, "lal_minmax", mode = 2)
max_coh = pipeparts.mktee(pipeline, max_coh)
# Gate with line amplitude channels if given
if tdcfs_use_amp:
amp_list = []
if "pcal_line1_amp" in headkeys:
amp_list.append(pcal_line1_amp)
if "pcal_line2_amp" in headkeys:
amp_list.append(pcal_line2_amp)
if "sus_line1_amp" in headkeys:
amp_list.append(sus_line1_amp)
if "sus_line2_amp" in headkeys:
amp_list.append(sus_line2_amp)
if "sus_line3_amp" in headkeys:
amp_list.append(sus_line3_amp)
if len(amp_list) > 1:
tdcfs_line_amp = pipeparts.mktee(pipeline, calibration_parts.mkmultiplier(pipeline, amp_list))
elif len(amp_list) == 1:
tdcfs_line_amp = amp_list[0]
else:
raise ValueError("Code should not be reached.")
if tdcf_gate_with_excitation:
# Make sure d_err and all needed excitation channels are available, and gate if one or more are not
derr_exists = calibration_parts.mkresample(pipeline, derrtee, 3, False, calibstate_sr)
derr_exists = pipeparts.mkbitvectorgen(pipeline, derr_exists, threshold = 1.0001 * input_min, bit_vector = 1)
derr_exists = pipeparts.mkcapsfilter(pipeline, derr_exists, calibstate_caps)
pcal_exists = calibration_parts.mkresample(pipeline, pcaltee, 3, False, calibstate_sr)
pcal_exists = pipeparts.mkbitvectorgen(pipeline, pcal_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pcal_exists = pipeparts.mkcapsfilter(pipeline, pcal_exists, calibstate_caps)
tstexc_exists = calibration_parts.mkresample(pipeline, tstexc, 3, False, calibstate_sr)
tstexc_exists = pipeparts.mkbitvectorgen(pipeline, tstexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
tstexc_exists = pipeparts.mkcapsfilter(pipeline, tstexc_exists, calibstate_caps)
pumexc_exists = calibration_parts.mkresample(pipeline, pumexc, 3, False, calibstate_sr)
pumexc_exists = pipeparts.mkbitvectorgen(pipeline, pumexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pumexc_exists = pipeparts.mkcapsfilter(pipeline, pumexc_exists, calibstate_caps)
uimexc_exists = calibration_parts.mkresample(pipeline, uimexc, 3, False, calibstate_sr)
uimexc_exists = pipeparts.mkbitvectorgen(pipeline, uimexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
uimexc_exists = pipeparts.mkcapsfilter(pipeline, uimexc_exists, calibstate_caps)
tdcf_excitations_exist = pipeparts.mktee(pipeline, calibration_parts.mkmultiplier(pipeline, [derr_exists, pcal_exists, tstexc_exists, pumexc_exists, uimexc_exists]))
# First, the actuation Pcal line, starting with DARM_ERR.
derr_at_act_pcal_freq = calibration_parts.demodulate(pipeline, derrtee, act_pcal_line_freq, td, compute_factors_sr, demodulation_filter_time, filter_latency_factor, freq_update = head_dict["pcal1_linefreq"] if "pcal1_linefreq" in head_dict else None)
@@ -1250,6 +1334,10 @@ if compute_exact_kappas and (compute_kappatst or compute_kappapum or compute_kap
# Now the gating and smoothing
if use_coherence:
X1 = calibration_parts.mkgate(pipeline, X1, max_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'pcal_line1_gate', queue_length = queue_length)
if tdcfs_use_amp:
X1 = calibration_parts.mkgate(pipeline, X1, tdcfs_line_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'pcal_line1_amp_gate', queue_length = queue_length)
if tdcf_gate_with_excitation:
X1 = calibration_parts.mkgate(pipeline, X1, tdcf_excitations_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'pcal_line1_excitation_exists_gate', queue_length = queue_length)
X1 = calibration_parts.smooth_complex_kappas(pipeline, X1, R_f1_re, R_f1_im, median_smoothing_samples, factors_average_samples, tdcf_default_to_median, filter_latency_factor)
else:
var = 0.2 * abs(R_f1_re + 1j * R_f1_im)
@@ -1267,6 +1355,10 @@ if compute_exact_kappas and (compute_kappatst or compute_kappapum or compute_kap
# Now the gating and smoothing
if use_coherence:
X2 = calibration_parts.mkgate(pipeline, X2, max_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'pcal_line2_gate', queue_length = queue_length)
if tdcfs_use_amp:
X2 = calibration_parts.mkgate(pipeline, X2, tdcfs_line_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'pcal_line2_amp_gate', queue_length = queue_length)
if tdcf_gate_with_excitation:
X2 = calibration_parts.mkgate(pipeline, X2, tdcf_excitations_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'pcal_line2_excitation_exists_gate', queue_length = queue_length)
X2 = calibration_parts.smooth_complex_kappas(pipeline, X2, R_f2_re, R_f2_im, median_smoothing_samples, factors_average_samples, tdcf_default_to_median, filter_latency_factor)
else:
var = 0.2 * abs(R_f2_re + 1j * R_f2_im)
@@ -1286,6 +1378,10 @@ if compute_exact_kappas and (compute_kappatst or compute_kappapum or compute_kap
# Now the gating and smoothing
if use_coherence:
X_T = calibration_parts.mkgate(pipeline, X_T, max_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'sus_line3_gate', queue_length = queue_length)
if tdcfs_use_amp:
X_T = calibration_parts.mkgate(pipeline, X_T, tdcfs_line_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'sus_line3_amp_gate', queue_length = queue_length)
if tdcf_gate_with_excitation:
X_T = calibration_parts.mkgate(pipeline, X_T, tdcf_excitations_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'sus_line3_excitation_exists_gate', queue_length = queue_length)
X_T = calibration_parts.smooth_complex_kappas(pipeline, X_T, RAT0inv_fT_re, RAT0inv_fT_im, median_smoothing_samples, factors_average_samples, tdcf_default_to_median, filter_latency_factor)
else:
var = 0.2 * abs(RAT0inv_fT_re + 1j * RAT0inv_fT_im)
@@ -1303,6 +1399,10 @@ if compute_exact_kappas and (compute_kappatst or compute_kappapum or compute_kap
# Now the gating and smoothing
if use_coherence:
X_P = calibration_parts.mkgate(pipeline, X_P, max_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'sus_line2_gate', queue_length = queue_length)
if tdcfs_use_amp:
X_P = calibration_parts.mkgate(pipeline, X_P, tdcfs_line_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'sus_line2_amp_gate', queue_length = queue_length)
if tdcf_gate_with_excitation:
X_P = calibration_parts.mkgate(pipeline, X_P, tdcf_excitations_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'sus_line2_excitation_exists_gate', queue_length = queue_length)
X_P = calibration_parts.smooth_complex_kappas(pipeline, X_P, RAP0inv_fP_re, RAP0inv_fP_im, median_smoothing_samples, factors_average_samples, tdcf_default_to_median, filter_latency_factor)
else:
var = 0.2 * abs(RAP0inv_fP_re + 1j * RAP0inv_fP_im)
@@ -1320,6 +1420,10 @@ if compute_exact_kappas and (compute_kappatst or compute_kappapum or compute_kap
# Now the gating and smoothing
if use_coherence:
X_U = calibration_parts.mkgate(pipeline, X_U, max_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'sus_line1_gate', queue_length = queue_length)
if tdcfs_use_amp:
X_U = calibration_parts.mkgate(pipeline, X_U, tdcfs_line_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'sus_line1_amp_gate', queue_length = queue_length)
if tdcf_gate_with_excitation:
X_U = calibration_parts.mkgate(pipeline, X_U, tdcf_excitations_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'sus_line1_excitation_exists_gate', queue_length = queue_length)
X_U = calibration_parts.smooth_complex_kappas(pipeline, X_U, RAU0inv_fU_re, RAU0inv_fU_im, median_smoothing_samples, factors_average_samples, tdcf_default_to_median, filter_latency_factor)
else:
var = 0.2 * abs(RAU0inv_fU_re + 1j * RAU0inv_fU_im)
@@ -1451,6 +1555,17 @@ elif compute_kappatst or compute_kappapum or compute_kappauim or compute_kappac
derr_at_act_pcal_freq = calibration_parts.demodulate(pipeline, derrtee, act_pcal_line_freq, td, compute_factors_sr, demodulation_filter_time, filter_latency_factor, freq_update = head_dict["pcal1_linefreq"] if "pcal1_linefreq" in head_dict else None)
derr_at_act_pcal_freq = pipeparts.mktee(pipeline, derr_at_act_pcal_freq)
if tdcf_gate_with_excitation:
derr_exists = calibration_parts.mkresample(pipeline, derrtee, 3, False, calibstate_sr)
derr_exists = pipeparts.mkbitvectorgen(pipeline, derr_exists, threshold = 1.0001 * input_min, bit_vector = 1)
derr_exists = pipeparts.mkcapsfilter(pipeline, derr_exists, calibstate_caps)
pcal_exists = calibration_parts.mkresample(pipeline, pcaltee, 3, False, calibstate_sr)
pcal_exists = pipeparts.mkbitvectorgen(pipeline, pcal_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pcal_exists = pipeparts.mkcapsfilter(pipeline, pcal_exists, calibstate_caps)
derr_and_pcal_exist = pipeparts.mktee(pipeline, calibration_parts.mkmultiplier(pipeline, [derr_exists, pcal_exists]))
# Keep track of which of these has been computed
excitations_exist = [derr_and_pcal_exist, None, None, None, None]
# Check whether we need to compute kappa_tst
if not compute_exact_kappas and (compute_kappatst or compute_kappac or compute_fcc or compute_srcq or compute_fs):
# demodulate the TST excitation channel at the ESD actuation line frequency
@@ -1476,6 +1591,19 @@ if not compute_exact_kappas and (compute_kappatst or compute_kappac or compute_f
ktst_gated = calibration_parts.mkgate(pipeline, ktst, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'ktstgate1', queue_length = queue_length)
# Gate kappa_tst with the coherence of the TST (L3) suspension line
ktst_gated = calibration_parts.mkgate(pipeline, ktst_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'ktstgate2', queue_length = queue_length)
# Gate kappa_tst with the amplitude channels of the lines used.
if "pcal_line1_amp" in headkeys:
ktst_gated = calibration_parts.mkgate(pipeline, ktst_gated, pcal_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'ktstgate3', queue_length = queue_length)
if "sus_line3_amp" in headkeys:
ktst_gated = calibration_parts.mkgate(pipeline, ktst_gated, sus_line3_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'ktstgate4', queue_length = queue_length)
# Use gating to require that the needed input channels are available and nonzero.
if tdcf_gate_with_excitation:
tstexc_exists = calibration_parts.mkresample(pipeline, tstexc, 3, False, calibstate_sr)
tstexc_exists = pipeparts.mkbitvectorgen(pipeline, tstexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
tstexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, tstexc_exists, calibstate_caps))
excitations_exist[3] = tstexc_exists
ktst_gated = calibration_parts.mkgate(pipeline, ktst_gated, derr_and_pcal_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'ktstgate5', queue_length = queue_length)
ktst_gated = calibration_parts.mkgate(pipeline, ktst_gated, tstexc_exists, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'ktstgate6', queue_length = queue_length)
ktst_gated = pipeparts.mktee(pipeline, ktst_gated)
# Smooth kappa_tst
@@ -1527,6 +1655,19 @@ if not compute_exact_kappas and (compute_kappapum or (compute_kappac or compute_
kpum_gated = calibration_parts.mkgate(pipeline, kpum, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kpumgate1', queue_length = queue_length)
# Gate kappa_pum with the coherence of the PUM (L2) suspension line
kpum_gated = calibration_parts.mkgate(pipeline, kpum_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kpumgate2', queue_length = queue_length)
# Gate kappa_pum with the amplitude channels of the lines used.
if "pcal_line1_amp" in headkeys:
kpum_gated = calibration_parts.mkgate(pipeline, kpum_gated, pcal_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kpumgate3', queue_length = queue_length)
if "sus_line2_amp" in headkeys:
kpum_gated = calibration_parts.mkgate(pipeline, kpum_gated, sus_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kpumgate4', queue_length = queue_length)
# Use gating to require that the needed input channels are available and nonzero.
if tdcf_gate_with_excitation:
pumexc_exists = calibration_parts.mkresample(pipeline, pumexc, 3, False, calibstate_sr)
pumexc_exists = pipeparts.mkbitvectorgen(pipeline, pumexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pumexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, pumexc_exists, calibstate_caps))
excitations_exist[2] = pumexc_exists
kpum_gated = calibration_parts.mkgate(pipeline, kpum_gated, derr_and_pcal_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kpumgate5', queue_length = queue_length)
kpum_gated = calibration_parts.mkgate(pipeline, kpum_gated, pumexc_exists, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kpumgate6', queue_length = queue_length)
kpum_gated = pipeparts.mktee(pipeline, kpum_gated)
# Smooth kappa_pum
@@ -1576,6 +1717,19 @@ if not compute_exact_kappas and (compute_kappauim or (compute_kappac or compute_
kuim_gated = calibration_parts.mkgate(pipeline, kuim, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kuimgate1', queue_length = queue_length)
# Gate kappa_uim with the coherence of the UIM (L1) suspension line
kuim_gated = calibration_parts.mkgate(pipeline, kuim_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kuimgate2', queue_length = queue_length)
# Gate kappa_uim with the amplitude channels of the lines used.
if "pcal_line1_amp" in headkeys:
kuim_gated = calibration_parts.mkgate(pipeline, kuim_gated, pcal_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kuimgate3', queue_length = queue_length)
if "sus_line1_amp" in headkeys:
kuim_gated = calibration_parts.mkgate(pipeline, kuim_gated, sus_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kuimgate4', queue_length = queue_length)
# Use gating to require that the needed input channels are available and nonzero.
if tdcf_gate_with_excitation:
uimexc_exists = calibration_parts.mkresample(pipeline, uimexc, 3, False, calibstate_sr)
uimexc_exists = pipeparts.mkbitvectorgen(pipeline, uimexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
uimexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, uimexc_exists, calibstate_caps))
excitations_exist[1] = uimexc_exists
kuim_gated = calibration_parts.mkgate(pipeline, kuim_gated, derr_and_pcal_exist, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kuimgate5', queue_length = queue_length)
kuim_gated = calibration_parts.mkgate(pipeline, kuim_gated, uimexc_exists, 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kuimgate6', queue_length = queue_length)
kuim_gated = pipeparts.mktee(pipeline, kuim_gated)
# Smooth kappa_uim
@@ -1640,9 +1794,39 @@ if not compute_exact_kappas and (compute_kappac or compute_fcc or compute_fs or
# Gate kappa_c with the coherence of all of the calibration lines used to compute it
kc_gated = calibration_parts.mkgate(pipeline, kc, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate1', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, pcaly_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate2', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate4', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate5', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate6', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate3', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate4', queue_length = queue_length)
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'kcgate5', queue_length = queue_length)
# Gate kappa_c with the amplitude channels of the lines used.
if "pcal_line1_amp" in headkeys:
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, pcal_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kcgate6', queue_length = queue_length)
if "pcal_line2_amp" in headkeys:
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, pcal_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kcgate7', queue_length = queue_length)
if "sus_line1_amp" in headkeys:
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kcgate8', queue_length = queue_length)
if "sus_line2_amp" in headkeys:
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kcgate9', queue_length = queue_length)
if "sus_line3_amp" in headkeys:
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, sus_line3_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kcgate10', queue_length = queue_length)
# Use gating to require that the needed input channels are available and nonzero.
if tdcf_gate_with_excitation:
if excitations_exist[1] == None:
uimexc_exists = calibration_parts.mkresample(pipeline, uimexc, 3, False, calibstate_sr)
uimexc_exists = pipeparts.mkbitvectorgen(pipeline, uimexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
uimexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, uimexc_exists, calibstate_caps))
excitations_exist[1] = uimexc_exists
if excitations_exist[2] == None:
pumexc_exists = calibration_parts.mkresample(pipeline, pumexc, 3, False, calibstate_sr)
pumexc_exists = pipeparts.mkbitvectorgen(pipeline, pumexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pumexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, pumexc_exists, calibstate_caps))
excitations_exist[2] = pumexc_exists
if excitations_exist[3] == None:
tstexc_exists = calibration_parts.mkresample(pipeline, tstexc, 3, False, calibstate_sr)
tstexc_exists = pipeparts.mkbitvectorgen(pipeline, tstexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
tstexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, tstexc_exists, calibstate_caps))
excitations_exist[3] = tstexc_exists
excitations_exist[4] = pipeparts.mktee(pipeline, calibration_parts.mkmultiplier(pipeline, excitations_exist[:4]))
kc_gated = calibration_parts.mkgate(pipeline, kc_gated, excitations_exist[4], 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'kcgate11', queue_length = queue_length)
kc_gated = pipeparts.mktee(pipeline, kc_gated)
# Smooth kappa_c
@@ -1667,9 +1851,40 @@ if not compute_exact_kappas and (compute_kappac or compute_fcc or compute_fs or
# Gate f_cc with all four of the calibration lines
fcc_gated = calibration_parts.mkgate(pipeline, fcc, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate1', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, pcaly_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate2', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate4', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate5', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate6', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate3', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate4', queue_length = queue_length)
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'fccgate5', queue_length = queue_length)
# Gate f_cc with the amplitude channels of the lines used.
if "pcal_line1_amp" in headkeys:
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, pcal_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'fccgate6', queue_length = queue_length)
if "pcal_line2_amp" in headkeys:
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, pcal_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'fccgate7', queue_length = queue_length)
if "sus_line1_amp" in headkeys:
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'fccgate8', queue_length = queue_length)
if "sus_line2_amp" in headkeys:
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'fccgate9', queue_length = queue_length)
if "sus_line3_amp" in headkeys:
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, sus_line3_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'fccgate10', queue_length = queue_length)
# Use gating to require that the needed input channels are available and nonzero.
if tdcf_gate_with_excitation:
if excitations_exist[4] == None:
if excitations_exist[1] == None:
uimexc_exists = calibration_parts.mkresample(pipeline, uimexc, 3, False, calibstate_sr)
uimexc_exists = pipeparts.mkbitvectorgen(pipeline, uimexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
uimexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, uimexc_exists, calibstate_caps))
excitations_exist[1] = uimexc_exists
if excitations_exist[2] == None:
pumexc_exists = calibration_parts.mkresample(pipeline, pumexc, 3, False, calibstate_sr)
pumexc_exists = pipeparts.mkbitvectorgen(pipeline, pumexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pumexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, pumexc_exists, calibstate_caps))
excitations_exist[2] = pumexc_exists
if excitations_exist[3] == None:
tstexc_exists = calibration_parts.mkresample(pipeline, tstexc, 3, False, calibstate_sr)
tstexc_exists = pipeparts.mkbitvectorgen(pipeline, tstexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
tstexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, tstexc_exists, calibstate_caps))
excitations_exist[3] = tstexc_exists
excitations_exist[4] = pipeparts.mktee(pipeline, calibration_parts.mkmultiplier(pipeline, excitations_exist[:4]))
fcc_gated = calibration_parts.mkgate(pipeline, fcc_gated, excitations_exist[4], 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'fccgate11', queue_length = queue_length)
fcc_gated = pipeparts.mktee(pipeline, fcc_gated)
# Smooth f_cc
@@ -1686,21 +1901,8 @@ if not compute_exact_kappas and (compute_kappac or compute_fcc or compute_fs or
# compute f_s and Q
if not compute_exact_kappas and (compute_fs or compute_srcq):
expected_Xi = complex((fs_squared_default - 1j * src_pcal_line_freq * fs_default / srcQ_default) / (src_pcal_line_freq * src_pcal_line_freq))
Xi_var = fs_squared_var / pow(src_pcal_line_freq, 2)
# demodulate PCAL channel and apply the PCAL correction factor at SRC detuning line frequency
if src_pcal_line_freq == act_pcal_line_freq:
pcal_at_src_freq = pcal_at_act_pcal_freq
else:
pcal_at_src_freq = calibration_parts.demodulate(pipeline, pcaltee, src_pcal_line_freq, td, compute_factors_sr, demodulation_filter_time, filter_latency_factor, prefactor_real = pcal_sign * pcal_corr_at_src_freq_real, prefactor_imag = pcal_sign * pcal_corr_at_src_freq_imag, freq_update = [head_dict["pcal4_linefreq"], head_dict["pcal4_line_corr_real"], head_dict["pcal4_line_corr_imag"]] if "pcal4_linefreq" in head_dict else None)
pcal_at_src_freq = pipeparts.mktee(pipeline, pcal_at_src_freq)
# demodulate DARM_ERR at SRC detuning line frequency
if src_pcal_line_freq == act_pcal_line_freq:
derr_at_src_freq = derr_at_act_pcal_freq
else:
derr_at_src_freq = calibration_parts.demodulate(pipeline, derrtee, src_pcal_line_freq, td, compute_factors_sr, demodulation_filter_time, filter_latency_factor, freq_update = head_dict["pcal4_linefreq"] if "pcal4_linefreq" in head_dict else None)
expected_Xi = complex((fs_squared_default - 1j * act_pcal_line_freq * fs_default / srcQ_default) / (act_pcal_line_freq * act_pcal_line_freq))
Xi_var = fs_squared_var / pow(act_pcal_line_freq, 2)
# Compute the factor Xi which will be used for the f_s and src_Q calculations
if not factors_from_filters_file:
@@ -1709,20 +1911,50 @@ if not compute_exact_kappas and (compute_fs or compute_srcq):
AT_f1 = calibration_parts.merge_into_complex(pipeline, epics_dict["AT_f1_re"][0], epics_dict["AT_f1_im"][0])
AP_f1 = calibration_parts.merge_into_complex(pipeline, epics_dict["AP_f1_re"][0], epics_dict["AP_f1_im"][0])
AU_f1 = calibration_parts.merge_into_complex(pipeline, epics_dict["AU_f1_re"][0], epics_dict["AU_f1_im"][0])
Xi = calibration_parts.compute_Xi(pipeline, pcal_at_src_freq, derr_at_src_freq, src_pcal_line_freq, C0_f1, D_f1, AT_f1, AP_f1, AU_f1, esd_act_line_freq, ktst, apply_complex_kappatst, pum_act_line_freq, kpum, apply_complex_kappapum, uim_act_line_freq, kuim, apply_complex_kappauim, kc, fcc)
Xi = calibration_parts.compute_Xi(pipeline, pcal_at_act_pcal_freq, derr_at_act_pcal_freq, act_pcal_line_freq, C0_f1, D_f1, AT_f1, AP_f1, AU_f1, esd_act_line_freq, ktst, apply_complex_kappatst, pum_act_line_freq, kpum, apply_complex_kappapum, uim_act_line_freq, kuim, apply_complex_kappauim, kc, fcc)
else:
Xi = calibration_parts.compute_Xi_from_filters_file(pipeline, pcal_at_src_freq, derr_at_src_freq, src_pcal_line_freq, C0_f1_re, C0_f1_im, D_f1_re, D_f1_im, AT_f1_re, AT_f1_im, AP_f1_re, AP_f1_im, AU_f1_re, AU_f1_im, esd_act_line_freq, ktst, apply_complex_kappatst, pum_act_line_freq, kpum, apply_complex_kappapum, uim_act_line_freq, kuim, apply_complex_kappauim, kc, fcc)
Xi = calibration_parts.compute_Xi_from_filters_file(pipeline, pcal_at_act_pcal_freq, derr_at_act_pcal_freq, act_pcal_line_freq, C0_f1_re, C0_f1_im, D_f1_re, D_f1_im, AT_f1_re, AT_f1_im, AP_f1_re, AP_f1_im, AU_f1_re, AU_f1_im, esd_act_line_freq, ktst, apply_complex_kappatst, pum_act_line_freq, kpum, apply_complex_kappapum, uim_act_line_freq, kuim, apply_complex_kappauim, kc, fcc)
Xi = pipeparts.mktee(pipeline, Xi)
if use_coherence:
# Gate Xi with all coherences. We apply the gating and smoothing here since Q depends on the inverse of Im(Xi), which fluctuates about zero.
Xi_gated = calibration_parts.mkgate(pipeline, Xi, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, pcaly_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, pcaly_line4_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi, pcaly_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'Xigate1', queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, pcaly_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'Xigate2', queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line3_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'Xigate3', queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line1_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'Xigate4', queue_length = queue_length)
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line2_coh, coherence_unc_threshold, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, invert_control = True, name = 'Xigate5', queue_length = queue_length)
# Gate Xi with the amplitude channels of the lines used.
if "pcal_line1_amp" in headkeys:
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, pcal_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'Xigate6', queue_length = queue_length)
if "pcal_line2_amp" in headkeys:
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, pcal_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'Xigate7', queue_length = queue_length)
if "sus_line1_amp" in headkeys:
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line1_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'Xigate8', queue_length = queue_length)
if "sus_line2_amp" in headkeys:
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line2_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'Xigate9', queue_length = queue_length)
if "sus_line3_amp" in headkeys:
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, sus_line3_amp, input_min, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'Xigate10', queue_length = queue_length)
# Use gating to require that the needed input channels are available and nonzero.
if tdcf_gate_with_excitation:
if excitations_exist[4] == None:
if excitations_exist[1] == None:
uimexc_exists = calibration_parts.mkresample(pipeline, uimexc, 3, False, calibstate_sr)
uimexc_exists = pipeparts.mkbitvectorgen(pipeline, uimexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
uimexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, uimexc_exists, calibstate_caps))
excitations_exist[1] = uimexc_exists
if excitations_exist[2] == None:
pumexc_exists = calibration_parts.mkresample(pipeline, pumexc, 3, False, calibstate_sr)
pumexc_exists = pipeparts.mkbitvectorgen(pipeline, pumexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
pumexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, pumexc_exists, calibstate_caps))
excitations_exist[2] = pumexc_exists
if excitations_exist[3] == None:
tstexc_exists = calibration_parts.mkresample(pipeline, tstexc, 3, False, calibstate_sr)
tstexc_exists = pipeparts.mkbitvectorgen(pipeline, tstexc_exists, threshold = 1.0001 * input_min, bit_vector = 1)
tstexc_exists = pipeparts.mktee(pipeline, pipeparts.mkcapsfilter(pipeline, tstexc_exists, calibstate_caps))
excitations_exist[3] = tstexc_exists
excitations_exist[4] = pipeparts.mktee(pipeline, calibration_parts.mkmultiplier(pipeline, excitations_exist[:4]))
Xi_gated = calibration_parts.mkgate(pipeline, Xi_gated, excitations_exist[4], 1, attack_length = kappa_gate_attack_length, hold_length = kappa_gate_hold_length, name = 'Xigate11', queue_length = queue_length)
Xi_gated = pipeparts.mktee(pipeline, Xi_gated)
smooth_Xi = calibration_parts.smooth_complex_kappas(pipeline, Xi_gated, float(numpy.real(expected_Xi)), float(numpy.imag(expected_Xi)), median_smoothing_samples, factors_average_samples, tdcf_default_to_median, filter_latency_factor)
@@ -1734,11 +1966,9 @@ if not compute_exact_kappas and (compute_fs or compute_srcq):
Xi_unc_abs = pipeparts.mkgeneric(pipeline, Xi_gated if use_coherence else Xi, "lal_stdev", mode = 0, coherence_length = tdcf_coherence_length, array_size = tdcf_unc_samples, filter_latency = filter_latency_factor)
Xi_unc_abs = calibration_parts.compute_uncertainty_reduction(pipeline, Xi_unc_abs, integration_samples,
median_smoothing_samples, factors_average_samples)
fs_over_Q_unc_abs = calibration_parts.multiply_constant(pipeline, Xi_unc_abs, src_pcal_line_freq, 0.0)
if src_pcal_line_freq == act_pcal_line_freq and "pcal1_linefreq" in head_dict:
fs_over_Q_unc_abs = calibration_parts.multiply_constant(pipeline, Xi_unc_abs, act_pcal_line_freq, 0.0)
if "pcal1_linefreq" in head_dict:
head_dict["pcal1_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, fs_over_Q_unc_abs, "timestamped_average", "value", 1)
elif src_pcal_line_freq != act_pcal_line_freq and "pcal4_linefreq" in head_dict:
head_dict["pcal4_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, fs_over_Q_unc_abs, "timestamped_average", "value", 1)
fs_over_Q_unc_abs = pipeparts.mktee(pipeline, fs_over_Q_unc_abs)
if not compute_srcq:
@@ -1753,23 +1983,18 @@ median_smoothing_samples, factors_average_samples)
# compute f_s
if compute_fs:
smooth_fs_squared_almost = calibration_parts.multiply_constant(pipeline, smooth_XiR, src_pcal_line_freq, 0.0)
smooth_fs_squared = calibration_parts.multiply_constant(pipeline, smooth_fs_squared_almost, src_pcal_line_freq, 0.0)
if src_pcal_line_freq == act_pcal_line_freq and "pcal1_linefreq" in head_dict:
smooth_fs_squared_almost = calibration_parts.multiply_constant(pipeline, smooth_XiR, act_pcal_line_freq, 0.0)
smooth_fs_squared = calibration_parts.multiply_constant(pipeline, smooth_fs_squared_almost, act_pcal_line_freq, 0.0)
if "pcal1_linefreq" in head_dict:
head_dict["pcal1_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, smooth_fs_squared_almost, "timestamped_average", "value", 1)
head_dict["pcal1_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, smooth_fs_squared, "timestamped_average", "value", 1)
elif src_pcal_line_freq != act_pcal_line_freq and "pcal4_linefreq" in head_dict:
head_dict["pcal4_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, smooth_fs_squared_almost, "timestamped_average", "value", 1)
head_dict["pcal4_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, smooth_fs_squared, "timestamped_average", "value", 1)
smooth_fs_squared = pipeparts.mktee(pipeline, smooth_fs_squared)
if compute_tdcf_uncertainty:
fs_squared_unc_abs = calibration_parts.multiply_constant(pipeline, fs_over_Q_unc_abs, src_pcal_line_freq, 0.0)
if src_pcal_line_freq == act_pcal_line_freq and "pcal1_linefreq" in head_dict:
fs_squared_unc_abs = calibration_parts.multiply_constant(pipeline, fs_over_Q_unc_abs, act_pcal_line_freq, 0.0)
if "pcal1_linefreq" in head_dict:
head_dict["pcal1_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, fs_squared_unc_abs, "timestamped_average", "value", 1)
elif src_pcal_line_freq != act_pcal_line_freq and "pcal4_linefreq" in head_dict:
head_dict["pcal4_linefreq"].connect("notify::timestamped-average", calibration_parts.update_timestamped_property, fs_squared_unc_abs, "timestamped_average", "value", 1)
# compute SRC Q_inv
if compute_srcq:
@@ -1788,7 +2013,7 @@ median_smoothing_samples, factors_average_samples)
if compute_calib_statevector:
# We need the real value fs / Q.
fs_over_Q = calibration_parts.multiply_constant(pipeline, smooth_XiI, -src_pcal_line_freq, 0.0)
fs_over_Q = calibration_parts.multiply_constant(pipeline, smooth_XiI, -act_pcal_line_freq, 0.0)
#
# TIME-VARYING FACTORS COMPENSATIONS
@@ -1952,7 +2177,7 @@ elif test_filters:
ctrltee = pipeparts.mktee(pipeline, ctrl)
# resample what will become the TST actuation chain to the TST FIR filter sample rate
tst = calibration_parts.mkresample(pipeline, tst, 5, False, "audio/x-raw, format=F64LE, rate=%d" % tstchainsr, window = 3, f_cut = 0.95)
tst = calibration_parts.mkresample(pipeline, tst, 5, False, "audio/x-raw, format=F64LE, rate=%d" % tstchainsr, window = 3, f_cut = 0.95)
# Remove any DC component
if remove_dc:
tst = calibration_parts.removeDC(pipeline, tst, tstchainsr)
@@ -2395,28 +2620,28 @@ if compute_calib_statevector:
# NO-INVALID-INPUT BRANCH
#
# Check if any of the input data channels had to be replaced by zeroes because they were < 1e-35
resok = pipeparts.mkbitvectorgen(pipeline, restee, threshold=1e-35, bit_vector=1)
# Check if any of the input data channels had to be replaced by zeroes because they were < input_min
resok = pipeparts.mkbitvectorgen(pipeline, restee, threshold=input_min, bit_vector=1)
resok = pipeparts.mkcapsfilter(pipeline, resok, "audio/x-raw, format=U32LE, rate=%d" % hoft_sr)
resok = pipeparts.mkgeneric(pipeline, resok, "lal_logicalundersample", required_on = 1, status_out = 1)
resok = pipeparts.mkcapsfilter(pipeline, resok, calibstate_caps)
if CalibrationConfigs["calibrationmode"] == "Partial":
tstok = pipeparts.mkbitvectorgen(pipeline, tsttee, threshold=1e-35, bit_vector=1)
tstok = pipeparts.mkbitvectorgen(pipeline, tsttee, threshold=input_min, bit_vector=1)
tstok = pipeparts.mkcapsfilter(pipeline, tstok, "audio/x-raw, format=U32LE, rate=%d" % ctrl_sr)
tstok = pipeparts.mkgeneric(pipeline, tstok, "lal_logicalundersample", required_on = 1, status_out = 1)
tstok = pipeparts.mkcapsfilter(pipeline, tstok, calibstate_caps)
pumok = pipeparts.mkbitvectorgen(pipeline, pumtee, threshold=1e-35, bit_vector=1)
pumok = pipeparts.mkbitvectorgen(pipeline, pumtee, threshold=input_min, bit_vector=1)
pumok = pipeparts.mkcapsfilter(pipeline, pumok, "audio/x-raw, format=U32LE, rate=%d" % ctrl_sr)
pumok = pipeparts.mkgeneric(pipeline, pumok, "lal_logicalundersample", required_on = 1, status_out = 1)
pumok = pipeparts.mkcapsfilter(pipeline, pumok, calibstate_caps)
uimok = pipeparts.mkbitvectorgen(pipeline, uimtee, threshold=1e-35, bit_vector=1)
uimok = pipeparts.mkbitvectorgen(pipeline, uimtee, threshold=input_min, bit_vector=1)
uimok = pipeparts.mkcapsfilter(pipeline, uimok, "audio/x-raw, format=U32LE, rate=%d" % ctrl_sr)
uimok = pipeparts.mkgeneric(pipeline, uimok, "lal_logicalundersample", required_on = 1, status_out = 1)
uimok = pipeparts.mkcapsfilter(pipeline, uimok, calibstate_caps)
noinvalidinput = calibration_parts.mkadder(pipeline, calibration_parts.list_srcs(pipeline, resok, tstok, pumok, uimok), queue_length = [queue_length])
noinvalidinput = pipeparts.mkbitvectorgen(pipeline, noinvalidinput, threshold=4, bit_vector=pow(2,no_gap_bitnum))
if CalibrationConfigs["calibrationmode"] == "Full":
ctrlok = pipeparts.mkbitvectorgen(pipeline, darmctrltee, threshold=1e-35, bit_vector=1)
ctrlok = pipeparts.mkbitvectorgen(pipeline, darmctrltee, threshold=input_min, bit_vector=1)
ctrlok = pipeparts.mkcapsfilter(pipeline, ctrlok, "audio/x-raw, format=U32LE, rate=%d" % ctrl_sr)
ctrlok = pipeparts.mkgeneric(pipeline, ctrlok, "lal_logicalundersample", required_on = 1, status_out = 1)
ctrlok = pipeparts.mkcapsfilter(pipeline, ctrlok, calibstate_caps)
@@ -2427,16 +2652,16 @@ if compute_calib_statevector:
# inputs that are replaced with zeros affect h(t) for a short time before and after the zeros, so we also must account for this corrupted time.
noinvalidinput = calibration_parts.mkgate(pipeline, noinvalidinput, noinvalidinput, pow(2,no_gap_bitnum), attack_length = -int(filter_settle_time * calibstate_sr), hold_length = -int(filter_latency * calibstate_sr), queue_length = queue_length)
#
#
# HW INJECTION BITS
#
#
hwinjchanneltee = obsintentchanneltee if hwinj_channel_name == obsintent_channel_name else lownoisechanneltee if hwinj_channel_name == lownoise_channel_name else pipeparts.mktee(pipeline, calibration_parts.caps_and_progress(pipeline, head_dict["hwinj"], hwinj_caps, "HW_injections_%s" % instrument))
if stochhwinj_bitmask is not None:
hwinjstoch = pipeparts.mkgeneric(pipeline, hwinjchanneltee, "lal_logicalundersample", required_on = stochhwinj_bitmask, status_out = pow(2,no_stoch_inj_bitnum))
elif stochhwinj_offbitmask is not None:
hwinjstoch = pipeparts.mkgeneric(pipeline, hwinjchanneltee, "lal_logicalundersample", required_on = stochhwinj_offbitmask, invert_result = True, status_out = pow(2,no_stoch_inj_bitnum))
hwinjstoch = pipeparts.mkgeneric(pipeline, hwinjchanneltee, "lal_logicalundersample", required_on = stochhwinj_offbitmask, invert_result = True, status_out = pow(2,no_stoch_inj_bitnum))
else:
raise ValueError("Must set either StochHWInjBitmask or StochHWInjOffBitmask")
hwinjstoch = pipeparts.mkcapsfilter(pipeline, hwinjstoch, calibstate_caps)
@@ -2460,7 +2685,7 @@ if compute_calib_statevector:
if detcharhwinj_bitmask is not None:
hwinjdetchar = pipeparts.mkgeneric(pipeline, hwinjchanneltee, "lal_logicalundersample", required_on = detcharhwinj_bitmask, status_out = pow(2,no_detchar_inj_bitnum))
elif detcharhwinj_offbitmask is not None:
hwinjdetchar = pipeparts.mkgeneric(pipeline, hwinjchanneltee, "lal_logicalundersample", required_on = detcharhwinj_offbitmask, invert_result = True, status_out = pow(2,no_detchar_inj_bitnum))
hwinjdetchar = pipeparts.mkgeneric(pipeline, hwinjchanneltee, "lal_logicalundersample", required_on = detcharhwinj_offbitmask, invert_result = True, status_out = pow(2,no_detchar_inj_bitnum))
else:
raise ValueError("Must set either DetCharHWInjBitmask or DetcharHWInjOffBitmask")
hwinjdetchar = pipeparts.mkcapsfilter(pipeline, hwinjdetchar, calibstate_caps)
@@ -2520,7 +2745,7 @@ if compute_calib_statevector:
# We are actually checking the value fs / Q, as that is more indicative of significant change.
if compute_srcq:
srcQSmoothInRange = calibration_parts.compute_kappa_bits_only_real(pipeline, fs_over_Q, fs_over_Q_default, fs_squared_var / src_pcal_line_freq, median_smoothing_samples + int((sensing_filter_update_time + sensing_filter_averaging_time) * compute_factors_sr), factors_average_samples, status_out_smooth = pow(2,fs_over_Q_smooth_bitnum), starting_rate = compute_factors_sr, ending_rate = calibstate_sr)
srcQSmoothInRange = calibration_parts.compute_kappa_bits_only_real(pipeline, fs_over_Q, fs_over_Q_default, fs_squared_var / act_pcal_line_freq, median_smoothing_samples + int((sensing_filter_update_time + sensing_filter_averaging_time) * compute_factors_sr), factors_average_samples, status_out_smooth = pow(2,fs_over_Q_smooth_bitnum), starting_rate = compute_factors_sr, ending_rate = calibstate_sr)
#
# H(T)-OK BIT BRANCH
Loading