firecrown.likelihood.gauss_family.gauss_family.GaussFamily#
- class firecrown.likelihood.gauss_family.gauss_family.GaussFamily(statistics)[source]#
Bases:
Likelihood
GaussFamily is the base class for likelihoods based on a chi-squared calculation.
It provides an implementation of Likelihood.compute_chisq. Derived classes must implement the abstract method compute_loglike, which is inherited from Likelihood.
GaussFamily (and all classes that inherit from it) must abide by the the following rules regarding the order of calling of methods.
after a new object is created,
read()
must be called before any other method in the interfaqce.after
read()
has been called it is legal to callget_data_vector()
, or to callupdate()
.after
update()
is called it is then legal to callcalculate_loglike()
orget_data_vector()
, or to reset the object (returning to the pre-update state) by callingreset()
. It is also legal to callcompute_theory_vector()
.after
compute_theory_vector()
is called it is legal to callget_theory_vector()
to retrieve the already-calculated theory vector.
This state machine behavior is enforced through the use of the decorator
enforce_states()
, above.- Parameters:
statistics (
Sequence
[Statistic
]) –
Public Methods:
__init__
(statistics)Initialize the base class parts of a GaussFamily object.
read
(sacc_data)Read the covariance matrix for this likelihood from the SACC file.
get_cov
([statistic])Gets the current covariance matrix.
Get the data vector from all statistics in the right order.
compute_theory_vector
(tools)Computes the theory vector using the current instance of pyccl.Cosmology.
Get the theory vector from all statistics in the right order.
compute
(tools)Calculate and return both the data and theory vectors.
compute_chisq
(tools)Calculate and return the chi-squared for the given cosmology.
get_sacc_indices
([statistic])Get the SACC indices of the statistic or list of statistics.
make_realization
(sacc_data[, add_noise, strict])Create a new realization of the model.
Inherited from
Likelihood
__init__
([parameter_prefix])Default initialization for a base Likelihood object.
read
(sacc_data)Read the covariance matrix for this likelihood from the SACC file.
Create a new realization of the model.
make_realization
(sacc_data[, add_noise, strict])Create a new realization of the model.
compute_loglike
(tools)Compute the log-likelihood of generic CCL data.
Inherited from
Updatable
__init__
([parameter_prefix])Updatable initialization.
__setattr__
(key, value)Set the attribute named
key
to the supplied value.set_parameter
(key, value)Sets the parameter to the given value.
set_internal_parameter
(key, value)Assure this InternalParameter has not already been set, and then set it.
set_sampler_parameter
(key, value)Assure this SamplerParameter has not already been set, and then set it.
update
(params)Update self by calling to prepare for the next MCMC sample.
Determine if the object has been updated.
reset
()Reset the updatable.
Returns a RequiredParameters object.
Returns a collection of derived parameters.
Private Methods:
_update
(_)Handle the state resetting required by
GaussFamily
likelihoods._reset
()Handle the state resetting required by
GaussFamily
likelihoods.Inherited from
Updatable
_update
(params)Method for auxiliary updates to be made to an updatable.
_reset
()Abstract method implemented by all concrete classes to update self.
Return a RequiredParameters object containing the information for this class.
Returns the derived parameters of an implementation.
- _reset()[source]#
Handle the state resetting required by
GaussFamily
likelihoods.Any derived class that needs to implement
reset()
for its own reasons must be sure to do what this does: check the state at the start of the method, and change the state at the end of the method.- Return type:
None
- _update(_)[source]#
Handle the state resetting required by
GaussFamily
likelihoods.Any derived class that needs to implement
_update()
for its own reasons must be sure to do what this does: check the state at the start of the method, and change the state at the end of the method.- Parameters:
_ (
ParamsMap
) –- Return type:
None
- final compute(tools)[source]#
Calculate and return both the data and theory vectors.
- Parameters:
tools (
ModelingTools
) –- Return type:
tuple
[ndarray
[Any
,dtype
[float64
]],ndarray
[Any
,dtype
[float64
]]]
- final compute_chisq(tools)[source]#
Calculate and return the chi-squared for the given cosmology.
- Parameters:
tools (
ModelingTools
) –- Return type:
float
- final compute_theory_vector(tools)[source]#
Computes the theory vector using the current instance of pyccl.Cosmology.
- Parameters:
tools (
ModelingTools
) – Current ModelingTools object- Return type:
ndarray
[Any
,dtype
[float64
]]
- final get_cov(statistic=None)[source]#
Gets the current covariance matrix. :rtype:
ndarray
[Any
,dtype
[float64
]]- Parameters:
statistic (
Union
[Statistic
,list
[Statistic
],None
]) – The statistic for which the sub-covariance matrix
should be return. If not specified, return the covariance of all statistics.
- final get_data_vector()[source]#
Get the data vector from all statistics in the right order.
- Return type:
ndarray
[Any
,dtype
[float64
]]
- get_sacc_indices(statistic=None)[source]#
Get the SACC indices of the statistic or list of statistics.
If no statistic is given, get the indices of all statistics of the likelihood.
- final get_theory_vector()[source]#
Get the theory vector from all statistics in the right order.
- Return type:
ndarray
[Any
,dtype
[float64
]]