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

Introduced a new arguement --skymap-only-ifos in pycbc_live #4346

Merged
merged 11 commits into from
Jul 11, 2023
25 changes: 16 additions & 9 deletions bin/pycbc_live
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class LiveEventManager(object):
def __init__(self, args, bank):
self.low_frequency_cutoff = args.low_frequency_cutoff
self.bank = bank
self.skymap_only_ifos = [] if args.skymap_only_ifos is None else list(set(args.skymap_only_ifos))

# Figure out what we are supposed to process within the pool of MPI processes
self.comm = mpi.COMM_WORLD
Expand Down Expand Up @@ -212,7 +213,7 @@ class LiveEventManager(object):
ifo,
triggers,
pvalue_info,
recalculate_ifar=recalculate_ifar
recalculate_ifar=recalculate_ifar and ifo not in self.skymap_only_ifos
)

# the SNR time series sample rate can vary slightly due to
Expand Down Expand Up @@ -416,7 +417,7 @@ class LiveEventManager(object):
# reload_buffer time. These args are documented here:
# https://ligo-gracedb.readthedocs.io/en/latest/api.html#ligo.gracedb.rest.GraceDb
# Because we do not change any of the request session values when running the
# code, it should remain thread safe.
# code, it should remain thread safe.
gdbargs = {'reload_certificate': True, 'reload_buffer': 300}
if self.gracedb_server:
gdbargs['service_url'] = self.gracedb_server
Expand Down Expand Up @@ -457,7 +458,8 @@ class LiveEventManager(object):

logging.info('computing followup data for coinc')
coinc_ifos = coinc_results['foreground/type'].split('-')
followup_ifos = list(set(ifos) - set(coinc_ifos))
followup_ifos = set(ifos) - set(coinc_ifos)
followup_ifos = list(followup_ifos | set(self.skymap_only_ifos))
tdent marked this conversation as resolved.
Show resolved Hide resolved

double_ifar = coinc_results['foreground/ifar']
if double_ifar < args.ifar_double_followup_threshold:
Expand Down Expand Up @@ -503,7 +505,7 @@ class LiveEventManager(object):
ifar = coinc_results['foreground/ifar']
upload_checks = self.enable_gracedb_upload and self.ifar_upload_threshold < ifar
optimize_snr_checks = self.run_snr_optimization and self.ifar_upload_threshold < ifar

# Keep track of the last few coincs uploaded in order to
# prevent singles being uploaded as well for coinc events
self.last_few_coincs_uploaded.append(event.merger_time)
Expand Down Expand Up @@ -910,6 +912,8 @@ parser.add_argument('--enable-embright-has-massgap', action='store_true', defaul
parser.add_argument('--embright-massgap-max', type=float, default=5.0, metavar='SOLAR MASSES',
help='Upper limit of the mass gap, used for estimating '
'HasMassGap probability.')
parser.add_argument('--skymap-only-ifos', nargs='+',
help="Detectors that only contribute in sky localization")

scheme.insert_processing_option_group(parser)
LiveSingle.insert_args(parser)
Expand Down Expand Up @@ -952,6 +956,7 @@ ifos = set(args.channel_name.keys())
logging.info('Analyzing data from detectors %s', ppdets(ifos))

evnt = LiveEventManager(args, bank)
logging.info('Detectors that only aid in the sky localization %s', ppdets(evnt.skymap_only_ifos))

# include MPI rank and functional description into proctitle
task_name = 'root' if evnt.rank == 0 else 'filtering'
Expand Down Expand Up @@ -1029,7 +1034,8 @@ with ctx:

# Create double coincident background estimator for every combo
if args.enable_background_estimation and evnt.rank == 0:
ifo_combos = itertools.combinations(ifos, 2)
trigg_ifos = [ifo for ifo in ifos if ifo not in evnt.skymap_only_ifos]
ifo_combos = itertools.combinations(trigg_ifos, 2)
estimators = []
for combo in ifo_combos:
logging.info('Will calculate %s background', ppdets(combo, "-"))
Expand Down Expand Up @@ -1101,10 +1107,11 @@ with ctx:
status = False

if status is True:
evnt.live_detectors.add(ifo)
if evnt.rank > 0:
logging.info('Filtering %s', ifo)
results[ifo] = mf.process_data(data_reader[ifo])
if ifo not in evnt.skymap_only_ifos:
evnt.live_detectors.add(ifo)
if evnt.rank > 0:
logging.info('Filtering %s', ifo)
results[ifo] = mf.process_data(data_reader[ifo])
else:
logging.info('Insufficient data for %s analysis', ifo)

Expand Down
14 changes: 7 additions & 7 deletions pycbc/io/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, coinc_ifos, ifos, coinc_results, **kwargs):
snr_ifos = sld.keys() # Ifos with SNR time series calculated
self.snr_series = {ifo: sld[ifo]['snr_series'] for ifo in snr_ifos}
# Extra ifos have SNR time series but not sngl inspiral triggers
extra_ifos = list(set(snr_ifos) - set(self.et_ifos))
tdent marked this conversation as resolved.
Show resolved Hide resolved
# extra_ifos = list(set(snr_ifos) - set(self.et_ifos))

for ifo in snr_ifos:
# Ifos used for sky loc must have a PSD
Expand All @@ -101,7 +101,7 @@ def __init__(self, coinc_ifos, ifos, coinc_results, **kwargs):
else:
self.snr_series = None
snr_ifos = self.et_ifos
extra_ifos = []
tdent marked this conversation as resolved.
Show resolved Hide resolved
#extra_ifos = []

# Set up the bare structure of the xml document
outdoc = ligolw.Document()
Expand Down Expand Up @@ -195,11 +195,11 @@ def __init__(self, coinc_ifos, ifos, coinc_results, **kwargs):
# assumptions and checks
bayestar_check_fields = ('mass1 mass2 mtotal mchirp eta spin1x '
Copy link
Contributor

Choose a reason for hiding this comment

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

bayestar_check_fields and the comment above should also now be removed, as it is now unused.

'spin1y spin1z spin2x spin2y spin2z').split()
for sngl in sngl_inspiral_table:
tdent marked this conversation as resolved.
Show resolved Hide resolved
if sngl.ifo in extra_ifos:
for bcf in bayestar_check_fields:
setattr(sngl, bcf, getattr(sngl_populated, bcf))
sngl.end = lal.LIGOTimeGPS(self.merger_time)
#for sngl in sngl_inspiral_table:
# if sngl.ifo in extra_ifos:
# for bcf in bayestar_check_fields:
# setattr(sngl, bcf, getattr(sngl_populated, bcf))
# sngl.end = lal.LIGOTimeGPS(self.merger_time)

outdoc.childNodes[0].appendChild(coinc_event_map_table)
outdoc.childNodes[0].appendChild(sngl_inspiral_table)
Expand Down