bilby.gw.waveform_generator.WaveformGenerator

class bilby.gw.waveform_generator.WaveformGenerator(duration=None, sampling_frequency=None, start_time=0, frequency_domain_source_model=None, time_domain_source_model=None, parameters=None, parameter_conversion=None, waveform_arguments=None)[source]

Bases: object

The base waveform generator class.

Waveform generators provide a unified method to call disparate source models.

__init__(duration=None, sampling_frequency=None, start_time=0, frequency_domain_source_model=None, time_domain_source_model=None, parameters=None, parameter_conversion=None, waveform_arguments=None)[source]

The base waveform generator class.

Parameters:
sampling_frequency: float, optional

The sampling frequency

duration: float, optional

Time duration of data

start_time: float, optional

Starting time of the time array

frequency_domain_source_model: func, optional

A python function taking some arguments and returning the frequency domain strain. Note the first argument must be the frequencies at which to compute the strain

time_domain_source_model: func, optional

A python function taking some arguments and returning the time domain strain. Note the first argument must be the times at which to compute the strain

parameters: dict, optional

Initial values for the parameters

parameter_conversion: func, optional

Function to convert from sampled parameters to parameters of the waveform generator. Default value is the identity, i.e. it leaves the parameters unaffected.

waveform_arguments: dict, optional

A dictionary of fixed keyword arguments to pass to either frequency_domain_source_model or time_domain_source_model.

Note: the arguments of frequency_domain_source_model (except the first, which is the frequencies at which to compute the strain) will be added to the WaveformGenerator object and initialised to None.

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__([duration, sampling_frequency, ...])

The base waveform generator class.

frequency_domain_strain([parameters])

Wrapper to source_model.

time_domain_strain([parameters])

Wrapper to source_model.

Attributes

parameters

The dictionary of parameters for source model.

frequency_domain_strain(parameters=None)[source]

Wrapper to source_model.

Converts self.parameters with self.parameter_conversion before handing it off to the source model. Automatically refers to the time_domain_source model via NFFT if no frequency_domain_source_model is given.

Parameters:
parameters: dict, optional

Parameters to evaluate the waveform for, this overwrites self.parameters. If not provided will fall back to self.parameters.

Returns:
array_like: The frequency domain strain for the given set of parameters
Raises:
RuntimeError: If no source model is given
property parameters

The dictionary of parameters for source model.

Returns:
dict: The dictionary of parameter key-value pairs
time_domain_strain(parameters=None)[source]

Wrapper to source_model.

Converts self.parameters with self.parameter_conversion before handing it off to the source model. Automatically refers to the frequency_domain_source model via INFFT if no frequency_domain_source_model is given.

Parameters:
parameters: dict, optional

Parameters to evaluate the waveform for, this overwrites self.parameters. If not provided will fall back to self.parameters.

Returns:
array_like: The time domain strain for the given set of parameters
Raises:
RuntimeError: If no source model is given