eradiate#

The Eradiate radiative transfer simulation software package.

Configuration#

eradiate.config#

Global configuration for Eradiate.

This class, instantiated once as the eradiate.config attribute, contains global configuration parameters for Eradiate. It is initialised using environment variables as defaults.

Mode management#

eradiate.mode(*args, **kwargs)[source]#

Get current operational mode.

Returns

Mode or None – Current operational mode.

eradiate.modes(*args, **kwargs)[source]#

Get list of registered operational modes.

Returns

dict – List of registered operational modes

eradiate.set_mode(*args, **kwargs)[source]#

Set Eradiate’s operational mode.

This function sets and configures Eradiate’s operational mode. Eradiate’s modes map to Mitsuba’s variants and are used to make contextual decisions when relevant during the translation of a scene to its kernel format.

Valid mode IDs

  • mono (monochromatic mode, single precision)

  • mono_double (monochromatic mode, double-precision)

  • ckd (CKD mode, single precision)

  • ckd_double (CKD mode, double-precision)

  • none (no mode selected)

Parameters

mode_id (str) – Mode to be selected (see list below).

Raises

ValueErrormode_id does not match any of the known mode identifiers.

eradiate.supported_mode(*args, **kwargs)[source]#

Check whether the current mode has specific flags. If not, raise.

Parameters

flags (ModeFlags) – Flags the current mode is expected to have.

Raises

.UnsupportedModeError – Current mode does not have the requested flags.

eradiate.unsupported_mode(*args, **kwargs)[source]#

Check whether the current mode has specific flags. If so, raise.

Parameters

flags (ModeFlags) – Flags the current mode is expected not to have.

Raises

.UnsupportedModeError – Current mode has the requested flags.

eradiate.Mode(*args, **kwargs)[source]#

Data structure describing Eradiate’s operational mode and associated ancillary data.

Important

Instances are immutable.

Parameters
  • id (str) – Mode identifier.

  • flags (ModeFlags) – Mode flags.

  • spectral_coord_label (str) – Mode spectral coordinate label.

Fields
  • id (str) – Mode identifier.

  • flags (ModeFlags) – Mode flags.

  • spectral_coord_label (str) – Mode spectral coordinate label.

eradiate.ModeFlags(value, names=None, *, module=None, qualname=None, type=None, start=1)[source]#

Flags defining Eradiate mode features.

Unit management#

eradiate.unit_registry(input_string: str, case_sensitive: Optional[bool] = None, use_decimal: bool = False, **values) Quantity#

The unit registry stores the definitions and relationships between units.

Parameters
  • filename – path of the units definition file to load or line-iterable object. Empty to load the default definition file. None to leave the UnitRegistry empty.

  • force_ndarray (bool) – convert any input, scalar or not to a numpy.ndarray.

  • force_ndarray_like (bool) – convert all inputs other than duck arrays to a numpy.ndarray.

  • default_as_delta – In the context of a multiplication of units, interpret non-multiplicative units as their delta counterparts.

  • autoconvert_offset_to_baseunit – If True converts offset units in quantities are converted to their base units in multiplicative context. If False no conversion happens.

  • on_redefinition (str) – action to take in case a unit is redefined. ‘warn’, ‘raise’, ‘ignore’

  • auto_reduce_dimensions – If True, reduce dimensionality on appropriate operations.

  • preprocessors – list of callables which are iteratively ran on any input expression or unit string

  • fmt_locale – locale identifier string, used in format_babel. Default to None

  • case_sensitive (bool, optional) – Control default case sensitivity of unit parsing. (Default: True)

  • cache_folder (str or pathlib.Path or None, optional) – Specify the folder in which cache files are saved and loaded from. If None, the cache is disabled. (default)

eradiate.unit_context_config#

An overridable registry of UnitGenerator objects.

This class maintains a registry of UnitGenerator instances. Stored UnitGenerator objects can be conveniently overridden using the override() context manager.

Attributes / constructor arguments
  • registry (Dict[Hashable, UnitGenerator]) – Unit generator registry. Keys can be any hashable type, but str or Enum are recommended. Defaults to an empty dictionary.

    Note

    The initialisation sequence will make repeated calls to register() and will consequently apply the same key and value conversion rules.

  • interpret_str (bool) – If True, attempt string-to-units interpretation when specifying unit generators as str.

  • ureg (Optional[UnitRegistry]) – Unit registry used for string-to-units interpretation. If None, the default registry is used (see get_unit_registry()).

  • key_converter (Callable) – Converter used for keys. Defaults to identity().

Changed in version 1.1.0: Added ureg.

eradiate.unit_context_kernel#

An overridable registry of UnitGenerator objects.

This class maintains a registry of UnitGenerator instances. Stored UnitGenerator objects can be conveniently overridden using the override() context manager.

Attributes / constructor arguments
  • registry (Dict[Hashable, UnitGenerator]) – Unit generator registry. Keys can be any hashable type, but str or Enum are recommended. Defaults to an empty dictionary.

    Note

    The initialisation sequence will make repeated calls to register() and will consequently apply the same key and value conversion rules.

  • interpret_str (bool) – If True, attempt string-to-units interpretation when specifying unit generators as str.

  • ureg (Optional[UnitRegistry]) – Unit registry used for string-to-units interpretation. If None, the default registry is used (see get_unit_registry()).

  • key_converter (Callable) – Converter used for keys. Defaults to identity().

Changed in version 1.1.0: Added ureg.

Metadata#

eradiate.__version__#

Eradiate version string.

Convenience aliases#

eradiate.run(*args, **kwargs)[source]#

Run an Eradiate experiment, including the Monte Carlo simulation and data post-processing.

Parameters
  • exp (Experiment) – The experiment to be run.

  • measure (Measure or int, optional) – The measure to be simulated.

  • seed_state (SeedState, optional) – A RNG seed state used to generate the seeds used by Mitsuba’s random number generator. By default, Eradiate’s root_seed_state is used.

Returns

result (Dataset) – Experiment result data.