PerturberOneStepFactory#
- class nrtk.impls.perturb_image_factory.PerturberOneStepFactory(*, perturber: type[PerturbImage], theta_key: str, theta_value: float, to_int: bool = False, perturber_kwargs: dict[str, Any] | None = None)#
Simple PerturbImageFactory implementation to return a factory with one perturber.
- Attributes:
- perturber (type[PerturbImage]):
perturber type to produce
- theta_key (str):
peturber parameter to modify
- theta_value (float):
value to set theta_key to
- to_int (bool):
determines wheter to cast theta_value to a int or float
Methods
from_configInstantiates a PerturbImageFactory from a configuration dictionary.
Returns a configuration dictionary for the PerturberOneStepFactory instance.
get_default_configReturns the default configuration for the PerturbImageFactory.
get_implsDiscover plugins, skipping any entrypoints that fail to load.
is_usableCheck whether this class is available for use.
- __init__(*, perturber: type[PerturbImage], theta_key: str, theta_value: float, to_int: bool = False, perturber_kwargs: dict[str, Any] | None = None) None#
Initialize the factory to produce an instance of PerturbImage for the given type.
Initialize the factory to produce an instance of PerturbImage for the given type, given the
theta_keyand thetheta_valueparameters.- Args:
- perturber:
Python implementation type of the PerturbImage interface to produce.
- theta_key:
Perturber parameter to vary between instances.
- theta_value:
Initial and only value of
theta_key.- to_int:
Boolean variable determining whether the theta is cast as int or float. Defaults to False.
- perturber_kwargs:
Default kwargs to be used by the perturber. Defaults to {}.
- Raises:
- TypeError:
Given a perturber instance instead of type.
- get_config() dict[str, Any]#
Returns a configuration dictionary for the PerturberOneStepFactory instance.