eradiate.scenes.atmosphere.ParticleMSComponent#

class eradiate.scenes.atmosphere.ParticleMSComponent(id='atmosphere', geometry='plane_parallel', extremum_resolution=(1, 1, 1), has_absorption=True, has_scattering=True, force_polarized_phase=False, *, use_rrt=True, ddis_threshold=0.0, scale=None, force_majorant=False, properties, phase=None, profile, amount='mass_concentration', state_variables=NOTHING)#

Bases: ParticleStateComponent

Particulate medium parametrized by a mass concentration and (MS) that varies as a function of space coordinates [particle_ms].

This ParticleStateComponent specialization uses the effective radius (reff) and effective variance (veff) of the MS as tabulated state variables, and the mass concentration (mass_concentration) as amount. With the default state_variables and amount, the profile is expected in the Ppr-MS v1 format and the properties in the Prt-MS v1 format. The per-unit-amount extinction ext in properties is then a mass extinction coefficient (e.g. in m²/g).

Interpolation, extinction scaling and spatial resampling are those of ParticleStateComponent.

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.

  • properties (ParticleProperties or Dataset or path-like or str) – Particle properties, in the Prt-Core v1 format extended with 1 or 2 state dimensions (see Extensions). This parameter has no default.

  • phase (PhaseFunction or dict, optional, default: None) – Phase function override. If unset, a GriddedParticlePhaseFunction is built from profile and properties.

  • profile (ParticleProfile or Dataset or path-like) – Dense volumetric state profile, in the Ppr-MS v1 format. This parameter has no default.

  • amount (str, optional, default: "mass_concentration") – Name of the profile variable that scales the per-unit-amount extinction (e.g. mass or number concentration). If unset, the unique profile variable whose units make amount * ext an inverse length is selected automatically.

  • state_variables (dict[str, str], optional, default: {"reff": "reff", "veff": "veff"}) – Tabulated state variables, as a mapping from a properties state dimension name to the profile variable supplying its per-voxel value. State dimensions not listed here default to a profile variable of the same name.

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.

  • properties (ParticleProperties) – Particle properties, in the Prt-Core v1 format extended with 1 or 2 state dimensions (see Extensions).

  • profile (ParticleProfile) – Dense volumetric state profile, in the Ppr-MS v1 format.

  • amount (str or None) – Name of the profile variable that scales the per-unit-amount extinction (e.g. mass or number concentration).

  • state_variables (dict[str, str]) – Tabulated state variables, as a mapping from a properties state dimension name to the profile variable supplying its per-voxel value.

classmethod convert(value)#

Conversion logic:

  • If value is a ParticleMSComponent 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_ms".

  • Otherwise, the value is returned unchanged.

classmethod from_particle_ot(particle_ot, mass_concentration, reff, veff, grid=None)#

Build a ParticleMSComponent from a ParticleOTComponent.

The output has a spatially uniform particle size distribution and a mass concentration field that reproduces particle_ot’s extinction coefficient at its reference wavelength. Its properties hold a single wavelength point (particle_ot.w_ref) and a single (reff, veff) point.

Parameters:
  • particle_ot (ParticleOTComponent) – Source particle component. The ext variable of its particle_properties must have the dimensionality of an inverse length.

  • mass_concentration (pint.Quantity) – Mass concentration to which particle_ot’s ext corresponds; the mass extinction coefficient of the output properties is ext(w_ref) / mass_concentration.

  • reff (pint.Quantity) – Effective radius of the particle size distribution, assigned to every voxel.

  • veff (pint.Quantity) – Effective variance (dimensionless) of the particle size distribution, assigned to every voxel.

  • grid (SpatialGrid, optional) – Target render grid for the output ParticleMSComponent. If provided, particle_ot’s radiative properties are evaluated on it instead of its own geometry’s grid.

Returns:

ParticleMSComponent

eval_albedo(si, grid=None)#

Evaluate the single-scattering albedo on the render grid.

Parameters:
  • si (SpectralIndex) – Spectral index at which to evaluate.

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

Returns:

pint.Quantity – Single-scattering albedo array of shape (n_x_cells, n_y_cells, n_z_cells), dimensionless.

Raises:

RuntimeError – If both has_absorption and has_scattering are False.

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 the absorption coefficient on the render grid.

Parameters:
  • si (SpectralIndex) – Spectral index at which to evaluate.

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

Returns:

pint.Quantity – Absorption coefficient array of shape (n_x_cells, n_y_cells, n_z_cells), in units of \(\mathrm{km}^{-1}\).

eval_sigma_s(si, grid=None)#

Evaluate the scattering coefficient on the render grid.

Parameters:
  • si (SpectralIndex) – Spectral index at which to evaluate.

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

Returns:

pint.Quantity – Scattering coefficient array of shape (n_x_cells, n_y_cells, n_z_cells), in units of \(\mathrm{km}^{-1}\).

eval_sigma_t(si, grid=None)#

Evaluate the extinction coefficient on the render grid.

Parameters:
  • si (SpectralIndex) – Spectral index at which to evaluate.

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

Returns:

pint.Quantity – Extinction coefficient array of shape (n_x_cells, n_y_cells, n_z_cells), in units of \(\mathrm{km}^{-1}\).

Raises:

RuntimeError – If both has_absorption and has_scattering are False.

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.

to_profile_regular_grid()#

Return a copy of this ParticleStateComponent with its geometry set to a regular grid aligned with the profile.

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

tuple[str, ] – Names of properties’ state dimensions (see ParticleProperties.state_dims).

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.