Skip to content

Commit 5c2dd9b

Browse files
authored
Restructure package (#203)
2 parents e2669d2 + 2b82f9e commit 5c2dd9b

133 files changed

Lines changed: 5127 additions & 5071 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

artist/__init__.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
"""Bundle ``ARTIST`` as a package."""
1+
"""Top-level package for ARTIST."""
22

33
import os
44

5-
from . import core, data_parser, field, scenario, scene, util
6-
75
ARTIST_ROOT = f"{os.sep}".join(__file__.split(os.sep)[:-2])
86
"""Reference to the root directory of ``ARTIST``."""
9-
10-
__all__ = [
11-
"core",
12-
"data_parser",
13-
"field",
14-
"scenario",
15-
"scene",
16-
"util",
17-
"ARTIST_ROOT",
18-
]

artist/core/__init__.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

artist/core/core_utils.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

artist/data_parser/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

artist/field/__init__.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
"""Bundle all classes that represent physical objects in ``ARTIST``."""
2-
3-
from artist.field.actuators import Actuators
4-
from artist.field.actuators_ideal import IdealActuators
5-
from artist.field.actuators_linear import LinearActuators
6-
from artist.field.heliostat_field import HeliostatField
7-
from artist.field.heliostat_group import HeliostatGroup
8-
from artist.field.heliostat_group_rigid_body import HeliostatGroupRigidBody
9-
from artist.field.kinematics import Kinematics
10-
from artist.field.kinematics_rigid_body import RigidBody
11-
from artist.field.solar_tower import SolarTower
12-
from artist.field.surface import Surface
13-
from artist.field.tower_target_areas import TowerTargetAreas
14-
from artist.field.tower_target_areas_cylindrical import TowerTargetAreasCylindrical
15-
from artist.field.tower_target_areas_planar import TowerTargetAreasPlanar
1+
from .actuators import Actuators
2+
from .actuators_ideal import IdealActuators
3+
from .actuators_linear import LinearActuators
4+
from .heliostat_field import HeliostatField
5+
from .heliostat_group import HeliostatGroup
6+
from .heliostat_group_rigid_body import HeliostatGroupRigidBody
7+
from .kinematics import Kinematics
8+
from .kinematics_rigid_body import RigidBody
9+
from .solar_tower import SolarTower
10+
from .surface import Surface
11+
from .tower_target_areas import TowerTargetAreas
12+
from .tower_target_areas_cylindrical import TowerTargetAreasCylindrical
13+
from .tower_target_areas_planar import TowerTargetAreasPlanar
1614

1715
__all__ = [
16+
"HeliostatField",
1817
"Actuators",
19-
"IdealActuators",
2018
"LinearActuators",
21-
"Surface",
22-
"HeliostatField",
19+
"IdealActuators",
2320
"HeliostatGroup",
2421
"HeliostatGroupRigidBody",
25-
"TowerTargetAreas",
26-
"TowerTargetAreasPlanar",
27-
"TowerTargetAreasCylindrical",
2822
"Kinematics",
2923
"RigidBody",
3024
"SolarTower",
25+
"TowerTargetAreas",
26+
"TowerTargetAreasPlanar",
27+
"TowerTargetAreasCylindrical",
28+
"Surface",
3129
]

artist/field/actuators.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import torch
22

3-
from artist.util.environment_setup import get_device
3+
from artist.util.env import get_device
44

55

66
class Actuators(torch.nn.Module):
@@ -11,16 +11,18 @@ class Actuators(torch.nn.Module):
1111
----------
1212
non_optimizable_parameters : torch.Tensor
1313
The non-optimizable actuator parameters, describing actuator geometry.
14-
Tensor of shape [number_of_heliostats, 7, 2] for linear actuators or [number_of_heliostats, 4, 2] for ideal actuators.
14+
Shape is ``[number_of_heliostats, 7, 2]`` for linear actuators
15+
or ``[number_of_heliostats, 4, 2]`` for ideal actuators.
1516
optimizable_parameters : torch.Tensor
1617
The two optimizable actuator parameters, describing the initial actuator configuration.
17-
Tensor of shape [number_of_heliostats, 2, 2] for linear actuators or [] for ideal actuators.
18+
Shape is ``[number_of_heliostats, 2, 2]`` for linear actuators or ``[]`` for ideal actuators.
1819
active_non_optimizable_parameters : torch.Tensor
1920
Active non-optimizable geometry parameters.
20-
Tensor of shape [number_of_active_heliostats, 7, 2] for linear actuators or [number_of_active_heliostats, 4, 2] for ideal actuators.
21+
Shape is ``[number_of_active_heliostats, 7, 2]`` for linear actuators
22+
or ``[number_of_active_heliostats, 4, 2]`` for ideal actuators.
2123
active_optimizable_parameters : torch.Tensor
2224
Active optimizable parameters.
23-
Tensor of shape [number_of_active_heliostats, 2, 2] for linear actuators or [] for ideal actuators.
25+
Shape is ``[number_of_active_heliostats, 2, 2]`` for linear actuators or ``[]`` for ideal actuators.
2426
2527
Methods
2628
-------
@@ -51,10 +53,12 @@ def __init__(
5153
----------
5254
non_optimizable_parameters : torch.Tensor
5355
The non-optimizable actuator parameters, describing actuator geometry.
54-
Tensor of shape [number_of_heliostats, 7, 2] for linear actuators or [number_of_heliostats, 4, 2] for ideal actuators.
56+
Shape is ``[number_of_heliostats, 7, 2]`` for linear actuators
57+
or ``[number_of_heliostats, 4, 2]`` for ideal actuators.
5558
optimizable_parameters : torch.Tensor
5659
The two optimizable actuator parameters, describing the initial actuator configuration.
57-
Tensor of shape [number_of_heliostats, 2, 2] for linear actuators or [] for ideal actuators (default is torch.Tensor([])).
60+
Shape is ``[number_of_heliostats, 2, 2]`` for linear actuators
61+
or ``[]`` for ideal actuators (default is ``torch.tensor([])``).
5862
device : torch.device | None
5963
The device on which to perform computations or load tensors and models (default is None).
6064
If None, ``ARTIST`` will automatically select the most appropriate
@@ -82,7 +86,7 @@ def motor_positions_to_angles(
8286
----------
8387
motor_positions : torch.Tensor
8488
The motor positions.
85-
Tensor of shape [number_of_active_heliostats, 2].
89+
Shape is ``[number_of_active_heliostats, 2]``.
8690
device : torch.device | None
8791
The device on which to perform computations or load tensors and models (default is None).
8892
If None, ``ARTIST`` will automatically select the most appropriate
@@ -105,7 +109,7 @@ def angles_to_motor_positions(
105109
----------
106110
angles : torch.Tensor
107111
The joint angles.
108-
Tensor of shape [number_of_active_heliostats, 2].
112+
Shape is ``[number_of_active_heliostats, 2]``.
109113
device : torch.device | None
110114
The device on which to perform computations or load tensors and models (default is None).
111115
If None, ``ARTIST`` will automatically select the most appropriate
@@ -128,7 +132,7 @@ def forward(
128132
----------
129133
motor_positions : torch.Tensor
130134
The motor positions to be converted to joint angles.
131-
Tensor of shape [number_of_active_heliostats, 2].
135+
Shape is ``[number_of_active_heliostats, 2]``.
132136
device : torch.device | None
133137
The device on which to perform computations or load tensors and models (default is None).
134138
If None, ``ARTIST`` will automatically select the most appropriate
@@ -138,7 +142,7 @@ def forward(
138142
-------
139143
torch.Tensor
140144
The joint angles.
141-
Tensor of shape [number_of_active_heliostats, 2].
145+
Shape is ``[number_of_active_heliostats, 2]``.
142146
143147
"""
144148
device = get_device(device=device)

artist/field/actuators_ideal.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ class IdealActuators(Actuators):
1111
----------
1212
non_optimizable_parameters : torch.Tensor
1313
The four non-optimizable actuator parameters, describing actuator geometry.
14-
Tensor of shape [number_of_heliostats, 4, 2].
14+
Shape is ``[number_of_heliostats, 4, 2]``.
1515
optimizable_parameters : torch.Tensor
1616
The ideal actuators do not have optimizable parameters, this tensor is therefore empty.
17-
Tensor of shape [].
17+
Shape is ``[]``.
1818
active_non_optimizable_parameters : torch.Tensor
1919
Active non-optimizable geometry parameters.
20-
Tensor of shape [number_of_active_heliostats, 4, 2].
20+
Shape is ``[number_of_active_heliostats, 4, 2]``.
2121
active_optimizable_parameters : torch.Tensor
2222
The ideal actuators do not have optimizable parameters, this tensor is therefore empty.
23-
Tensor of shape [].
23+
Shape is ``[]``.
2424
2525
Methods
2626
-------
@@ -47,10 +47,11 @@ def __init__(
4747
----------
4848
non_optimizable_parameters : torch.Tensor
4949
The four non-optimizable actuator parameters, describing actuator geometry.
50-
Tensor of shape [number_of_heliostats, 4, 2].
50+
Shape is ``[number_of_heliostats, 4, 2]``.
5151
optimizable_parameters : torch.Tensor
52-
The ideal actuators do not have optimizable parameters, this tensor is therefore empty (default is torch.tensor([])).
53-
Tensor of shape [].
52+
The ideal actuators do not have optimizable parameters, this tensor is therefore empty
53+
(default is ``torch.tensor([])``).
54+
Shape is ``[]``.
5455
device : torch.device | None
5556
The device on which to perform computations or load tensors and models (default is None).
5657
If None, ``ARTIST`` will automatically select the most appropriate
@@ -72,7 +73,7 @@ def motor_positions_to_angles(
7273
----------
7374
motor_positions : torch.Tensor
7475
The motor positions.
75-
Tensor of shape [number_of_active_heliostats, 2].
76+
Shape is ``[number_of_active_heliostats, 2]``.
7677
device : torch.device | None
7778
The device on which to perform computations or load tensors and models (default is None).
7879
If None, ``ARTIST`` will automatically select the most appropriate
@@ -95,7 +96,7 @@ def angles_to_motor_positions(
9596
----------
9697
angles : torch.Tensor
9798
The joint angles.
98-
Tensor of shape [number_of_active_heliostats, 2].
99+
Shape is ``[number_of_active_heliostats, 2]``.
99100
device : torch.device | None
100101
The device on which to perform computations or load tensors and models (default is None).
101102
If None, ``ARTIST`` will automatically select the most appropriate
@@ -105,6 +106,6 @@ def angles_to_motor_positions(
105106
-------
106107
torch.Tensor
107108
The motor steps.
108-
Tensor of shape [number_of_active_heliostats, 2].
109+
Shape is ``[number_of_active_heliostats, 2]``.
109110
"""
110111
return angles

0 commit comments

Comments
 (0)