firecrown.ccl_factory
Deprecated: Use firecrown.modeling_tools instead.
This module is deprecated and will be removed in a future version. All functionality has been moved to firecrown.modeling_tools.
Attributes
Classes
Type representing cosmological background quantities. |
|
Extra parameters for CAMB. |
|
Arguments for the CCLCalculator. |
|
This class defines the CCL instance creation mode. |
|
Factory class for creating instances of the pyccl.Cosmology class. |
|
This class defines the transfer function to use in PURE_CCL_MODE. |
|
Params to control CCL spline interpolation. |
|
Model for the mu-sigma modified gravity model. |
|
This class defines the two-point correlation space. |
Package Contents
- class firecrown.ccl_factory.Background
Bases:
TypedDictType representing cosmological background quantities.
Contains arrays for scale factor, comoving distance, and Hubble parameter ratio.
- a: numpy.typing.NDArray[numpy.float64]
- chi: numpy.typing.NDArray[numpy.float64]
- h_over_h0: numpy.typing.NDArray[numpy.float64]
- class firecrown.ccl_factory.CAMBExtraParams(/, **data)
Bases:
pydantic.BaseModelExtra parameters for CAMB.
- Parameters:
data (Any)
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- HMCode_A_baryon: Annotated[float | None, Field(frozen=False)] = None
- HMCode_eta_baryon: Annotated[float | None, Field(frozen=False)] = None
- HMCode_logT_AGN: Annotated[float | None, Field(frozen=False)] = None
- halofit_version: Annotated[str | None, Field(frozen=True)] = None
- kmax: Annotated[float | None, Field(frozen=True)] = None
- lmax: Annotated[int | None, Field(frozen=True)] = None
- dark_energy_model: Annotated[str | None, Field(frozen=True)] = None
- model_post_init(_, /)
Validate that HMCode parameters are compatible with halofit_version.
- Parameters:
_ (object)
- Return type:
None
- get_dict()
Return the extra parameters as a dictionary.
- Return type:
dict[str, object]
- get_hm_sampling_defaults()
Return the HMCode parameters CAMB expects for this halofit version.
The keys are the parameter names spelled exactly as CAMB expects them, and the values are the CAMB defaults for those parameters. The mapping is empty when the halofit version has no HMCode parameters.
- Returns:
a mapping from HMCode parameter name to its CAMB default value
- Return type:
dict[str, float]
- set_hm_parameters(values)
Set the HMCode parameters to the given values.
The names in values must be exactly those returned by
get_hm_sampling_defaults(); the case-insensitive lookup of names coming from a sampler is the caller’s responsibility.- Parameters:
values (collections.abc.Mapping[str, float]) – a mapping from HMCode parameter name to its new value
- Raises:
ValueError – if values contains a name not expected for the configured halofit version
- Return type:
None
- is_mead2020_feedback()
Return True if the halofit_version is mead2020_feedback.
- Return type:
bool
- is_mead()
Return True if the halofit_version is mead, mead2015, or mead2016.
CAMB treats None as mead.
- Returns:
True if the halofit_version is mead, mead2015, or mead2016
- Return type:
bool
- class firecrown.ccl_factory.CCLCalculatorArgs
Bases:
TypedDictArguments for the CCLCalculator.
Contains background cosmology and optional linear/nonlinear power spectra.
- background: Background
- class firecrown.ccl_factory.CCLCreationMode
Bases:
enum.StrEnumThis class defines the CCL instance creation mode.
The DEFAULT mode represents the current CCL behavior. It will use CCL’s calculator mode if prepare is called with a CCLCalculatorArgs object. Otherwise, it will use the default CCL mode.
The MU_SIGMA_ISITGR mode enables the mu-sigma modified gravity model with the ISiTGR transfer function, it is not compatible with the Calculator mode.
The PURE_CCL_MODE mode will create a CCL instance with the default parameters. It is not compatible with the Calculator mode.
- DEFAULT
- MU_SIGMA_ISITGR
- PURE_CCL_MODE
- classmethod __get_pydantic_core_schema__(_source_type, _handler)
Get the Pydantic core schema for the CCLCreationMode class.
- Parameters:
_source_type (Any)
_handler (Any)
- Return type:
pydantic_core.core_schema.CoreSchema
- class firecrown.ccl_factory.CCLFactory(**data)
Bases:
firecrown.updatable.Updatable,pydantic.BaseModelFactory class for creating instances of the pyccl.Cosmology class.
- Parameters:
data (Any)
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- require_nonlinear_pk: Annotated[bool, Field(frozen=True)] = False
- amplitude_parameter: Annotated[firecrown.modeling_tools._ccl_enums.PoweSpecAmplitudeParameter, Field(frozen=True)]
- mass_split: Annotated[pyccl.neutrinos.NeutrinoMassSplits, BeforeValidator(_validate_neutrino_mass_splits), Field(frozen=True)]
- num_neutrino_masses: Annotated[int | None, Field(frozen=True, ge=1)] = None
- creation_mode: Annotated[firecrown.modeling_tools._ccl_enums.CCLCreationMode, Field(frozen=True)]
- pure_ccl_transfer_function: Annotated[firecrown.modeling_tools._ccl_enums.CCLPureModeTransferFunction, Field(frozen=True)]
- use_camb_hm_sampling: Annotated[bool, Field(frozen=True)] = False
- allow_multiple_camb_instances: Annotated[bool, Field(frozen=True)] = False
- camb_extra_params: Annotated[firecrown.modeling_tools._ccl_models.CAMBExtraParams | None, Field(frozen=True)] = None
- ccl_spline_params: Annotated[firecrown.modeling_tools._ccl_models.CCLSplineParams | None, Field(frozen=True)] = None
- Omega_c
- Omega_b
- h
- n_s
- Omega_k
- Neff
- m_nu: float | None
- w0
- wa
- T_CMB
- using_camb()
Return True if the CCLFactory is using CAMB for the matter power spectrum.
- Returns:
True if the CCLFactory is using CAMB for the matter power spectrum.
- Return type:
bool
- serialize_model(nxt, _)
Serialize the CCLFactory object.
- Parameters:
nxt (pydantic.SerializerFunctionWrapHandler)
_ (pydantic.SerializationInfo)
- Return type:
dict[str, Any]
- classmethod serialize_mass_split(value)
Serialize the mass split parameter.
- Parameters:
value (pyccl.neutrinos.NeutrinoMassSplits)
- Return type:
str
- model_post_init(_, /)
Initialize the WeakLensingFactory object.
- Parameters:
_ (object)
- Return type:
None
- create(calculator_args=None)
Create a pyccl.Cosmology object.
- Parameters:
calculator_args (firecrown.modeling_tools._ccl_types.CCLCalculatorArgs | None)
- Return type:
pyccl.Cosmology
- get()
Return the pyccl.Cosmology object.
- Return type:
pyccl.Cosmology
- class firecrown.ccl_factory.CCLPureModeTransferFunction
Bases:
enum.StrEnumThis class defines the transfer function to use in PURE_CCL_MODE.
The options are those available in CCL for the transfer_function argument. See https://ccl.readthedocs.io/en/latest/api/pyccl.cosmology.html
- BBKS
- BOLTZMANN_CAMB
- BOLTZMANN_CLASS
- EISENSTEIN_HU
- EISENSTEIN_HU_NOWIGGLES
- classmethod __get_pydantic_core_schema__(_source_type, _handler)
Get the Pydantic core schema for the CCLPureModeTransferFunction class.
- Parameters:
_source_type (Any)
_handler (Any)
- Return type:
pydantic_core.core_schema.CoreSchema
- class firecrown.ccl_factory.CCLSplineParams(/, **data)
Bases:
pydantic.BaseModelParams to control CCL spline interpolation.
- Parameters:
data (Any)
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- a_spline_na: Annotated[int | None, Field(frozen=True)] = None
- a_spline_min: Annotated[float | None, Field(frozen=True)] = None
- a_spline_minlog_pk: Annotated[float | None, Field(frozen=True)] = None
- a_spline_min_pk: Annotated[float | None, Field(frozen=True)] = None
- a_spline_minlog_sm: Annotated[float | None, Field(frozen=True)] = None
- a_spline_min_sm: Annotated[float | None, Field(frozen=True)] = None
- a_spline_minlog: Annotated[float | None, Field(frozen=True)] = None
- a_spline_nlog: Annotated[int | None, Field(frozen=True)] = None
- logm_spline_delta: Annotated[float | None, Field(frozen=True)] = None
- logm_spline_nm: Annotated[int | None, Field(frozen=True)] = None
- logm_spline_min: Annotated[float | None, Field(frozen=True)] = None
- logm_spline_max: Annotated[float | None, Field(frozen=True)] = None
- a_spline_na_sm: Annotated[int | None, Field(frozen=True)] = None
- a_spline_nlog_sm: Annotated[int | None, Field(frozen=True)] = None
- a_spline_na_pk: Annotated[int | None, Field(frozen=True)] = None
- a_spline_nlog_pk: Annotated[int | None, Field(frozen=True)] = None
- k_max_spline: Annotated[float | None, Field(frozen=True)] = None
- k_max: Annotated[float | None, Field(frozen=True)] = None
- k_min: Annotated[float | None, Field(frozen=True)] = None
- dlogk_integration: Annotated[float | None, Field(frozen=True)] = None
- dchi_integration: Annotated[float | None, Field(frozen=True)] = None
- n_k: Annotated[int | None, Field(frozen=True)] = None
- n_k_3dcor: Annotated[int | None, Field(frozen=True)] = None
- ell_min_corr: Annotated[float | None, Field(frozen=True)] = None
- ell_max_corr: Annotated[float | None, Field(frozen=True)] = None
- n_ell_corr: Annotated[int | None, Field(frozen=True)] = None
- check_spline_params()
Check that the spline parameters are valid.
- Return type:
- __enter__()
Enter the context manager.
This method saves the current CCL global spline parameters, updates them with the values from this CCLSplineParams instance, and returns the instance itself. This allows for temporary modification of CCL spline parameters using a with statement.
- Returns:
The current instance with updated spline parameters.
- Return type:
- __exit__(exc_type, exc_value, traceback)
Exit the context manager.
This method resets the CCL global spline parameters to their original values, as saved when entering the context manager. It ensures that any temporary modifications made to the CCL spline parameters within a with statement are reverted upon exit.
- Parameters:
exc_type (type[BaseException] | None) – The exception type, if an exception occurred.
exc_value (BaseException | None) – The exception value, if an exception occurred.
traceback (types.TracebackType | None) – The traceback object, if an exception occurred.
- Return type:
None
- class firecrown.ccl_factory.MuSigmaModel
Bases:
firecrown.updatable.UpdatableModel for the mu-sigma modified gravity model.
- mu
- sigma
- c1
- c2
- lambda0
- create()
Create a pyccl.modified_gravity.MuSigmaMG object.
- Return type:
pyccl.modified_gravity.MuSigmaMG
- firecrown.ccl_factory.PowerSpec
- class firecrown.ccl_factory.PoweSpecAmplitudeParameter
Bases:
firecrown.utils.YAMLSerializable,enum.StrEnumThis 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.
- AS
- SIGMA8
- classmethod __get_pydantic_core_schema__(_source_type, _handler)
Get the Pydantic core schema for the PoweSpecAmplitudeParameter class.
- Parameters:
_source_type (Any)
_handler (Any)
- Return type:
pydantic_core.core_schema.CoreSchema