eradiate.scenes.atmosphere.HeterogeneousAtmosphere#

class eradiate.scenes.atmosphere.HeterogeneousAtmosphere(id='atmosphere', geometry='plane_parallel', extremum_resolution=(1, 1, 1), molecular_atmosphere=None, particle_components=NOTHING, *, use_rrt=True, ddis_threshold=0.0, scale=None, force_majorant=False, use_phase_mis=True)#

Bases: AbstractHeterogeneousAtmosphere

Heterogeneous atmosphere scene element [heterogeneous].

Supports both 1D (layer-based) and 3D (fully gridded) configurations.

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.

  • molecular_atmosphere (MolecularAtmosphere or dict, optional, default: None) – Molecular atmosphere. May be specified as a dictionary interpreted by atmosphere_factory; in that case, the "type" parameter may be omitted and will automatically be set to "molecular".

  • particle_components (list of ParticleComponent, optional, default: []) – List of particle components. Elements may be specified as dictionaries interpreted by atmosphere_factory; in that case, the type parameter may be omitted and will automatically be set to "particle_ot".

  • use_phase_mis (bool, default: True) – If True, multiple importance sampling is enabled for the 3D phase function mixture.

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.

  • molecular_atmosphere (MolecularAtmosphere or None) – Molecular atmosphere.

  • particle_components (list of ParticleComponent) – List of particle components.

  • use_phase_mis (bool) – If True, multiple importance sampling is enabled for the 3D phase function mixture.

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_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)#

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)#

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)#

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 components#
Returns:

list of MolecularAtmosphere or ParticleComponent – The list of all registered atmospheric components.

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 particle_layers#

Particle components of this atmosphere.

Deprecated since version 1.3.0: Use particle_components instead.

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.