eradiate.scenes.biosphere.InstancedCanopyElement#

class eradiate.scenes.biosphere.InstancedCanopyElement(id=None, canopy_element=None, instance_positions=_Nothing.NOTHING)[source]#

Bases: eradiate.scenes.core.SceneElement

Instanced canopy element [instanced].

This class wraps a canopy element and defines locations where to position instances (i.e. clones) of it.

Class method constructors

from_file(filename[, canopy_element])

Construct a InstancedCanopyElement from a text file specifying instance positions.

Parameters
  • id (str, optional, default: None) – User-defined object identifier.

  • canopy_element (CanopyElement, optional) – Instanced canopy element. Can be specified as a dictionary, which will be converted by biosphere_factory.

  • instance_positions (array-like, default: []) – Instance positions as an (n, 3)-array.

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

Fields
  • id (str or None) – User-defined object identifier.

  • canopy_element (CanopyElement, optional) – Instanced canopy element.

  • instance_positions (quantity) – Instance positions as an (n, 3)-array.

classmethod from_file(filename, canopy_element=None)[source]#

Construct a InstancedCanopyElement from a text file specifying instance positions.

File format

Each line defines an instance position as a whitespace-separated 3-vector of Cartesian coordinates.

Important

Location coordinates are assumed to be given in meters.

Parameters
  • filename (path-like) – Path to the text file specifying the leaves in the canopy. Can be absolute or relative.

  • canopy_element (CanopyElement or dict, optional) – CanopyElement to be instanced. If a dictionary is passed, if is interpreted by biosphere_factory. If set to None, an empty leaf cloud will be created.

Returns

InstancedCanopyElement – Created InstancedCanopyElement.

Raises
kernel_bsdfs(ctx)[source]#

Return BSDF plugin specifications.

Parameters

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

Returns

dict – Return a dictionary suitable for merge with a KernelDict containing all the BSDFs attached to the shapes in the leaf cloud.

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_instances(ctx)[source]#

Return instance plugin specifications.

Parameters

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

Returns

dict – A dictionary suitable for merge with a KernelDict containing instances.

kernel_shapes(ctx)[source]#

Return shape plugin specifications.

Parameters

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

Returns

dict – A dictionary suitable for merge with a KernelDict containing all the shapes in the canopy.