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)

prior_lookup(duration, scale_factor, outdir[, ...])

Lookup the appropriate prior and apply rescaling factors

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

Creates ini file from defaults and candidate contents

determine_duration_and_scale_factor_from_parameters(...)

Determine appropriate duration and roq scale factor from chirp mass

generate_prior_from_template(duration, roq_params[, ...])

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

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.prior_lookup(duration, scale_factor, outdir, template=None, chirp_mass=None)[source]

Lookup the appropriate prior and apply rescaling factors

Parameters:
duration: float

Inferred duration of the signal

scale_factor: float
outdir: str

Output directory

chirp_mass: float

The chirp mass of the trigger

Returns:
prior_file, roq_folder: str

Path to the prior file to use usually written to the outdir, and the roq folder

duration, minimum_frequency, maximum_frequency: int

The duration, minimum and maximum frequency to use (rescaled if needed)

bilby_pipe.gracedb.create_config_file(candidate, gracedb, outdir, channel_dict, sampler_kwargs, webdir, roq=True, search_type='cbc', 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

roq: bool

If True, use the default ROQ settings if required

search_type: str

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

settings: str

JSON filename containing settings to override the defaults

Returns:
filename: str

Generated ini filename

bilby_pipe.gracedb.determine_duration_and_scale_factor_from_parameters(chirp_mass)[source]

Determine appropriate duration and roq scale factor from chirp mass

Parameters:
chirp_mass: float

The chirp mass of the source (in solar masses)

Returns:
duration: int
roq_scale_factor: float
bilby_pipe.gracedb.generate_prior_from_template(duration, roq_params, scale_factor=1, outdir='.', template=None, chirp_mass=None)[source]

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

Parameters:
duration: float

The segment duration

roq_params: dict

Dictionary of the ROQ params.dat file

scale_factor: float

Rescaling factor

outdir: str

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

template: [str, None]

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

chirp_mass: [float, None]

The template chirp mass, used to set the prior bounds for low mass systems

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]