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

SNR optimisation options for pycbc_live #4432

Merged
merged 24 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
14 changes: 11 additions & 3 deletions bin/pycbc_live
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ from pycbc import mchirp_area
from pycbc.detector import ppdets
from pycbc.filter import resample
from pycbc.psd import estimate
from pycbc.live import snr_optimizer

# Use cached class-based FFTs in the resample and estimate module
resample.USE_CACHING_FOR_LFILTER = True
Expand Down Expand Up @@ -119,6 +120,7 @@ class LiveEventManager(object):
if platform.system() != 'Darwin':
available_cores = len(os.sched_getaffinity(0))
self.fu_cores = available_cores - analysis_cores
self.optimizer = args.snr_opt_method
if self.fu_cores <= 0:
logging.warning(
'Insufficient number of CPU cores (%d) to '
Expand All @@ -130,6 +132,8 @@ class LiveEventManager(object):
else:
# To enable mac testing, this is just set to 1
self.fu_cores = 1
# Convert SNR optimizer options into a string
self.snr_opt_options = snr_optimizer.args_to_string(args)

if args.enable_embright_has_massgap:
if args.embright_massgap_max < self.mc_area_args['mass_bdary']['ns_max']:
Expand Down Expand Up @@ -321,6 +325,11 @@ class LiveEventManager(object):
cmd = 'timeout {} '.format(args.snr_opt_timeout)
exepath = which('pycbc_optimize_snr')
cmd += exepath + ' '

# Add SNR optimization options to the command
cmd += self.snr_opt_options

# Add data files according to the event we are optimizing
data_fils_str = '--data-files '
psd_fils_str = '--psd-files '
for ifo in live_ifos:
Expand Down Expand Up @@ -968,15 +977,13 @@ parser.add_argument('--size-override', type=int, metavar='N',
parser.add_argument('--fftw-planning-limit', type=float,
help="Time in seconds to allow for a plan to be created")
parser.add_argument('--run-snr-optimization', action='store_true',
default=False,
help='Run spawned followup processes to maximize SNR for '
'any trigger uploaded to GraceDB')
parser.add_argument('--snr-opt-timeout', type=int, default=400, metavar='SECONDS',
help='Maximum allowed duration of followup process to maximize SNR')
parser.add_argument('--snr-opt-label', type=str, default='SNR_OPTIMIZED',
parser.add_argument('--snr-opt-label', default='SNR_OPTIMIZED',
help='Label to apply to snr-optimized GraceDB uploads')


parser.add_argument('--enable-embright-has-massgap', action='store_true', default=False,
help='Estimate HasMassGap probability for EMBright info. Lower limit '
'of the mass gap is equal to the maximum NS mass used for '
Expand All @@ -994,6 +1001,7 @@ Coincer.insert_args(parser)
SingleDetSGChisq.insert_option_group(parser)
mchirp_area.insert_args(parser)
livepau.insert_live_pastro_option_group(parser)
snr_optimizer.insert_snr_optimizer_options(parser)

args = parser.parse_args()

Expand Down
Loading