Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for live fits #4881

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 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,11 @@ 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():

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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we are looking at removing any IFOs which are in the trigger file but not in the config file? That may be worth commenting, as I got confused for a minute

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

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 +711,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
Loading