eradiate.experiments.CanopyExperiment#

class eradiate.experiments.CanopyExperiment(measures=_Nothing.NOTHING, illumination=_Nothing.NOTHING, canopy=None, padding=0, surface=_Nothing.NOTHING, integrator=_Nothing.NOTHING)[source]#

Bases: eradiate.experiments._core.EarthObservationExperiment

Simulate radiation in a scene with an explicit canopy and no atmosphere. This experiment assumes that the surface is plane and accounts for ground unit cell padding.

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.

  • illumination (DirectionalIllumination or ConstantIllumination or dict, default: DirectionalIllumination()) – Illumination specification. This parameter can be specified as a dictionary which will be interpreted by illumination_factory.

  • canopy (Canopy or dict or None, default: None) – Canopy specification. This parameter can be specified as a dictionary which will be interpreted by biosphere_factory.

  • padding (int, default: 0) – Padding level. The scene will be padded with copies to account for adjacency effects. This, in practice, has effects similar to making the scene periodic.A value of 0 will yield only the defined scene. A value of 1 will add one copy in every direction, yielding a 3×3 patch. A value of 2 will yield a 5×5 patch, etc. The optimal padding level depends on the scene.

  • surface (BasicSurface or BSDF or dict, optional, default: BasicSurface(bsdf=LambertianBSDF())) – Surface specification. If set to None, no surface will be added. This parameter can be specified as a dictionary which will be interpreted by surface_factory and bsdf_factory. If relevant, the surface size will be adjusted automatically upon kernel. dictionary generation.

  • integrator (Integrator or dict, default: PathIntegrator()) – Monte Carlo integration algorithm specification. This parameter can be specified as a dictionary which will be interpreted by integrator_factory.

Fields

Notes

A post-initialisation step will constrain the measure setup if a distant measure is used and no target is defined:

  • if a canopy is defined, the target will be set to the top of the canopy unit cell (i.e. without its padding);

  • if no canopy is defined, the target will be set to [0, 0, 0].

classmethod from_dict(d)#

Instantiate from a dictionary. The default implementation raises an exception.

Parameters

d (dict) – Dictionary to be converted to an Experiment.

Returns

Experiment

kernel_dict(ctx)[source]#

Return a dictionary suitable for kernel scene configuration.

Parameters

ctx (KernelDictContext) – A context data structure containing parameters relevant for kernel dictionary generation.

Returns

KernelDict – Kernel dictionary which can be loaded as a Mitsuba object.

kernel_dicts(measure)#

A generator which returns kernel dictionaries (and the associated context) relevant to a given measure.

Parameters

measure (Measure or int) – Measure for which kernel dictionaries are to be generated. Alternatively, the index in the self.measure list can be passed.

Yields
pipeline(*measures)#

Request post-processing pipeline for a given measure.

Parameters

*measures (Measure or int) – One or several measures for which to get a post-processing pipeline. If integer values are passed, they are used to query the measure list.

Returns

pipelines (Pipeline or tuple of Pipeline) – If a single measure is passed, a single Pipeline instance is returned; if multiple measures are passed, a tuple of pipelines is returned.

postprocess(*measures, pipeline_kwargs=None)#

Post-process raw results stored in a measure’s results field. This requires a successful execution of process(). Post-processed results are stored in self.results.

Parameters
  • *measures (Measure or int) – One or several measures for which to perform post-processing. Alternatively, indexes in the measure array can be passed. If no value is passed, all measures are processed.

  • pipeline_kwargs (dict, optional) – A dictionary of pipeline keyword arguments forwarded to Pipeline.transform().

Raises

ValueError – If measure.results is None, i.e. if process() has not been successfully run.

See also

process()

process(*measures, seed_state=None)#

Run simulation on the configured scene. Raw results yielded by the runner function are stored in measure.results.

Parameters
  • *measures (Measure or int) – One or several measures for which to compute radiative transfer. Alternatively, indexes in the measure array can be passed. If no value is passed, all measures are processed.

  • 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.

See also

postprocess()

property integrator#

Integrator used to solve the radiative transfer equation.

Type

Integrator

property results#

Post-processed simulation results.

Returns

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