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

DataSourceSacc

Model for the data source in a likelihood configuration.

TwoPointExperiment

Model for the two-point experiment in a likelihood configuration.

Functions

ensure_path(file)

Ensure the file path is a Path object.

build_two_point_likelihood(build_parameters)

Build a likelihood object for two-point statistics from a SACC file.

Module Contents

class firecrown.likelihood.factories.DataSourceSacc(/, **data)[source]

Bases: pydantic.BaseModel

Inheritance diagram of firecrown.likelihood.factories.DataSourceSacc

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

get_filepath()[source]

Return the filename of the data source.

Raises a FileNotFoundError if the file does not exist. :return: The filename

Return type:

pathlib.Path

get_sacc_data()[source]

Load the SACC data file.

Return type:

sacc.Sacc

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

Inheritance diagram of firecrown.likelihood.factories.TwoPointExperiment

Model for the two-point experiment in a likelihood configuration.

Parameters:

data (Any)

two_point_factory: firecrown.likelihood.two_point.TwoPointFactory
data_source: DataSourceSacc
ccl_factory: firecrown.ccl_factory.CCLFactory | None = None
model_post_init(_, /)[source]

Initialize the TwoPointExperiment object.

Return type:

None

classmethod load_from_yaml(file)[source]

Load a TwoPointExperiment object from a YAML file.

Parameters:

file (str | pathlib.Path)

Return type:

TwoPointExperiment

make_likelihood()[source]

Create a likelihood object for two-point statistics from a SACC file.

Return type:

firecrown.likelihood.likelihood.Likelihood

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]