Skip to content

Commit

Permalink
Bugfix for live fits (#4881)
Browse files Browse the repository at this point in the history
* Have Live supervision script check active ifos

* pass ifos

* Only do daily fits for ifos with data

* Add comment
  • Loading branch information
maxtrevor authored Sep 16, 2024
1 parent 3264f60 commit 4833249
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions bin/live/pycbc_live_supervise_collated_trigger_fits
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'])

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4833249

Please sign in to comment.