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_config

Instantiates a PerturbImageFactory from a configuration dictionary.

get_config

Returns the configuration of the factory instance.

get_default_config

Returns the default configuration for the PerturbImageFactory.

get_impls

Discover plugins, skipping any entrypoints that fail to load.

is_usable

Check 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_key parameter 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.