PerturberLinspaceFactory#
- class nrtk.impls.perturb_image_factory.PerturberLinspaceFactory(*, perturber: type[PerturbImage], theta_key: str, start: float, stop: float, num: int = 1, endpoint: bool = True, perturber_kwargs: dict[str, Any] | None = None)#
Simple PerturbImageFactory implementation to step through the given range of values.
- Attributes:
- 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)
- num (int):
number of values between start and end
- endpoint (bool):
Decides if stop is included.
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, num: int = 1, endpoint: bool = True, 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 num.- 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 (inclusive).
- num:
Number of instances to generate.
- endpoint:
Decides if stop is included.
- 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]#
Use linspace to generate the desired range of values.