leaspy.models.noise_models.noise_model_factory

noise_model_factory(noise_model: str | BaseNoiseModel | Dict[str, Any], **kws) BaseNoiseModel

Factory for noise models.

Parameters:
noise_modelstr or BaseNoiseModel or dict [ 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.

Returns:
BaseNoiseModel

The desired noise model.

Raises:
LeaspyModelInputError

If noise_model is not supported.