firecrown.likelihood.statistic
Gaussian Family Statistic Module.
The Statistic class describing objects that implement methods to compute the
data and theory vectors for a GaussFamily subclass.
Exceptions
Error raised when accessing an un-read statistic. |
Classes
The abstract base class for all physics-related statistics. |
|
An internal class used to maintain state on statistics. |
|
A minimal statistic only to be used for testing Gaussian likelihoods. |
Module Contents
- exception firecrown.likelihood.statistic.StatisticUnreadError(stat)[source]
Bases:
RuntimeError
Error raised when accessing an un-read statistic.
Run-time error indicating an attempt has been made to use a statistic that has not had read called in it.
- Parameters:
stat (Statistic)
- statstic
- class firecrown.likelihood.statistic.Statistic(parameter_prefix=None)[source]
Bases:
firecrown.updatable.Updatable
The abstract base class for all physics-related statistics.
Statistics read data from a SACC object as part of a multi-phase initialization. They manage a
DataVectorand, given aModelingToolsobject, can compute aTheoryVector.Statistics represent things like two-point functions and mass functions.
- Parameters:
parameter_prefix (None | str)
- sacc_indices: None | numpy.typing.NDArray[numpy.int64]
- ready = False
- computed_theory_vector = False
- theory_vector: None | firecrown.data_types.TheoryVector = None
- read(_)[source]
Read the data for this statistic and mark it as ready for use.
Derived classes that override this function should make sure to call the base class method using:
super().read(sacc_data)
as the last thing they do.
- Parameters:
_ (sacc.Sacc) – currently unused, but required by the interface.
- Return type:
None
- abstractmethod get_data_vector()[source]
Gets the statistic data vector.
- Returns:
The data vector.
- Return type:
- compute_theory_vector(tools)[source]
Compute a statistic from sources, applying any systematics.
- Parameters:
tools (firecrown.modeling_tools.ModelingTools) – the modeling tools used to compute the theory vector.
- Returns:
The computed theory vector.
- Return type:
- class firecrown.likelihood.statistic.GuardedStatistic(stat)[source]
Bases:
firecrown.updatable.Updatable
An internal class used to maintain state on statistics.
GuardedStatisticis used by the framework to maintain and validate the state of instances of classes derived fromStatistic.- Parameters:
stat (Statistic)
- statistic
- read(sacc_data)[source]
Read whatever data is needed from the given
sacc.Saccobject.After this function is called, the object should be prepared for the calling of the methods
get_data_vector()andcompute_theory_vector().- Parameters:
sacc_data (sacc.Sacc) – The SACC data object to read from.
- Return type:
None
- get_data_vector()[source]
Return the contained
Statistic’s data vector.GuardedStatisticensures thatread()has been called. first.- Returns:
The most recently calculated data vector.
- Return type:
- compute_theory_vector(tools)[source]
Return the contained
Statistic’s computed theory vector.GuardedStatisticensures thatread()has been called. first.- Parameters:
tools (firecrown.modeling_tools.ModelingTools) – the modeling tools used to compute the theory vector.
- Returns:
The computed theory vector.
- Return type:
- class firecrown.likelihood.statistic.TrivialStatistic[source]
Bases:
Statistic
A minimal statistic only to be used for testing Gaussian likelihoods.
It returns a
DataVectorandTheoryVectoreach of which is three elements long. The SACC data provided toTrivialStatistic.read()must supply the necessary values.- count = 3
- data_vector: None | firecrown.data_types.DataVector = None
- mean
- computed_theory_vector = False
- read(sacc_data)[source]
Read the necessary items from the sacc data.
- Parameters:
sacc_data (sacc.Sacc) – The SACC data object to be read
- Return type:
None