nessai.reparameterisations.utils#
Utilities for handling the reparameterisations.
Exceptions#
Exception for reparameterisation errors |
Classes#
Dataclass to store the reparameterisation class and keyword arguments |
|
Normalised representation of a reparameterisation config spec. |
|
Dictionary of reparameterisations |
Functions#
|
Function to get a reparameterisation class from a name |
Normalise a reparameterisation config entry into a list of spec configs. |
|
|
Build a normalised spec from a single config entry. |
|
Parse user reparameterisation config into ordered specs. |
|
Resolve parameter names or regex patterns for reparameterisations. |
Module Contents#
- exception nessai.reparameterisations.utils.ReparameterisationError#
Bases:
RuntimeErrorException for reparameterisation errors
- class nessai.reparameterisations.utils.KnownReparameterisation#
Dataclass to store the reparameterisation class and keyword arguments
- class nessai.reparameterisations.utils.ReparameterisationSpec#
Normalised representation of a reparameterisation config spec.
- class nessai.reparameterisations.utils.ReparameterisationDict#
Bases:
dictDictionary of reparameterisations
This dictionary is used to store the known reparameterisations and provides a method to add new reparameterisations.
- add_reparameterisation(name, class_fn, keyword_arguments=None)#
Add a new reparameterisation to the dictionary
- Parameters:
- namestr
Name of the reparameterisation.
- class_fnReparameterisation
Reparameterisation class.
- keyword_argumentsdict, optional
Keyword arguments for the reparameterisation.
- nessai.reparameterisations.utils.get_reparameterisation(reparameterisation, defaults=None)#
Function to get a reparameterisation class from a name
- Parameters:
- reparameterisationstr,
nessai.reparameterisations.Reparameterisation Name of the reparameterisations to return or a class that inherits from
Reparameterisation- defaultsdict, optional
Dictionary of known reparameterisations that overrides the defaults.
- reparameterisationstr,
- Returns:
nessai.reparameteristaions.ReparameterisationReparameterisation class.
- dict
Keyword arguments for the specific reparameterisation.
- nessai.reparameterisations.utils.normalise_reparameterisation_spec(key: str, cfg: str | dict | list | None, model_names: list[str]) list[dict] | list[str] | list[None]#
Normalise a reparameterisation config entry into a list of spec configs.
- Parameters:
- keystr
The key of the config entry.
- cfgstr, dict, list, or None
The config entry to normalise.
- model_nameslist of str
The names of the model parameters.
- nessai.reparameterisations.utils.build_reparameterisation_spec(key, spec_cfg, spec_index, model_names)#
Build a normalised spec from a single config entry.
- nessai.reparameterisations.utils.parse_reparameterisations(reparameterisations, model_names, class_name=None)#
Parse user reparameterisation config into ordered specs.
- nessai.reparameterisations.utils.resolve_reparameterisation_parameters(parameters, available_parameters)#
Resolve parameter names or regex patterns for reparameterisations.