bilby_pipe.create_injections

This a command line tool for the generation of injection files for consumption by bilby_pipe. Injection files can be generated in a variety of formats, see below, and are generated from a bilby-style prior_file.

Available formats: A dat file consists of a space-separated list of parameters with a header; A json formatted file.

If a geocent_time prior is given in the file, this will be used to create the time prior. Otherwise, the trigger-time & deltaT or gps-time and deltaT options are used (see below).

Exceptions

BilbyPipeCreateInjectionsError

Common base class for all non-exit exceptions.

Classes

InjectionCreator

An object to hold inputs to create_injection for consistency

Functions

create_parser()

Generate a parser for the create_injections.py script

get_full_path(filename, extension)

Makes filename and ext consistent amongst user input

create_injection_file(filename, n_injection[, ...])

Makes injection file using arguments from the namespace args parameter

main()

Driver to create an injection file

Module Contents

exception bilby_pipe.create_injections.BilbyPipeCreateInjectionsError(message)[source]

Bases: bilby_pipe.utils.BilbyPipeError

Common base class for all non-exit exceptions.

bilby_pipe.create_injections.create_parser()[source]

Generate a parser for the create_injections.py script

Additional options can be added to the returned parser before calling parser.parse_args to generate the arguments`

Returns:
parser: BilbyArgParser

A parser with all the default options already added

class bilby_pipe.create_injections.InjectionCreator(prior_file, prior_dict, default_prior, trigger_time, gpstimes, n_injection, generation_seed, deltaT=0.2, duration=4, post_trigger_duration=2, enforce_signal_duration=False, minimum_frequency=None)[source]

Bases: bilby_pipe.input.Input

An object to hold inputs to create_injection for consistency

prior_file[source]
prior_dict[source]

The input prior_dict from the ini (if given)

Note, this is not the bilby prior (see self.priors for that), this is a key-val dictionary where the val’s are strings which are converting into bilby priors in _get_priors()

default_prior[source]
trigger_time[source]
gpstimes[source]
deltaT[source]
duration[source]
post_trigger_duration[source]
property n_injection[source]

The number of injections parameters to be stored.

generation_seed[source]
time_reference = 'geocent'[source]
reference_frame = 'sky'[source]
detectors[source]

A list of the detectors to include, e.g., [‘H1’, ‘L1’]

minimum_frequency[source]

The minimum frequency

If a per-detector dictionary is given, this will return the minimum frequency value. To access the dictionary, see self.minimum_frequency_dict

enforce_signal_duration[source]
check_prior()[source]

Ensures at least prior/prior_dict set

get_injection_dataframe()[source]

Samples parameters from the prior into a dataframe

static write_injection_dataframe(dataframe, filename, extension)[source]

Writes dataframe into a file with a dat/json extension

generate_injection_file(filepath, extension)[source]

Sets the generation seed and randomly generates parameters to create inj

bilby_pipe.create_injections.get_full_path(filename, extension)[source]

Makes filename and ext consistent amongst user input

bilby_pipe.create_injections.create_injection_file(filename, n_injection, prior_file=None, prior_dict=None, trigger_time=None, deltaT=0.2, gpstimes=None, duration=4, post_trigger_duration=2, generation_seed=None, extension='dat', default_prior='BBHPriorDict', enforce_signal_duration=False)[source]

Makes injection file using arguments from the namespace args parameter

bilby_pipe.create_injections.main()[source]

Driver to create an injection file