Skip to content

Commit

Permalink
SNR optimisation options for pycbc_live (gwastro#4432)
Browse files Browse the repository at this point in the history
* Moving the live optimizer option changes to my own branch

* Completing the snr optimization argument group

* updating pycbc_live

* re-adding bug fix

* removing TODO message

* Bug with d_e options

* Adding optimizer-seed

* fixing the d_e optimizer

* replacing run.sh code

* resolve merge conflict

* fixing run.sh

* cleaning up args_to_string func

* changing comment

* codeclimate fixes

* module docstring

* Update module docstring copyright

Co-authored-by: Gareth S Cabourn Davies <[email protected]>

* Add gareth

* removing argv

* argument changing

* removing duplicated arguments

* minor CC points

* remove bug introduced when making CC happier

---------

Co-authored-by: Gareth S Cabourn Davies <[email protected]>
Co-authored-by: Thomas Dent <[email protected]>
  • Loading branch information
3 people authored and PRAVEEN-mnl committed Nov 3, 2023
1 parent 2436d0b commit d88001a
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 283 deletions.
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

0 comments on commit d88001a

Please sign in to comment.