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).
As an example, this file specifies a prior for precessing black hole binary systems
mass_1 = Uniform(name='mass_1', minimum=10, maximum=80)
mass_2 = Uniform(name='mass_2', minimum=10, maximum=80)
mass_ratio = Constraint(name='mass_ratio', minimum=0.125, maximum=1)
a_1 = Uniform(name='a_1', minimum=0, maximum=0.99)
a_2 = Uniform(name='a_2', minimum=0, maximum=0.99)
tilt_1 = Sine(name='tilt_1')
tilt_2 = Sine(name='tilt_2')
phi_12 = Uniform(name='phi_12', minimum=0, maximum=2 * np.pi)
phi_jl = Uniform(name='phi_jl', minimum=0, maximum=2 * np.pi)
luminosity_distance = PowerLaw(alpha=2, name='luminosity_distance', minimum=50, maximum=2000)
dec = Cosine(name='dec')
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi)
theta_jn = Sine(name='theta_jn')
psi = Uniform(name='psi', minimum=0, maximum=np.pi)
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi)
Naming this file bbh.prior
and running
$ bilby_pipe_create_injection_file bbh.prior --n-injection 100 --generation-seed 1234 -f injections.json
Will produce a file injections.json
containing 100 random draws from the prior.
Exceptions
Common base class for all non-exit exceptions. |
Classes
An object to hold inputs to create_injection for consistency |
Functions
Generate a parser for the create_injections.py script |
|
|
Makes filename and ext consistent amongst user input |
|
Makes injection file using arguments from the namespace args parameter |
|
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, cosmology=None)[source]
Bases:
bilby_pipe.input.Input
An object to hold inputs to create_injection for consistency
- 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()
- minimum_frequency = None[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
- 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, cosmology=None)[source]
Makes injection file using arguments from the namespace args parameter