eradiate.scenes.atmosphere.ParticleOTComponent#

class eradiate.scenes.atmosphere.ParticleOTComponent(*args, dataset=None, **kwargs)#

Bases: ParticleComponent

Particle component parametrized by an optical thickness value [particle_ot].

This component represents a one-dimensional medium parametrized by a vertical extent (bottom and top levels) and a total layer optical thickness (tau_ref). The optical thickness is distributed along the vertical dimension according to a density distribution (distribution). The radiative properties of the medium are specified by a ParticleProperties instance (particle_properties).

Parameters:
  • id (str, optional, default: "atmosphere") – Identifier of the current scene element.

  • geometry (SceneGeometry or dict or str, optional, default: "plane_parallel") – Parameters defining the basic geometry of the scene. Note if the atmosphere is used in a simulation, the experiment has all control over the atmosphere’s geometry and is going to set it. Therefore, in such a case it is best to define the geometry at the experiment level. When the atmosphere is used standalone, care must be taken to ensure that the geometry is consistent with the vertical extent of the atmosphere.

  • use_rrt (bool) – If set to true, prescribe the use of residual ratio tracking to estimate transmittance for integrators that allow it. Otherwise, falls back to ratio tracking. Residual ratio tracking generally reduces variance and can improve performance for high optical thickness. Ignored on components of a HeterogeneousAtmosphere; set it on the parent instead.

  • ddis_threshold (float) – Specifies the probability to importance sample the phase using the emitter as incident direction. Set negative to deactivate. Ignored on components of a HeterogeneousAtmosphere; set it on the parent instead.

  • scale (float, optional) – If set, the extinction coefficient is scaled by the corresponding amount during computation.

  • force_majorant (bool, optional) – If set to true, uses heterogeneous medium, which is compatible with all integrators except PiecewiseVolpathIntegrator. Otherwise, uses a piecewise medium which is compatible with PiecewiseVolPathIntegrator and other integrators. This setting only affects PlaneParallelGeometry, other geometries use heterogeneous mediums. Ignored on components of a HeterogeneousAtmosphere; set it on the parent instead.

  • extremum_resolution (tuple[int, int, int], default: (1,1,1)) – [EXPERIMENTAL] Resolution of the extremum structure. Applies to both plane parallel and spherical shell geometries but the latter only accepts a resolution greater than one along its radial dimension (first dimension). Also note than in plane parallel the dimensions are [x, y, z] and in spherical shell [r, theta, phi]. The default value (1, 1, 1) falls back to a global majorant. In plane parallel, set to (0,0,0) to trigger an adaptive search of the optimal resolution. Note that this is an expensive search that triggers at spectral update. Ignored by piecewise media (plane parallel with a 1D grid and force_majorant unset). Ignored on components of a HeterogeneousAtmosphere; set it on the parent instead.

  • has_absorption (bool, default: True) – Absorption bypass switch. If True, the absorption coefficient is computed. Else, the absorption coefficient is not computed and instead set to zero.

  • has_scattering (bool, default: True) – Scattering bypass switch. If True, the scattering coefficient is computed. Else, the scattering coefficient is not computed and instead set to zero.

  • force_polarized_phase (bool, default: False) – Force the use of a polarized phase function implementation, even when no polarization information is available.

  • bottom (float or quantity, default: 0 km) – Bottom altitude of the particle component. May be a scalar (the same altitude everywhere) or an (n_x, n_y) array matching the scene geometry’s horizontal grid shape, for a bottom altitude that varies spatially.

    Unit-enabled field (default: ucc[length])

  • top (float or quantity, default: 1 km) – Top altitude of the particle component. May be a scalar (the same altitude everywhere) or an (n_x, n_y) array matching the scene geometry’s horizontal grid shape, for a top altitude that varies spatially.

    Unit-enabled field (default: ucc[length]).

  • distribution (ParticleDistribution or dict or {"uniform", "gaussian", "exponential"}, optional, default: "uniform") – Particle distribution in the Z dimension of the coords grid. Simple defaults can be set using a string: "uniform" (resp. "gaussian", "exponential") is converted to UniformParticleDistribution() (resp. GaussianParticleDistribution(), ExponentialParticleDistribution()).

  • w_ref (quantity or float, default: 550.0 nm) – Reference wavelength at which the extinction optical thickness is specified. To minimize the uncertainty on the computed extinction coefficient, it is recommended that this wavelength is included in the provided radiative property dataset.

    Unit-enabled field (default: ucc[‘wavelength’]).

  • tau_ref (quantity or float, default: 0.2) – Extinction optical thickness at the reference wavelength. May be a scalar (the same optical thickness everywhere) or an (n_x, n_y) array matching the scene geometry’s horizontal grid shape, for an optical thickness that varies spatially.

    Unit-enabled field (default: ucc[dimensionless]).

  • particle_properties (ParticleProperties or Dataset or path-like or str, default: "govaerts_2021-continental") – Particle properties, in the Prt-Core v1 format, without state dimension.

Fields:
  • id (str or None) – Identifier of the current scene element.

  • geometry (SceneGeometry) – Parameters defining the basic geometry of the scene.

  • use_rrt (bool) – If set to true, prescribe the use of residual ratio tracking to estimate transmittance for integrators that allow it.

  • ddis_threshold (float) – Specifies the probability to importance sample the phase using the emitter as incident direction.

  • scale (float or None) – If set, the extinction coefficient is scaled by the corresponding amount during computation.

  • force_majorant (bool) – If set to true, uses heterogeneous medium, which is compatible with all integrators except PiecewiseVolpathIntegrator.

  • extremum_resolution (tuple[int, int, int]) – [EXPERIMENTAL] Resolution of the extremum structure.

  • has_absorption (bool) – Absorption bypass switch.

  • has_scattering (bool) – Scattering bypass switch.

  • force_polarized_phase (bool) – Force the use of a polarized phase function implementation, even when no polarization information is available.

  • bottom (quantity) – Bottom altitude of the particle component.

  • top (quantity) – Top altitude of the particle component.

  • distribution (ParticleDistribution) – Particle distribution in the Z dimension of the coords grid.

  • w_ref (quantity) – Reference wavelength at which the extinction optical thickness is specified.

  • tau_ref (quantity) – Extinction optical thickness at the reference wavelength.

  • particle_properties (ParticleProperties) – Particle properties, in the Prt-Core v1 format, without state dimension.

See also

If the optical property dataset contains only one spectral data point, the data is considered uniform throughout the entire spectrum.

The medium density is evaluated on the vertical layers of the render grid (see geometry) and normalized to meet the target optical thickness.

The prescribed optical thickness is enforced at the reference wavelength (tau_ref) and scaled by the medium’s extinction, normalized at that wavelength.

Notes

particle_dist: available distribution types and parametrizations.

classmethod convert(value)#

Conversion logic:

  • If value is a ParticleComponent instance, return it unchanged.

  • If value is a dictionary, it is interpreted by atmosphere_factory; the "type" parameter may be omitted and will automatically be set to "particle_ot". Other types, e.g. "particle_ms", must set "type" explicitly.

  • Otherwise, the value is returned unchanged.

classmethod from_ms_composition(particle_ms_component, w, i_reff, i_veff, grid=None, ext=None)#

Build a single ParticleOTComponent approximating the whole component with one fixed (reff, veff) grid point.

Every voxel’s own reff/veff is ignored in favour of the given grid point; only its amount is used to build the per-voxel density (tau_ref and distribution).

Parameters:
  • particle_ms_component (ParticleMSComponent) – Source particle MS component.

  • w (pint.Quantity) – Evaluation wavelength.

  • i_reff, i_veff (int) – Index along particle_ms_component.properties’s reff/veff dimensions, assumed constant across the whole component.

  • grid (SpatialGrid, optional) – Target render grid. Defaults to particle_ms_component.geometry.grid.

  • ext (pint.Quantity, optional) – Extinction coefficient stored in the output ParticleOTComponent’s particle_properties. Defaults to the native grid value at (i_reff, i_veff). Since that dataset only ever has one wavelength point, this value is only ever compared to itself (ext(w) / ext(w_ref)) and has no effect on the output.

Returns:

ParticleOTComponent

classmethod from_ms_voxel(particle_ms_component, w, ix, iy, iz, grid=None)#

Build a ParticleOTComponent representing a single voxel of the particle MS component at the given grid location.

Parameters:
  • particle_ms_component (ParticleMSComponent) – Source particle MS component.

  • w (pint.Quantity) – Evaluation wavelength.

  • ix, iy, iz (int) – Voxel indices in the render grid.

  • grid (SpatialGrid, optional) – Target render grid. Defaults to particle_ms_component.geometry.grid.

Returns:

ParticleOTComponent

Raises:

ValueError – If (ix, iy, iz) is out of bounds, or the voxel there has no cloud (zero amount).

eval_albedo(si, grid=None)#
eval_albedo(si, grid=None)
eval_albedo(si, grid=None)

Evaluate albedo spectrum based on a spectral context. This method dispatches evaluation to specialized methods depending on the active mode.

Parameters:
  • si (SpectralIndex) – Spectral index.

  • grid (SpatialGrid, optional) – Altitude grid on which evaluation is performed. If unset, an instance-specific default is used (see grid).

Returns:

quantity – Evaluated spectrum as an array with length equal to the number of layers.

eval_fractions(grid)#

Compute the particle number fraction in the component in 3D according to the distribution.

The Z dimension (vertical extent) supports spatially varying top and bottom in X and Y.

Returns:

ndarray – Particle number fractions as a (n_x, n_y, n_layers)-shaped array.

eval_radprops(si, grid=None, optional_fields=False)#

Evaluate the extinction coefficients and albedo profiles.

Parameters:
  • si (SpectralIndex) – Spectral index.

  • grid (SpatialGrid, optional) – Altitude grid on which evaluation is performed. If unset, an instance-specific default is used (see grid).

  • optional_fields (bool, optional, default: False) – If True, also output the absorption and scattering coefficients, not required for scene setup but useful for analysis and debugging.

Returns:

Dataset – A dataset with the following variables:

  • sigma_t: extinction coefficient;

  • albedo: albedo;

  • sigma_a: absorption coefficient (optional);

  • sigma_s: scattering coefficient (optional).

with dimensions (x_cell, y_cell, z_layer) and coordinates:

  • x_cell: X cell centres (azimuth for a spherical grid);

  • y_cell: Y cell centres (colatitude for a spherical grid);

  • z_layer: layer centre altitude.

eval_sigma_a(si, grid=None)#
eval_sigma_a(si, grid=None)
eval_sigma_a(si, grid=None)

Evaluate absorption coefficient given a spectral context.

Parameters:
  • si (SpectralIndex) – Spectral index.

  • grid (SpatialGrid, optional) – Altitude grid on which evaluation is performed. If unset, an instance-specific default is used (see grid).

Returns:

quantity – Absorption coefficient.

eval_sigma_s(si, grid=None)#
eval_sigma_s(si, grid=None)
eval_sigma_s(si, grid=None)

Evaluate scattering coefficient given a spectral context.

Parameters:
  • si (SpectralIndex) – Spectral index.

  • grid (SpatialGrid, optional) – Altitude grid on which evaluation is performed. If unset, an instance-specific default is used (see grid).

Returns:

quantity – Scattering coefficient.

eval_sigma_t(si, grid=None)#
eval_sigma_t(si, grid=None)
eval_sigma_t(si, grid=None)

Evaluate extinction coefficient given a spectral context.

Parameters:
  • si (SpectralIndex) – Spectral index.

  • grid (SpatialGrid, optional) – Altitude grid on which evaluation is performed. If unset, an instance-specific default is used (see grid).

Returns:

quantity – Extinction coefficient.

eval_transmittance(si, interaction='extinction')#

Evaluate the atmosphere’s transmittance with respect to specific interaction.

Parameters:
  • si (SpectralIndex) – Spectral index.

  • interaction ({"extinction", "absorption", "scattering"}, optional, default: "extinction") – Interaction type.

Returns:

quantity – Total atmosphere transmittance.

traverse(callback)#

Traverse this scene element and collect kernel dictionary template and parameter update map contributions.

Parameters:

callback (SceneTraversal) – Callback data structure storing the collected data.

update()#

Update internal state.

property absorption_data#
Returns:

AbsorptionDatabase or None – If relevant, the molecular absorption database associated with this atmosphere.

property bottom_altitude#
Returns:

quantity – Atmosphere bottom altitude.

property height#
Returns:

quantity – Atmosphere height.

property is_piecewise#

True if this atmosphere is rendered with a piecewise medium, which requires a PlaneParallelGeometry with a 1D grid and force_majorant unset. Only this medium is compatible with PiecewiseVolPathIntegrator; it ignores extremum_resolution and use_rrt.

property medium_id#
Returns:

str – ID of the medium associated with the atmosphere in the Mitsuba scene tree.

property objects#

Map of child objects associated with this scene element.

Returns:

dict – A dictionary mapping object names to a corresponding object to be inserted in the Eradiate scene graph.

property params#
Returns:

dict[str, SceneParameter] or None – A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.

property phase#
Returns:

PhaseFunction – Phase function associated with the atmosphere.

property phase_id#
Returns:

str – ID of the phase function associated with the atmosphere in the Mitsuba scene tree.

property shape#
Returns:

Shape – Shape associated with this atmosphere, based on the scene geometry.

property shape_id#
Returns:

str – ID of the shape associated with the atmosphere in the Mitsuba scene tree.

property template#

Kernel dictionary template contents associated with this scene element.

Returns:

dict – A flat dictionary mapping dot-separated strings describing the path of an item in the nested scene dictionary to values. Values may be objects which can be directly used by the mitsuba.load_dict() function, or DictParameter instances which must be rendered.

property top_altitude#
Returns:

quantity – Atmosphere top altitude.