bilby_pipe.create_injections ============================ .. py:module:: bilby_pipe.create_injections .. autoapi-nested-parse:: 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). .. !! processed by numpydoc !! Exceptions ---------- .. autoapisummary:: bilby_pipe.create_injections.BilbyPipeCreateInjectionsError Classes ------- .. autoapisummary:: bilby_pipe.create_injections.InjectionCreator Functions --------- .. autoapisummary:: bilby_pipe.create_injections.create_parser bilby_pipe.create_injections.get_full_path bilby_pipe.create_injections.create_injection_file bilby_pipe.create_injections.main Module Contents --------------- .. py:exception:: BilbyPipeCreateInjectionsError(message) Bases: :py:obj:`bilby_pipe.utils.BilbyPipeError` Common base class for all non-exit exceptions. .. !! processed by numpydoc !! .. py:function:: create_parser() 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 .. !! processed by numpydoc !! .. py:class:: 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) Bases: :py:obj:`bilby_pipe.input.Input` An object to hold inputs to create_injection for consistency .. !! processed by numpydoc !! .. py:attribute:: prior_file .. py:attribute:: prior_dict 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 :func:`_get_priors` .. !! processed by numpydoc !! .. py:attribute:: default_prior .. py:attribute:: trigger_time .. py:attribute:: gpstimes .. py:attribute:: deltaT :value: 0.2 .. py:attribute:: duration :value: 4 .. py:attribute:: post_trigger_duration :value: 2 .. py:property:: n_injection The number of injections parameters to be stored. .. !! processed by numpydoc !! .. py:attribute:: generation_seed .. py:attribute:: time_reference :value: 'geocent' .. py:attribute:: reference_frame :value: 'sky' .. py:attribute:: detectors A list of the detectors to include, e.g., ['H1', 'L1'] .. !! processed by numpydoc !! .. py:attribute:: minimum_frequency :value: None 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 .. !! processed by numpydoc !! .. py:attribute:: enforce_signal_duration :value: False .. py:method:: check_prior() Ensures at least prior/prior_dict set .. !! processed by numpydoc !! .. py:method:: get_injection_dataframe() Samples parameters from the prior into a dataframe .. !! processed by numpydoc !! .. py:method:: write_injection_dataframe(dataframe, filename, extension) :staticmethod: Writes dataframe into a file with a dat/json extension .. !! processed by numpydoc !! .. py:method:: generate_injection_file(filepath, extension) Sets the generation seed and randomly generates parameters to create inj .. !! processed by numpydoc !! .. py:function:: get_full_path(filename, extension) Makes filename and ext consistent amongst user input .. !! processed by numpydoc !! .. py:function:: 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) Makes injection file using arguments from the namespace args parameter .. !! processed by numpydoc !! .. py:function:: main() Driver to create an injection file .. !! processed by numpydoc !!