eradiate.experiments.Experiment

class eradiate.experiments.Experiment(measures=NOTHING, integrator=AUTO, results=NOTHING, background_spectral_grid=AUTO, ckd_quad_config=NOTHING)[source]

Bases: ABC

Abstract base class for all Eradiate experiments. An experiment consists of a high-level scene specification parametrized by natural user input, a processing and post-processing pipeline, and a result storage data structure.

Parameters:
  • measures (list of Measure or list of dict or Measure or dict, default: MultiDistantMeasure()) – List of measure specifications. The passed list may contain dictionaries, which will be interpreted by measure_factory. Optionally, a single Measure or dictionary specification may be passed and will automatically be wrapped into a list.

  • integrator (Integrator or dict or AUTO, default: AUTO) – Monte Carlo integration algorithm specification. This parameter can be specified as a dictionary which will be interpreted by integrator_factory.The integrator defaults to AUTO, which will choose the appropriate integrator depending on the experiment’s configuration.

  • background_spectral_grid (SpectralGrid or AUTO, default: AUTO) – Background spectral grid. If the value is AUTO, the background spectral grid is automatically generated depending on the active mode and internal experiment constraints. Otherwise, the value must be convertible to a SpectralGrid instance.

  • ckd_quad_config (CKDQuadConfig or dict) – CKD quadrature rule generation configuration.

Fields:
  • measures (MeasureRegistry) – List of measure specifications.

  • integrator (Integrator or AUTO) – Monte Carlo integration algorithm specification.

  • ckd_quad_config (CKDQuadConfig) – CKD quadrature rule generation configuration.

clear()[source]

Clear previous experiment results and reset internal state.

abstract context_init()[source]

Return a single context used for scene initialization.

Returns:

KernelContext

abstract contexts(measures=None)[source]

Return a list of contexts used for processing.

Parameters:

measures (int or list of int, optional) – A list of the indexes of the measures to account for when emitting kernel contexts. If unset, all measures are accounted for.

Returns:

list of KernelContext

abstract init(drop_parameters=True)[source]

Generate kernel dictionary and initialize Mitsuba scene.

Parameters:

drop_parameters (bool) – If True, drop Mitsuba scene parameters that are not used (i.e. that do not have an updater associated).

abstract pipeline(measure)[source]

Return the post-processing pipeline for a given measure.

Parameters:

measure (Measure or int) – Measure for which the pipeline is generated.

Returns:

Pipeline

abstract postprocess(measures=None)[source]

Post-process raw results and store them in results.

Parameters:

measures (int or list of int, optional) – Indices of the measures that will be processed. By default, all measures are processed.

abstract process(measures=None, spp=0, seed_state=None)[source]

Run simulation and collect raw results.

Parameters:
  • measures (int or list of int, optional) – Indices of the measures that will be processed. By default, all measures are processed.

  • spp (int, optional) – Sample count. If set to 0, the value set in the original scene definition takes precedence.

  • seed_state (SeedState, optional) – Seed state used to generate seeds to initialize Mitsuba’s RNG at every iteration of the parametric loop. If unset, Eradiate’s root seed state is used.

property ckd_quads

A dictionary mapping measure index to the associated CKD quadrature rule (if relevant).

property results

Post-processed simulation results.

Returns:

dict[str, Dataset] – Dictionary mapping measure IDs to xarray datasets.

property spectral_grids

A dictionary mapping measure index to the associated spectral grid.