bilby_pipe.gracedb

Tool for running online bilby PE using GraceDB events

The functionality of much of these utility assumes the user is running on the CIT cluster, e.g. the ROQ and calibration directories are in there usual place

Attributes

CHANNEL_DICTS

Functions

x509userproxy(outdir)

Copies X509_USER_PROXY certificate from user's os.environ and

read_from_gracedb(gracedb, gracedb_url, outdir)

Read GraceDB events from GraceDB

extract_psds_from_xml(coinc_file, ifos[, outdir])

read_from_json(json_file)

Read GraceDB events from json file

calibration_lookup(trigger_time, detector)

Lookup function for the relevant calibration file

calibration_dict_lookup(trigger_time, detectors)

Dictionary lookup function for the relevant calibration files

read_candidate(candidate)

Read a gracedb candidate json dictionary

_read_cbc_candidate(candidate)

_read_burst_candidate(candidate)

_get_cbc_likelihood_args(mode, chirp_mass)

Return cbc likelihood arguments and quantities characterizing likelihood

_choose_phenompv2_bbh_roq(chirp_mass[, ignore_no_params])

Choose an appropriate PhenomPv2 ROQ folder, and return likelihood

_choose_phenompv2_bns_roq(chirp_mass)

Choose an appropriate BNS-mass IMRPhenomPv2 ROQ basis file, and return

_choose_phenompv2nrtidalv2_roq(chirp_mass)

Choose an appropriate IMRPhenomPv2_NRTidalv2 ROQ basis file, and return

_choose_lowspin_phenomd_roq(chirp_mass[, narrow_mc])

Choose an appropriate low-spin IMRPhenomD ROQ basis file, and return

create_config_file(candidate, gracedb, outdir, ...[, ...])

Creates ini file from defaults and candidate contents

_get_distance_lookup(chirp_mass)

Return appropriate distance bounds and lookup table

generate_cbc_prior_from_template(mode, chirp_mass, ...)

Generate a cbc prior file from a template and write it to file. This

generate_burst_prior_from_template(minimum_frequency, ...)

Generate a prior file from a template and write it to file

create_parser()

main([args, unknown_args])

Module Contents

bilby_pipe.gracedb.CHANNEL_DICTS[source]
bilby_pipe.gracedb.x509userproxy(outdir)[source]

Copies X509_USER_PROXY certificate from user’s os.environ and places it inside the outdir, if the X509_USER_PROXY exists.

Parameters:
outdir: str

Output directory where X509_USER_PROXY certificate is copied to.

Returns:
x509userproxy: str, None

New path to X509_USER_PROXY certification file

None if X509_USER_PROXY certificate does not exist, or if the X509_USER_PROXY cannot be copied.

bilby_pipe.gracedb.read_from_gracedb(gracedb, gracedb_url, outdir)[source]

Read GraceDB events from GraceDB

Parameters:
gracedb: str

GraceDB id of event

gracedb_url: str

Service url for GraceDB events GraceDB ‘https://gracedb.ligo.org/api/’ (default) GraceDB-playground ‘https://gracedb-playground.ligo.org/api/

outdir: str

Output directory

Returns:
event:

Contains contents of GraceDB event from GraceDB, json format

bilby_pipe.gracedb.extract_psds_from_xml(coinc_file, ifos, outdir='.')[source]
bilby_pipe.gracedb.read_from_json(json_file)[source]

Read GraceDB events from json file

Parameters:
json_file: str

Filename of json json file output

Returns:
candidate: dict

Contains contents of GraceDB event from json, json format

bilby_pipe.gracedb.calibration_lookup(trigger_time, detector)[source]

Lookup function for the relevant calibration file

Assumes that it is running on CIT where the calibration files are stored under /home/cbc/pe/O3/calibrationenvelopes

Parameters:
trigger_time: float

The trigger time of interest

detector: str [H1, L1, V1]

Detector string

Returns:
filepath: str

The path to the relevant calibration envelope file. If no calibration file can be determined, None is returned.

bilby_pipe.gracedb.calibration_dict_lookup(trigger_time, detectors)[source]

Dictionary lookup function for the relevant calibration files

Parameters:
trigger_time: float

The trigger time of interest

detectors: list

List of detector string

Returns:
calibration_model, calibration_dict: str, dict

Calibration model string and dictionary of paths to the relevant calibration envelope file.

bilby_pipe.gracedb.read_candidate(candidate)[source]

Read a gracedb candidate json dictionary

bilby_pipe.gracedb._read_cbc_candidate(candidate)[source]
bilby_pipe.gracedb._read_burst_candidate(candidate)[source]
bilby_pipe.gracedb._get_cbc_likelihood_args(mode, chirp_mass)[source]

Return cbc likelihood arguments and quantities characterizing likelihood

Parameters:
mode: str
chirp_mass: float
Returns:
likelihood_args: dict
likelihood_parameter_bounds: dict

bounds of parameter space where likelihood is expected to be accurate

minimum_frequency: float

minimum frequency of likelihood integration

maximum_frequency: float

maximum frequency of likelihood integration

duration: float

inverse of frequency interval of likelihood integration

bilby_pipe.gracedb._choose_phenompv2_bbh_roq(chirp_mass, ignore_no_params=False)[source]

Choose an appropriate PhenomPv2 ROQ folder, and return likelihood arguments and quantities characterizing likelihood. The bases were developed in the work of arXiv:1604.08253.

Parameters:
chirp_mass: float
ignore_no_params: bool

If True, this ignores FileNotFoundError raised when roq params file is not found, which is useful for testing this command outside the CIT cluster.

Returns:
likelihood_args: dict
likelihood_parameter_bounds: dict

bounds of parameter space where likelihood is expected to be accurate

minimum_frequency: float

minimum frequency of likelihood integration

maximum_frequency: float

maximum frequency of likelihood integration

duration: float

inverse of frequency interval of likelihood integration

bilby_pipe.gracedb._choose_phenompv2_bns_roq(chirp_mass)[source]

Choose an appropriate BNS-mass IMRPhenomPv2 ROQ basis file, and return likelihood arguments and quantities characterizing likelihood.

Parameters:
chirp_mass: float
Returns:
likelihood_args: dict
likelihood_parameter_bounds: dict

bounds of parameter space where likelihood is expected to be accurate

minimum_frequency: float

minimum frequency of likelihood integration

maximum_frequency: float

maximum frequency of likelihood integration

duration: float

inverse of frequency interval of likelihood integration

bilby_pipe.gracedb._choose_phenompv2nrtidalv2_roq(chirp_mass)[source]

Choose an appropriate IMRPhenomPv2_NRTidalv2 ROQ basis file, and return likelihood arguments and quantities characterizing likelihood.

Parameters:
chirp_mass: float
Returns:
likelihood_args: dict
likelihood_parameter_bounds: dict

bounds of parameter space where likelihood is expected to be accurate

minimum_frequency: float

minimum frequency of likelihood integration

maximum_frequency: float

maximum frequency of likelihood integration

duration: float

inverse of frequency interval of likelihood integration

bilby_pipe.gracedb._choose_lowspin_phenomd_roq(chirp_mass, narrow_mc=True)[source]

Choose an appropriate low-spin IMRPhenomD ROQ basis file, and return likelihood arguments and quantities characterizing likelihood.

Parameters:
chirp_mass: float
narrow_mc: bool
Returns:
likelihood_args: dict
likelihood_parameter_bounds: dict

bounds of parameter space where likelihood is expected to be accurate

minimum_frequency: float

minimum frequency of likelihood integration

maximum_frequency: float

maximum frequency of likelihood integration

duration: float

inverse of frequency interval of likelihood integration

bilby_pipe.gracedb.create_config_file(candidate, gracedb, outdir, channel_dict, sampler_kwargs, webdir, search_type='cbc', cbc_likelihood_mode='phenompv2_bbh_roq', settings=None)[source]

Creates ini file from defaults and candidate contents

Parameters:
candidate:

Contains contents of GraceDB event

gracedb: str

GraceDB id of event

outdir: str

Output directory where the ini file and all output is written

channel_dict: dict

Dictionary of channel names

sampler_kwargs: str

Set of sampler arguments, or option for set of sampler arguments

webdir: str

Directory to store summary pages

search_type: str

What kind of search identified the trigger, options are “cbc” and “burst”

cbc_likelihood_mode: str

Which mode of CBC likelihood settings is used, options are ‘phenompv2_bbh_roq’, ‘phenompv2_bns_roq’, ‘phenompv2nrtidalv2_roq’, ‘lowspin_phenomd_narrowmc_roq’, ‘lowspin_phenomd_broadmc_roq’, and ‘test’.

settings: str

JSON filename containing settings to override the defaults

Returns:
filename: str

Generated ini filename

bilby_pipe.gracedb._get_distance_lookup(chirp_mass)[source]

Return appropriate distance bounds and lookup table

Parameters:
chirp_mass: float
Returns:
distance_bounds: tuple
lookup_table: str
bilby_pipe.gracedb.generate_cbc_prior_from_template(mode, chirp_mass, likelihood_parameter_bounds, outdir, fast_test=False)[source]

Generate a cbc prior file from a template and write it to file. This returns the paths to the prior file and the corresponding distance look-up table

Parameters:
mode: str
chirp_mass: float
likelihood_parameter_bounds: dict
outdir: str
fast_test: bool (optional, default is False)
Returns:
prior_file: str
lookup_table: str
bilby_pipe.gracedb.generate_burst_prior_from_template(minimum_frequency, maximum_frequency, outdir, template=None)[source]

Generate a prior file from a template and write it to file

Parameters:
minimum_frequency: float

Minimum frequency for prior

maximum_frequency: float

Maximum frequency for prior

outdir: str

Path to the outdir (the prior is written to outdir/online.prior)

template: str

Alternative template file to use, otherwise the data_files/roq.prior.template file is used

bilby_pipe.gracedb.create_parser()[source]
bilby_pipe.gracedb.main(args=None, unknown_args=None)[source]