PerturberStepFactory#
- class nrtk.impls.perturb_image_factory.PerturberStepFactory(*, perturber: type[PerturbImage], theta_key: str, start: float, stop: float, step: float = 1.0, to_int: bool = False, perturber_kwargs: dict[str, Any] | None = None)#
Simple PerturbImageFactory implementation to step through the given range of values.
- perturber (type[PerturbImage]):
perturber type to produce
- theta_key (str):
peturber parameter to modify
- start (float):
initial value of range (inclusive)
- end (float):
end value of range (exclusive)
- step (float):
step value between instances
- to_int (bool):
determines wheter to cast theta_value to a int or float
Methods
from_configInstantiates a PerturbImageFactory from a configuration dictionary.
Returns the configuration of the factory 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, start: float, stop: float, step: float = 1.0, to_int: bool = False, perturber_kwargs: dict[str, Any] | None = None) None#
Initialize the factory to produce PerturbImage instances of the given type.
Initialize the factory to produce PerturbImage instances of the given type, varying the given
theta_keyparameter from start to stop with given step.- Args:
- perturber:
Python implementation type of the PerturbImage interface to produce.
- theta_key:
Perturber parameter to vary between instances.
- start:
Initial value of desired range (inclusive).
- stop:
Final value of desired range (exclusive).
- step:
Step value between instances.
- to_int:
Boolean variable determining whether the thetas are cast as ints or floats. 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 the configuration of the factory instance.
- property thetas: Sequence[float] | Sequence[int]#
Get the sequence of theta values this factory will iterate over.