artist.scenario.surface_generator ================================= .. py:module:: artist.scenario.surface_generator Attributes ---------- .. autoapisummary:: artist.scenario.surface_generator.log Classes ------- .. autoapisummary:: artist.scenario.surface_generator.SurfaceGenerator Module Contents --------------- .. py:data:: log A logger for the surface generator. .. py:class:: SurfaceGenerator(number_of_control_points: torch.Tensor = torch.tensor([10, 10]), degrees: torch.Tensor = torch.tensor([3, 3]), device: torch.device | None = None) Initialize the surface generator. Heliostat data, including information regarding their surfaces and structure, can be generated via ``STRAL`` and exported to a binary file or downloaded from ``PAINT``. The data formats are different depending on their source. To convert this data into a surface configuration format suitable for ``ARTIST``, this converter first loads the data and then learns or creates NURBS surfaces based on the data. Finally, the converter returns a list of facets that can be used directly in an ``ARTIST`` scenario. Parameters ---------- number_of_control_points : torch.Tensor The number of NURBS control points along each direction of each 2D facet (default is torch.tensor([10,10])). Tensor of shape [2]. degrees : torch.Tensor Degree of the NURBS along each direction of each 2D facet (default is torch.tensor([3,3])). Tensor of shape [2]. device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. .. py:attribute:: number_of_control_points .. py:attribute:: degrees .. py:method:: fit_nurbs(surface_points: torch.Tensor, surface_normals: torch.Tensor, optimizer: torch.optim.Optimizer, scheduler: torch.optim.lr_scheduler.LRScheduler | None = None, fit_method: str = config_dictionary.fit_nurbs_from_normals, tolerance: float = 1e-10, max_epoch: int = 400, device: torch.device | None = None) -> artist.util.nurbs.NURBSSurfaces Fit a NURBS surface. The surface points are first normalized and shifted to the range (0,1) to be compatible with the knot vector of the NURBS surface. The NURBS surface is then initialized with the correct number of control points, degrees, and knots. The origin of the control points is set based on the width and height of the point cloud. The control points are then fitted to the surface points or surface normals using the provided optimizer. Parameters ---------- surface_points : torch.Tensor The surface points. Tensor of shape [number_of_surface_points, 4]. surface_normals : torch.Tensor The surface normals. Tensor of shape [number_of_surface_points, 4]. optimizer : torch.optim.Optimizer The optimizer. scheduler : torch.optim.lr_scheduler.LRScheduler | None The learning rate scheduler (default is None). fit_method : str The method used to fit the NURBS, either from deflectometry points or normals (default is config_dictionary.fit_nurbs_from_normals). tolerance : float The tolerance value used for fitting NURBS surfaces (default is 1e-10). max_epoch : int The maximum number of epochs for the NURBS fit (default is 400). device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Raises ------ NotImplementedError If the NURBS fit method is unknown. Returns ------- NURBSSurfaces A fitted NURBS surface. .. py:method:: generate_fitted_surface_config(heliostat_name: str, facet_translation_vectors: torch.Tensor, canting: torch.Tensor, surface_points_with_facets_list: list[torch.Tensor], surface_normals_with_facets_list: list[torch.Tensor], optimizer: torch.optim.Optimizer, scheduler: torch.optim.lr_scheduler.LRScheduler | None = None, deflectometry_step_size: int = 100, fit_method: str = config_dictionary.fit_nurbs_from_normals, tolerance: float = 1e-10, max_epoch: int = 400, device: torch.device | None = None) -> artist.scenario.configuration_classes.SurfaceConfig Generate a fitted surface configuration. The fitted surface configuration is composed of separate facets. Each facet is defined by fitted control points, meaning the control points are fitted to measured point cloud or surface normals data. Initializing a surface from this configuration results in an imperfect heliostat surface with dents or bulges, reflecting real-world conditions. The surface can be fitted to deflectometry data or any other provided point cloud data. Parameters ---------- heliostat_name : str The heliostat name, used for logging. facet_translation_vectors : torch.Tensor Translation vectors for each facet from heliostat origin to relative position. Tensor of shape [number_of_facets, 4]. canting : torch.Tensor The canting vectors per facet in east and north directions Tensor of shape [number_of_facets, 2, 4]. surface_points_with_facets_list : list[torch.Tensor] A list of facetted surface points. Points per facet may vary. Tensors in list of shape [number_of_points, 3]. surface_normals_with_facets_list : list[torch.Tensor] A list of facetted surface normals. Points per facet may vary. Tensors in list of shape [number_of_points, 3]. optimizer : torch.optim.Optimizer The optimizer. scheduler : torch.optim.lr_scheduler.LRScheduler | None The learning rate scheduler (default is None). deflectometry_step_size : int The step size used to reduce the number of deflectometry points and normals for compute efficiency (default is 100). fit_method : str The method used to fit the NURBS, either from deflectometry points or normals (default is config_dictionary.fit_nurbs_from_normals). tolerance : float The tolerance value used for fitting NURBS surfaces (default is 1e-10). max_epoch : int The maximum number of epochs for the NURBS fit (default is 400). device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Returns ------- SurfaceConfig A surface configuration. .. py:method:: generate_ideal_surface_config(facet_translation_vectors: torch.Tensor, canting: torch.Tensor, device: torch.device | None = None) -> artist.scenario.configuration_classes.SurfaceConfig Generate an ideal surface configuration. The ideal surface configuration is composed of separate facets. Each facet is defined by ideal control points, meaning the control points start as 3D points on a flat, equidistant grid around the origin. These control points are then canted (rotated) and translated to the facet positions. Initializing a surface from this configuration results in an ideal heliostat surface without dents or bulges but with canting. This ideal heliostat surface can be used as a starting point for a surface reconstruction based on measured flux distributions. Parameters ---------- facet_translation_vectors : torch.Tensor Translation vector for each facet from heliostat origin to relative position. Tensor of shape [number_of_facets, 4]. canting : torch.Tensor The canting vector per facet in east and north direction. Tensor of shape [number_of_facets, 2, 4]. device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Returns ------- SurfaceConfig A surface configuration.