eradiate.scenes.biosphere.InstancedCanopyElement#

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

Bases: CompositeSceneElement

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) – Identifier of the current scene element.

  • 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) – Identifier of the current scene element.

  • 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:
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()#

Enforce internal state consistency. This method should be called when fields are modified. It is automatically called as a post-init step.

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, UpdateParameter] or None – A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.

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 InitParameter instances which must be rendered.