artist.field.heliostat_field
Attributes
A logger for the heliostat field. |
Classes
Initialize the heliostat field with heliostat groups. |
Functions
|
Select the individual parameters of heliostats by their rows, and the prototype for heliostats without. |
Module Contents
- artist.field.heliostat_field.log
A logger for the heliostat field.
- class artist.field.heliostat_field.HeliostatField(heliostat_groups: collections.abc.Sequence[artist.field.heliostat_group.HeliostatGroup], device: torch.device | None = None)
Initialize the heliostat field with heliostat groups.
Parameters
- heliostat_groupsSequence[HeliostatGroup]
A list containing all heliostat groups.
- devicetorch.device | None
The device on which to perform computations or load tensors and models (default is None). If None,
ARTISTwill automatically select the most appropriate device (CUDA or CPU) based on availability and OS.
- heliostat_groups
- number_of_heliostat_groups
- number_of_heliostats_per_group
- classmethod from_hdf5(config_file: h5py.File, prototype_surface: artist.util.config.SurfaceConfig, prototype_kinematics: dict[str, str | torch.Tensor], prototype_actuators: dict[str, str | torch.Tensor], number_of_surface_points_per_facet: torch.Tensor, change_number_of_control_points_per_facet: torch.Tensor | None = None, device: torch.device | None = None, surface_evaluation_chunk_size: int = 1024) Self
Load a heliostat field from an HDF5 file.
The heliostats are read onto the CPU as columns, i.e., one tensor per parameter for all heliostats, whichever layout the file uses. They are grouped by kinematics and actuator type, moved to the device once per group, and the surface points and normals of each group are computed in batched NURBS evaluations.
Parameters
- config_fileh5py.File
The HDF5 file containing the configuration to be loaded.
- prototype_surfaceSurfaceConfig
The prototype for the surface configuration to be used if a heliostat has no individual surface.
- prototype_kinematicsdict[str, str | torch.Tensor]
The prototype for the kinematics, including type, initial orientation and deviations.
- prototype_actuatorsdict[str, str | torch.Tensor]
The prototype for the actuators, including type and parameters.
- number_of_surface_points_per_facettorch.Tensor
The number of sampling points along each direction of each 2D facet. Shape is
[2].- change_number_of_control_points_per_facettorch.Tensor | None
The updated number of control points along each direction of each 2D facet (default is None). Providing this parameter should be done with caution. In a scenario with surfaces generated by deflectometry, this parameter should be None, otherwise the deflectometry surface will be overwritten and become ideal. For ideal surfaces this parameter can be used to change the number of control points specified in the .h5 scenario. Shape is
[2].- devicetorch.device | None
The device on which to perform computations or load tensors and models (default is None). If None,
ARTISTwill automatically select the most appropriate device (CUDA or CPU) based on availability and OS.- surface_evaluation_chunk_sizeint
The maximum number of heliostats whose surfaces are evaluated in one batched NURBS evaluation (default is 1024). Larger values are faster but need more memory on the device.
Raises
- ValueError
If neither prototypes nor individual heliostat parameters are provided, if a kinematics or actuator type is unknown, or if
surface_evaluation_chunk_sizeis not positive.
Returns
- HeliostatField
The heliostat field loaded from the HDF5 file.
- static _group_heliostats(columns: dict[str, Any], prototype_surface: artist.util.config.SurfaceConfig, prototype_kinematics: dict[str, str | torch.Tensor], prototype_actuators: dict[str, str | torch.Tensor], change_number_of_control_points_per_facet: torch.Tensor | None, rank: int) dict[str, dict[str, Any]]
Group heliostats read as columns by kinematics and actuator type and gather the CPU tensors of each group.
Heliostats without individual parameters use the prototypes. Which prototypes and default parameters were used is logged on rank 0, summarized over all heliostats.
Parameters
- columnsdict[str, Any]
The heliostat columns, see
h5_columnar_heliostats.heliostat_columns().- prototype_surfaceSurfaceConfig
The prototype for the surface configuration to be used if a heliostat has no individual surface.
- prototype_kinematicsdict[str, str | torch.Tensor]
The prototype for the kinematics, including type, initial orientation and deviations.
- prototype_actuatorsdict[str, str | torch.Tensor]
The prototype for the actuators, including type and parameters.
- change_number_of_control_points_per_facettorch.Tensor | None
The updated number of control points along each direction of each 2D facet. Shape is
[2].- rankint
The rank of this process, logging only happens on rank 0.
Raises
- ValueError
If neither prototypes nor individual heliostat parameters are provided, or if a kinematics or actuator type is unknown or does not fit the heliostat.
Returns
- dict[str, dict[str, Any]]
Per heliostat group, the heliostat names, the group type and the stacked CPU tensors of all heliostats.
- static _calculate_surface_points_and_normals(control_points: torch.Tensor, degrees: torch.Tensor, canting: torch.Tensor, facet_translations: torch.Tensor, number_of_surface_points_per_facet: torch.Tensor, surface_evaluation_chunk_size: int, device: torch.device) tuple[torch.Tensor, torch.Tensor]
Calculate the surface points and normals of many heliostats in batched NURBS evaluations.
Heliostats are evaluated together if they share the NURBS degrees of their first facet and whether their control points are flat. As for a single
Surface, canting and facet translations are only applied to heliostats with flat control points, all others already contain them.Parameters
- control_pointstorch.Tensor
The control points of all heliostats on the CPU. Shape is
[number_of_heliostats, number_of_facets, number_of_control_points_u_direction, number_of_control_points_v_direction, 3].- degreestorch.Tensor
The NURBS degrees of all facets of all heliostats on the CPU. Shape is
[number_of_heliostats, number_of_facets, 2].- cantingtorch.Tensor
The canting vectors of all facets of all heliostats. Shape is
[number_of_heliostats, number_of_facets, 2, 4].- facet_translationstorch.Tensor
The translation vectors of all facets of all heliostats. Shape is
[number_of_heliostats, number_of_facets, 4].- number_of_surface_points_per_facettorch.Tensor
The number of sampling points along each direction of each 2D facet. Shape is
[2].- surface_evaluation_chunk_sizeint
The maximum number of heliostats whose surfaces are evaluated in one batched NURBS evaluation.
- devicetorch.device
The device on which to perform computations or load tensors and models.
Returns
- torch.Tensor
The surface points of all heliostats. Shape is
[number_of_heliostats, number_of_facets, number_of_surface_points_per_facet, 4].- torch.Tensor
The surface normals of all heliostats. Shape is
[number_of_heliostats, number_of_facets, number_of_surface_points_per_facet, 4].
- update_surfaces(device: torch.device | None = None) None
Update surface points and normals using new NURBS control points.
Parameter
- devicetorch.device | None
The device on which to perform computations or load tensors and models (default is None). If None,
ARTISTwill automatically select the most appropriate device (CUDA or CPU) based on availability and OS.
- artist.field.heliostat_field._select(rows: torch.Tensor, individual: torch.Tensor | None, prototype: torch.Tensor | None) torch.Tensor
Select the individual parameters of heliostats by their rows, and the prototype for heliostats without.
Parameters
- rowstorch.Tensor
The row of each heliostat in the individual parameters, or -1 if the heliostat uses the prototype. Shape is
[number_of_heliostats].- individualtorch.Tensor | None
The individual parameters, or None if no heliostat has them.
- prototypetorch.Tensor | None
The prototype parameters, or None if every heliostat has individual parameters.
Returns
- torch.Tensor
The parameters of each heliostat.