Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5b5d11e
refactor BaseSensorClass
StefanThoene Aug 1, 2025
862357d
refactor BalanceModeUserWhite
StefanThoene Aug 4, 2025
0e78001
refactor sensor camera
StefanThoene Aug 4, 2025
7366599
add constants
StefanThoene Aug 6, 2025
0500a97
Refactor Irradiance Sensor
StefanThoene Aug 6, 2025
dcdb10a
Refactor 3DIrradiance Sensor
StefanThoene Aug 6, 2025
99b09c7
unit tests Irradiance Sensor
StefanThoene Aug 6, 2025
8aabb48
unit tests radiance Sensor
StefanThoene Aug 6, 2025
b73e0aa
Finalize unit test
StefanThoene Aug 6, 2025
c31f2cf
Merge branch 'main' into refactor/sensor
StefanThoene Aug 6, 2025
03bf537
chore: adding changelog file 691.miscellaneous.md [dependabot-skip]
pyansys-ci-bot Aug 6, 2025
84e0361
fix project tests
StefanThoene Aug 7, 2025
74cc154
Merge remote-tracking branch 'origin/refactor/sensor' into refactor/s…
StefanThoene Aug 7, 2025
77a2e2d
fix sensor tests
StefanThoene Aug 7, 2025
63cbe83
fix examples and change cheat sheet
StefanThoene Aug 7, 2025
54a6741
fix examples and change cheat sheet
StefanThoene Aug 7, 2025
52c7443
unit test fix
StefanThoene Aug 7, 2025
b61aada
unit test fix
StefanThoene Aug 7, 2025
8eaaf6e
fix example
StefanThoene Aug 29, 2025
e84a11e
fix example
StefanThoene Sep 1, 2025
9896428
improve test coverage
StefanThoene Sep 1, 2025
019b739
improve test coverage
StefanThoene Sep 1, 2025
24d607d
chore: adding changelog file 691.miscellaneous.md [dependabot-skip]
pyansys-ci-bot Sep 1, 2025
c6701ff
improve test coverage
StefanThoene Sep 1, 2025
b3fbd31
Merge remote-tracking branch 'origin/refactor/sensor' into refactor/s…
StefanThoene Sep 1, 2025
dcd0313
fix unit test
StefanThoene Sep 1, 2025
4569018
Merge branch 'main' into refactor/sensor
StefanThoene Sep 3, 2025
9eea447
improve docstrings
StefanThoene Sep 3, 2025
3adb13d
Merge remote-tracking branch 'origin/refactor/sensor' into refactor/s…
StefanThoene Sep 4, 2025
34b71dc
Merge branch 'main' into refactor/sensor
StefanThoene Sep 4, 2025
2553947
improve docstrings
StefanThoene Sep 9, 2025
732c066
refactor to dataclasses
StefanThoene Sep 9, 2025
41b3d7e
Improve doc strings
StefanThoene Sep 9, 2025
a2a6e8f
allow path and str for all pathes
StefanThoene Sep 9, 2025
6024fb5
Merge branch 'main' into refactor/sensor
StefanThoene Sep 9, 2025
25db0ce
Merge branch 'main' into refactor/sensor
StefanThoene Sep 9, 2025
f52c32f
fix dataclasses issue
StefanThoene Sep 9, 2025
6ccf764
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] Sep 9, 2025
dc70d48
fix issue with layer property on test
StefanThoene Sep 9, 2025
3b0d914
fix issue with layer property on test
StefanThoene Sep 9, 2025
a1b42aa
Merge branch 'main' into refactor/sensor
pluAtAnsys Sep 11, 2025
69538a2
Merge branch 'main' into refactor/sensor
pluAtAnsys Sep 18, 2025
4ca2d15
intermediate step refactor
StefanThoene Sep 18, 2025
b47ff29
refactor camera sensor
StefanThoene Sep 18, 2025
23141f4
refactor irradiance sensor part 2
StefanThoene Sep 19, 2025
df19c1b
refactor irradiance sensor part 3
StefanThoene Sep 22, 2025
117363b
refactor sensors
StefanThoene Sep 23, 2025
2abcaa4
Merge remote-tracking branch 'origin/refactor/sensor' into refactor/s…
StefanThoene Sep 23, 2025
41a11f6
unit test missing
StefanThoene Sep 23, 2025
b3fe0b7
fix unit test except camera
StefanThoene Sep 26, 2025
d4171d4
fix unit test except camera
StefanThoene Sep 29, 2025
2794657
Merge branch 'main' into refactor/sensor
StefanThoene Sep 29, 2025
e448773
fix default values
StefanThoene Sep 29, 2025
8909a86
fix default values
StefanThoene Oct 2, 2025
e3eb63c
Merge branch 'main' into refactor/sensor
StefanThoene Oct 2, 2025
2fe86cd
fix default values
StefanThoene Oct 2, 2025
e248af5
Merge remote-tracking branch 'origin/refactor/sensor' into refactor/s…
StefanThoene Oct 2, 2025
8351ce3
Merge branch 'main' into refactor/sensor
pluAtAnsys Oct 5, 2025
43d46a2
Apply suggestions from code review
StefanThoene Oct 7, 2025
5909ee9
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] Oct 7, 2025
d996eab
Merge branch 'main' into refactor/sensor
StefanThoene Oct 7, 2025
3f824e4
Update src/ansys/speos/core/generic/constants.py
StefanThoene Oct 7, 2025
a2004e5
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] Oct 7, 2025
4f4860c
Merge branch 'main' into refactor/sensor
StefanThoene Oct 13, 2025
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/691.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sensor
19 changes: 11 additions & 8 deletions doc/source/cheat_sheet/cheat_sheet_script.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,18 @@ from ansys.speos.core.sensor import SensorRadiance
r_sensor = project.create_sensor(name='Radiance.1', feature_type=SensorRadiance)
# define size
dim = r_sensor.set_dimensions()
dim.set_x_start(-5).set_x_end(5).set_x_sampling(10)
dim.set_y_start(-5).set_y_end(5).set_y_sampling(10)
dim.x_start = -5
dim.x_end = 5
dim.x_sampling = 10
dim.y_start = -5
dim.y_end = 5
dim.y_sampling = 10
# define type and Wavelength range
col = r_sensor.set_type_colorimetric()
wl = col.set_wavelengths_range()
wl.set_start(380).set_end(780)
wl.set_sampling(50)
wl.start = 380
wl.end = 780
wl.sampling = 50
# define Layer separation
r_sensor.set_layer_type_source()
r_sensor.commit()
Expand Down Expand Up @@ -246,12 +251,10 @@ c_sensor.set_distortion_file_uri(
'distortion_file_path')
# Choose photometric mode
photo_cam = c_sensor.set_mode_photometric()
photo_cam.set_transmittance_file_uri(
'transmittance_file_path')
photo_cam.transmittance_file_uri = 'transmittance_file_path'
# Choose color mode
c_mode = photo_cam.set_mode_color()
c_mode.set_blue_spectrum_file_uri(
'blue_spectrum_path')
c_mode.blue_spectrum_file_uri = 'blue_spectrum_path'
# same method for red and green spectrum
c_sensor.commit()
```
Expand Down
7 changes: 5 additions & 2 deletions examples/core/prism-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@

irr_features = p.find(name=".*", name_regex=True, feature_type=SensorIrradiance)
irr = irr_features[0]
irr.set_type_spectral().set_wavelengths_range().set_start(500).set_end(600).set_sampling(11)
wl = irr.set_type_spectral().set_wavelengths_range()
wl.start = 500
wl.end = 600
wl.sampling = 11
irr.commit()

# Create and add a new sensor, e.g. 3d irradiance sensor

body = p.find(name="PrismBody", name_regex=True, feature_type=Body)[0]
sensor_3d = p.create_sensor(name="3d_irradiance", feature_type=Sensor3DIrradiance)
sensor_3d.set_geometries([body.geo_path])
sensor_3d.geometries = [body.geo_path]
sensor_3d.commit()
sim.set_sensor_paths(["Irradiance.1:564", "3d_irradiance"])
sim.commit()
Expand Down
43 changes: 24 additions & 19 deletions examples/core/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ def create_face(body):
red_spectrum_path = str(assets_data_path / FILES / "CameraSensitivityRed.spectrum")

sensor1 = p.create_sensor(name="Camera.1", feature_type=SensorCamera)
sensor1.set_distortion_file_uri(uri=distortion_file_path)
sensor1.distortion_file_uri = distortion_file_path
# Choose photometric mode
sensor1.set_mode_photometric().set_transmittance_file_uri(uri=transmittance_file_path)
sensor1.set_mode_photometric().transmittance_file_uri = transmittance_file_path
# Choose color mode (will imply to give spectrum file for blue, green and red)
sensor1.set_mode_photometric().set_mode_color().set_blue_spectrum_file_uri(uri=blue_spectrum_path)
sensor1.set_mode_photometric().set_mode_color().set_green_spectrum_file_uri(uri=green_spectrum_path)
sensor1.set_mode_photometric().set_mode_color().set_red_spectrum_file_uri(uri=red_spectrum_path)
mode_color = sensor1.photometric.set_mode_color()
mode_color.blue_spectrum_file_uri = blue_spectrum_path
mode_color.green_spectrum_file_uri = green_spectrum_path
mode_color.red_spectrum_file_uri = red_spectrum_path
print(sensor1)
# -

Expand Down Expand Up @@ -134,17 +135,19 @@ def create_face(body):
red_spectrum_path = str(assets_data_path / FILES / "CameraSensitivityRed.spectrum")

sensor2 = p.create_sensor(name="Camera.2", feature_type=SensorCamera)
sensor2.set_distortion_file_uri(uri=distortion_file_path)
sensor2.set_mode_photometric().set_transmittance_file_uri(uri=transmittance_file_path)
sensor2.set_mode_photometric().set_layer_type_source()
sensor2.set_mode_photometric().set_mode_color().set_blue_spectrum_file_uri(uri=blue_spectrum_path)
sensor2.set_mode_photometric().set_mode_color().set_green_spectrum_file_uri(uri=green_spectrum_path)
sensor2.set_mode_photometric().set_mode_color().set_red_spectrum_file_uri(uri=red_spectrum_path)
sensor2.set_focal_length(5.5)
sensor2.set_height(value=6).set_width(value=6) # dimensions
sensor2.set_axis_system(
[20, 10, 40, 1, 0, 0, 0, 1, 0, 0, 0, 1]
) # camera location [Origin, Xvector, Yvector, Zvector]
sensor2.distortion_file_uri = distortion_file_path
photometric = sensor2.set_mode_photometric()
photometric.transmittance_file_uri = transmittance_file_path
photometric.set_layer_type_source()
color = photometric.set_mode_color()
color.blue_spectrum_file_uri = blue_spectrum_path
color.green_spectrum_file_uri = green_spectrum_path
color.red_spectrum_file_uri = red_spectrum_path
sensor2.focal_length = 5.5
sensor2.height = 6
sensor2.width = 6 # dimensions
sensor2.axis_system = [20, 10, 40, 1, 0, 0, 0, 1, 0, 0, 0, 1]
# camera location [Origin, Xvector, Yvector, Zvector]
sensor2.commit()

print(sensor2)
Expand Down Expand Up @@ -172,7 +175,8 @@ def create_face(body):
# If you don't, you will still only watch what is committed on the server.

# modify f number and axis system
sensor1.set_f_number(value=11).set_axis_system([17, 10, 10, 1, 0, 0, 0, 1, 0, 0, 0, 1])
sensor1.f_number = 11
sensor1.axis_system = [17, 10, 10, 1, 0, 0, 0, 1, 0, 0, 0, 1]
sensor1.commit()
print(sensor1)

Expand Down Expand Up @@ -217,7 +221,8 @@ def create_face(body):
sensor4.commit()
print(sensor4)

sensor4.set_focal(value=200).set_type_spectral()
sensor4.focal = 200
sensor4.set_type_spectral()
sensor4.set_layer_type_source()
sensor4.commit()
print(sensor4)
Expand All @@ -229,7 +234,7 @@ def create_face(body):

create_helper_geometries(p)
sensor5 = p.create_sensor(name="3D_Irradiance.2", feature_type=Sensor3DIrradiance)
sensor5.set_geometries([GeoRef.from_native_link("TheBodyB/TheFaceF")])
sensor5.geometries = [GeoRef.from_native_link("TheBodyB/TheFaceF")]
sensor5.commit()
print(sensor5)

Expand Down
30 changes: 18 additions & 12 deletions examples/workflow/combine-speos.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,24 @@
# ### Create a sensor

ssr = p.create_sensor(name="Camera.1", feature_type=SensorCamera)
ssr.set_distortion_file_uri(
uri=str(assets_data_path / "CameraInputFiles" / "CameraDistortion_190deg.OPTDistortion")
).set_mode_photometric().set_transmittance_file_uri(
uri=str(assets_data_path / "CameraInputFiles" / "CameraTransmittance.spectrum")
).set_mode_color().set_red_spectrum_file_uri(
uri=str(assets_data_path / "CameraInputFiles" / "CameraSensitivityRed.spectrum")
).set_blue_spectrum_file_uri(
uri=str(assets_data_path / "CameraInputFiles" / "CameraSensitivityBlue.spectrum")
).set_green_spectrum_file_uri(
uri=str(assets_data_path / "CameraInputFiles" / "CameraSensitivityGreen.spectrum")
ssr.distortion_file_uri = str(
assets_data_path / "CameraInputFiles" / "CameraDistortion_190deg.OPTDistortion"
)
ssr.set_axis_system([-2000, 1500, 11000, -1, 0, 0, 0, 1, 0, 0, 0, -1])
ssr.set_mode_photometric().transmittance_file_uri = str(
assets_data_path / "CameraInputFiles" / "CameraTransmittance.spectrum"
)
color_mode = ssr.set_mode_photometric().set_mode_color()
color_mode.red_spectrum_file_uri = str(
assets_data_path / "CameraInputFiles" / "CameraSensitivityRed.spectrum"
)
color_mode.blue_spectrum_file_uri = str(
assets_data_path / "CameraInputFiles" / "CameraSensitivityBlue.spectrum"
)
color_mode.green_spectrum_file_uri = str(
assets_data_path / "CameraInputFiles" / "CameraSensitivityGreen.spectrum"
)

ssr.axis_system = [-2000, 1500, 11000, -1, 0, 0, 0, 1, 0, 0, 0, -1]
ssr.commit()

# ### Create a source
Expand Down Expand Up @@ -195,7 +201,7 @@
# Modify the camera, e.g. focal length to 10

cam1 = p.find(name="Camera.1", feature_type=SensorCamera)[0]
cam1.set_focal_length(value=10)
cam1.focal_length = 10
cam1.commit()

# Re-run the simulation and review result
Expand Down
Loading