firecrown.likelihood.factories
Factory functions for creating likelihoods from SACC files.
This module provides factory functions to create likelihood objects by combining a SACC file and a set of statistic factories. Users can define their own custom statistic factories for advanced use cases or rely on the generic factory functions provided here for simpler scenarios.
For straightforward contexts where all data in the SACC file is utilized, the generic factories simplify the process. The user only needs to supply the SACC file and specify which statistic factories to use, and the likelihood factory will handle the creation of the likelihood object, assembling the necessary components automatically.
These functions are particularly useful when the full set of statistics present in a SACC file is being used without the need for complex customization.
Classes
This class defines the two-point correlation space. |
|
Factory class for WeakLensing objects. |
|
Model for the data source in a likelihood configuration. |
|
Model for the two-point experiment in a likelihood configuration. |
Functions
|
Ensure the file path is a Path object. |
|
Build a likelihood object for two-point statistics from a SACC file. |
Module Contents
- class firecrown.likelihood.factories.TwoPointCorrelationSpace[source]
Bases:
firecrown.utils.YAMLSerializable,str,enum.Enum
This class defines the two-point correlation space.
The two-point correlation space can be either real or harmonic. The real space corresponds measurements in terms of angular separation, while the harmonic space corresponds to measurements in terms of spherical harmonics decomposition.
- REAL
- HARMONIC
- class firecrown.likelihood.factories.TwoPointFactory(/, **data)[source]
Bases:
pydantic.BaseModel
Factory class for WeakLensing objects.
- Parameters:
data (Any)
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- correlation_space: Annotated[TwoPointCorrelationSpace, BeforeValidator(_validate_correlation_space), Field(description='The two-point correlation space.')]
- weak_lensing_factory: firecrown.likelihood.weak_lensing.WeakLensingFactory
- number_counts_factory: firecrown.likelihood.number_counts.NumberCountsFactory
- classmethod serialize_correlation_space(value)[source]
Serialize the amplitude parameter.
- Parameters:
value (TwoPointCorrelationSpace)
- Return type:
str
- class firecrown.likelihood.factories.DataSourceSacc(/, **data)[source]
Bases:
pydantic.BaseModel
Model for the data source in a likelihood configuration.
- Parameters:
data (Any)
- sacc_data_file: str
- filters: firecrown.data_functions.TwoPointBinFilterCollection | None = None
- set_path(path)[source]
Set the path for the data source.
- Parameters:
path (pathlib.Path)
- Return type:
None
- firecrown.likelihood.factories.ensure_path(file)[source]
Ensure the file path is a Path object.
- Parameters:
file (str | pathlib.Path)
- Return type:
pathlib.Path
- class firecrown.likelihood.factories.TwoPointExperiment(/, **data)[source]
Bases:
pydantic.BaseModel
Model for the two-point experiment in a likelihood configuration.
- Parameters:
data (Any)
- two_point_factory: TwoPointFactory
- data_source: DataSourceSacc
- ccl_factory: firecrown.ccl_factory.CCLFactory | None = None
- classmethod load_from_yaml(file)[source]
Load a TwoPointExperiment object from a YAML file.
- Parameters:
file (str | pathlib.Path)
- Return type:
- firecrown.likelihood.factories.build_two_point_likelihood(build_parameters)[source]
Build a likelihood object for two-point statistics from a SACC file.
This function creates a likelihood object for two-point statistics using a SACC file and a set of statistic factories. The user must provide the SACC file and specify which statistic factories to use. The likelihood object is created by combining the SACC file with the specified statistic factories.
- Parameters:
build_parameters (firecrown.likelihood.likelihood.NamedParameters) – A NamedParameters object containing the following parameters: - sacc_file: The SACC file containing the data. - statistic_factories: A YAML file containing the statistic factories to use.
- Return type:
tuple[firecrown.likelihood.likelihood.Likelihood, firecrown.modeling_tools.ModelingTools]