leaspy.models.noise_models.factory module
Defines the noise model factory.
- export_noise_model(noise_model: BaseNoiseModel) Dict[str, Any]
Serialize a given
BaseNoiseModel
as adict
.- Parameters:
- noise_model
BaseNoiseModel
The noise model to serialize.
- noise_model
- Returns:
- KwargsType
The noise model serialized as a
dict
.
- noise_model_factory(noise_model: str | BaseNoiseModel | Dict[str, Any], **kws) BaseNoiseModel
Factory for noise models.
- Parameters:
- noise_model
str
orBaseNoiseModel
ordict
[str
, …] If an instance of a subclass of
BaseNoiseModel
, returns the instance.If a string, then returns a new instance of the appropriate class (with optional parameters kws).
If a dictionary, it must contain the ‘name’ key and other initialization parameters.
- **kws
Optional parameters for initializing the requested noise-model when a string.
- noise_model
- Returns:
BaseNoiseModel
The desired noise model.
- Raises:
LeaspyModelInputError
If noise_model is not supported.