gwin.models.base_data module¶
Base classes for models with data.
-
class
gwin.models.base_data.
BaseDataModel
(variable_params, data, waveform_generator, waveform_transforms=None, **kwargs)[source]¶ Bases:
gwin.models.base.BaseModel
Base class for models that require data and a waveform generator.
This adds propeties for the log of the likelihood that the data contain noise,
lognl
, and the log likelihood ratiologlr
.Classes that inherit from this class must define
_loglr
and_lognl
functions, in addition to the_loglikelihood
requirement inherited fromBaseModel
.Parameters: - variable_params ((tuple of) string(s)) – A tuple of parameter names that will be varied.
- data (dict) – A dictionary of data, in which the keys are the detector names and the values are the data.
- waveform_generator (generator class) – A generator class that creates waveforms.
- waveform_transforms (list, optional) – List of transforms to use to go from the variable args to parameters understood by the waveform generator.
- **kwargs – All other keyword arguments are passed to
BaseModel
.
-
waveform_generator
¶ dict – The waveform generator that the class was initialized with.
-
data
¶ dict – The data that the class was initialized with.
-
Properties
¶
-
----------
-
lognl
¶ Returns the log likelihood of the noise.
-
loglr
¶ Returns the log of the likelihood ratio.
-
logplr
¶ Returns the log of the prior-weighted likelihood ratio.
-
See ``BaseModel`` for additional attributes and properties.
-
data
Returns the data that was set.
-
classmethod
from_config
(cp, data, delta_f=None, delta_t=None, gates=None, recalibration=None, **kwargs)[source]¶ Initializes an instance of this class from the given config file.
Parameters: - cp (WorkflowConfigParser) – Config file parser to read.
- data (dict) – A dictionary of data, in which the keys are the detector names and the values are the data. This is not retrieved from the config file, and so must be provided.
- delta_f (float) – The frequency spacing of the data; needed for waveform generation.
- delta_t (float) – The time spacing of the data; needed for time-domain waveform generators.
- recalibration (dict of pycbc.calibration.Recalibrate, optional) – Dictionary of detectors -> recalibration class instances for recalibrating data.
- gates (dict of tuples, optional) – Dictionary of detectors -> tuples of specifying gate times. The
sort of thing returned by
pycbc.gate.gates_from_cli
. - **kwargs – All additional keyword arguments are passed to the class. Any provided keyword will over ride what is in the config file.
-
loglr
The log likelihood ratio at the current parameters.
This will initially try to return the
current_stats.loglr
. If that raises anAttributeError
, will call_loglr`
to calculate it and store it tocurrent_stats
.
-
lognl
The log likelihood of the model assuming the data is noise.
This will initially try to return the
current_stats.lognl
. If that raises anAttributeError
, will call_lognl`
to calculate it and store it tocurrent_stats
.
-
logplr
Returns the log of the prior-weighted likelihood ratio at the current parameter values.
The logprior is calculated first. If the logprior returns
-inf
(possibly indicating a non-physical point), thenloglr
is not called.
-
waveform_generator
Returns the waveform generator that was set.