eradiate.scenes.atmosphere.ParticleExtinctionComponent#
- class eradiate.scenes.atmosphere.ParticleExtinctionComponent(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, sigma_t, albedo, phase_spec)#
Bases:
ParticleComponentParticle component parametrized by extinction coefficient and albedo [
particle_extinction].This component represents a 3D participating medium characterized by extinction coefficient and single-scattering albedo fields, both described as gridded arrays.
The extinction (
sigma_t) and albedo (albedo) arrays must have exactly the dimensionsw(wavelength) andx,y,z(space coordinates), in any order. The spatial coordinate axes must be aligned with the scene geometry’s grid. Both data arrays are interpolated on thewandzaxes; thexandyaxes are used as-is, so their values must already match the scene geometry’s horizontal grid shape.This class accepts any factory-convertible phase function specification.
- Parameters:
id (
str, optional, default:"atmosphere") – Identifier of the current scene element.geometry (
SceneGeometryordictorstr, 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 aHeterogeneousAtmosphere; 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 aHeterogeneousAtmosphere; 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 aHeterogeneousAtmosphere; 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 andforce_majorantunset). Ignored on components of aHeterogeneousAtmosphere; set it on the parent instead.has_absorption (
bool, default:True) – Absorption bypass switch. IfTrue, 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. IfTrue, 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.sigma_t (
DataArray) – Extinction coefficient. ADataArraywhose dimensions are exactlyw(wavelength) andx,y,z(space coordinates), in any order. Values and thew/zcoordinates must carry a'units'entry in theirattrs, as read byto_quantity(). Must have matching sizes withalbedo.albedo (
DataArray) – Single-scattering albedo. Same dimension and unit-metadata convention assigma_t(dimensionless), and must have matching sizes with it. Values must lie in [0, 1].phase_spec (
PhaseFunctionordictorstr) – Phase function specification: aPhaseFunctioninstance, or a dict/string the phase function factory can convert.
- Fields:
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 (
floatorNone) – 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.sigma_t (
DataArray) – Extinction coefficient.albedo (
DataArray) – Single-scattering albedo.phase_spec (
Any) – Phase function specification: aPhaseFunctioninstance, or a dict/string the phase function factory can convert.
- classmethod convert(value)#
Conversion logic:
If value is a
ParticleComponentinstance, 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.
- 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 (seegrid).
- 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 (seegrid).optional_fields (
bool, optional, default:False) – IfTrue, 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 (seegrid).
- 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 (seegrid).
- 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 (seegrid).
- 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:
AbsorptionDatabaseorNone– If relevant, the molecular absorption database associated with this atmosphere.
- property is_piecewise#
Trueif this atmosphere is rendered with apiecewisemedium, which requires aPlaneParallelGeometrywith a 1D grid andforce_majorantunset. Only this medium is compatible withPiecewiseVolPathIntegrator; it ignoresextremum_resolutionanduse_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] orNone– A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.
See also
- 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 themitsuba.load_dict()function, orDictParameterinstances which must be rendered.
See also