diff --git a/bin/live/pycbc_live_supervise_collated_trigger_fits b/bin/live/pycbc_live_supervise_collated_trigger_fits index 178f5398db5..3cbc4b416d9 100755 --- a/bin/live/pycbc_live_supervise_collated_trigger_fits +++ b/bin/live/pycbc_live_supervise_collated_trigger_fits @@ -20,6 +20,7 @@ from lal import gpstime import pycbc from pycbc.live import supervision as sv from pycbc.types.config import InterpolatingConfigParser as icp +from pycbc.io import HFile def read_options(args): @@ -112,6 +113,16 @@ def trigger_collation( return trig_merge_file +def get_active_ifos(trigger_file): + """ + Get the active ifos from the trigger file + """ + with HFile(trigger_file, 'r') as f: + ifos = [ifo for ifo in f.keys() if 'snr' in f[ifo].keys()] + logging.info("Interferometers with data: %s", ' '.join(ifos)) + return ifos + + def fit_by_template( trigger_merge_file, day_str, @@ -150,7 +161,7 @@ def find_daily_files( """ log_str = f"Finding files in {daily_files_dir} with format {daily_fname_format}" if ifo is not None: - log_str += f"in detector {ifo}" + log_str += f" in detector {ifo}" logging.info(log_str) combined_days = int(combined_control_options['combined-days']) @@ -656,7 +667,13 @@ def supervise_collation_fits_dq(args, day_dt, day_str): ) # Store the locations of files needed for the statistic stat_files = [] - for ifo in config_opts['control']['ifos'].split(): + + # daily fits should only be done for IFOs that had data + # and were included in the config file + all_ifos = controls['ifos'].split() + active_ifos = get_active_ifos(merged_triggers) + active_ifos = [ifo for ifo in active_ifos if ifo in all_ifos] + for ifo in active_ifos: if args.fit_by_template: # compute and plot daily template fits fbt_file, date_str = fit_by_template( @@ -696,6 +713,7 @@ def supervise_collation_fits_dq(args, day_dt, day_str): controls ) + for ifo in all_ifos: if args.fit_over_multiparam: # compute and plot template fits smoothed over parameter space # and combining multiple days of triggers