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.

  1. after a new object is created, read() must be called before any other method in the interfaqce.

  2. after read() has been called it is legal to call get_data_vector(), or to call update().

  3. after update() is called it is then legal to call calculate_loglike() or get_data_vector(), or to reset the object (returning to the pre-update state) by calling reset(). It is also legal to call compute_theory_vector().

  4. after compute_theory_vector() is called it is legal to call get_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_data_vector()

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_theory_vector()

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.

make_realization_vector()

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(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.

is_updated()

Determine if the object has been updated.

reset()

Reset the updatable.

required_parameters()

Returns a RequiredParameters object.

get_derived_parameters()

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.

_required_parameters()

Return a RequiredParameters object containing the information for this class.

_get_derived_parameters()

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.

Parameters:

statistic (Statistic | list[Statistic] | None) – The statistic for which the sub-covariance matrix should be returned. If not specified, return the covariance of all statistics.

Return type:

ndarray[Any, dtype[float64]]

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.

Parameters:

statistic (Statistic | list[Statistic] | None) –

Return type:

ndarray[Any, dtype[int64]]

final get_theory_vector()[source]#

Get the theory vector from all statistics in the right order.

Return type:

ndarray[Any, dtype[float64]]

make_realization(sacc_data, add_noise=True, strict=True)[source]#

Create a new realization of the model.

Parameters:
  • sacc_data (Sacc) –

  • add_noise (bool) –

  • strict (bool) –

Return type:

Sacc

read(sacc_data)[source]#

Read the covariance matrix for this likelihood from the SACC file.

Parameters:

sacc_data (Sacc) –

Return type:

None