Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/673.test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Further updates/support for intensity sensor
21 changes: 19 additions & 2 deletions src/ansys/speos/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
SensorCamera,
SensorIrradiance,
SensorRadiance,
SensorXMPIntensity,
)
from ansys.speos.core.simulation import (
SimulationDirect,
Expand Down Expand Up @@ -316,7 +317,9 @@ def create_sensor(
description: str = "",
feature_type: type = SensorIrradiance,
metadata: Optional[Mapping[str, str]] = None,
) -> Union[SensorCamera, SensorRadiance, SensorIrradiance, Sensor3DIrradiance]:
) -> Union[
SensorCamera, SensorRadiance, SensorIrradiance, Sensor3DIrradiance, SensorXMPIntensity
]:
"""Create a new Sensor feature.

Parameters
Expand Down Expand Up @@ -362,6 +365,13 @@ def create_sensor(
description=description,
metadata=metadata,
)
case "SensorXMPIntensity":
feature = SensorXMPIntensity(
project=self,
name=name,
description=description,
metadata=metadata,
)
case "SensorRadiance":
feature = SensorRadiance(
project=self,
Expand Down Expand Up @@ -825,6 +835,13 @@ def _fill_features(self):
sensor_instance=ssr_inst,
default_values=False,
)
elif ssr_inst.HasField("intensity_properties"):
ssr_feat = SensorXMPIntensity(
project=self,
name=ssr_inst.name,
sensor_instance=ssr_inst,
default_values=False,
)
elif ssr_inst.HasField("camera_properties"):
ssr_feat = SensorCamera(
project=self,
Expand Down Expand Up @@ -965,7 +982,7 @@ def _create_speos_feature_preview(
):
return plotter

ray_path_scale_factor = 0.2
ray_path_scale_factor = 0.0

match speos_feature:
case SourceRayFile() | SourceLuminaire() | SourceSurface():
Expand Down
25 changes: 23 additions & 2 deletions src/ansys/speos/core/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3822,8 +3822,10 @@ def __init__(
self.set_type_photometric()
self.set_orientation_x_as_meridian()
self.set_viewing_direction_from_source()
self._set_default_dimension_values()
# Default values properties
self.set_axis_system().set_layer_type_none()
self.set_axis_system() # .set_layer_type_none()
self.set_layer_type_none()

@property
def nearfield(self) -> bool:
Expand Down Expand Up @@ -3959,6 +3961,25 @@ def layer(
"""
return self._layer_type

def set_axis_system(self, axis_system: Optional[List[float]] = None) -> SensorXMPIntensity:
"""Set position of the sensor.

Parameters
----------
axis_system : Optional[List[float]]
Position of the sensor [Ox Oy Oz Xx Xy Xz Yx Yy Yz Zx Zy Zz].
By default, ``[0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]``.

Returns
-------
ansys.speos.core.sensor.SensorXMPIntensity
intensity sensor.
"""
if axis_system is None:
axis_system = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]
self._sensor_instance.intensity_properties.axis_system[:] = axis_system
return self

def set_orientation_x_as_meridian(self):
"""Set Orientation type: X As Meridian, Y as Parallel."""
self._sensor_template.intensity_sensor_template.intensity_orientation_x_as_meridian.SetInParent()
Expand Down Expand Up @@ -4294,7 +4315,7 @@ def set_type_spectral(self) -> BaseSensor.Spectral:
)
return self._type

def set_layer_type_none(self) -> SensorRadiance:
def set_layer_type_none(self) -> SensorXMPIntensity:
"""Define layer separation type as None.

Returns
Expand Down