Skip to content

feat: core implementation irrad sensor v2 - #1102

Open
pluAtAnsys wants to merge 18 commits into
feat/sensor-template-migrationfrom
copilot/1068
Open

feat: core implementation irrad sensor v2#1102
pluAtAnsys wants to merge 18 commits into
feat/sensor-template-migrationfrom
copilot/1068

Conversation

@pluAtAnsys

@pluAtAnsys pluAtAnsys commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Update SensorIrradiance in sensor.py to transparently dispatch to sensor template v1 or v2 protobuf fields based on the connected Speos server version, without any change to the user-facing API.

Issue linked

Migrate SensorIrradiance to support sensor template v1 and v2
#1089

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved by the PR if any.
  • I have assigned this PR to myself.
  • I have made sure that the title of my PR follows Conventional commits style (e.g. feat: add optical property)
  • I have agreed with the Contributor License Agreement (CLA).

StefanThoene and others added 16 commits August 5, 2026 13:54
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Signed-off-by: Stefan Thoene <sthoene@synopsys.com>
Co-authored-by: Elodie Chamblas <100407563+echambla@users.noreply.github.com>
Co-authored-by: Elodie Chamblas <100407563+echambla@users.noreply.github.com>
Signed-off-by: pluAtAnsys <pengyuan@synopsys.com>
@pluAtAnsys pluAtAnsys self-assigned this Aug 17, 2026
@github-actions github-actions Bot added maintenance Package and maintenance related testing Anything related to tests labels Aug 17, 2026
@pluAtAnsys pluAtAnsys linked an issue Aug 17, 2026 that may be closed by this pull request
@pluAtAnsys pluAtAnsys changed the title Copilot/1068 feat: core implementation irrad sensor v2 Aug 17, 2026
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.38129% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.83%. Comparing base (ed0bc15) to head (d581c1f).

Files with missing lines Patch % Lines
src/ansys/speos/core/kernel/sensor_template_v2.py 50.00% 20 Missing ⚠️
src/ansys/speos/core/kernel/client.py 42.85% 8 Missing ⚠️
src/ansys/speos/core/sensor.py 89.47% 8 Missing ⚠️
src/ansys/speos/core/kernel/scene.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##           feat/sensor-template-migration    #1102      +/-   ##
==================================================================
- Coverage                           89.10%   88.83%   -0.27%     
==================================================================
  Files                                  47       48       +1     
  Lines                               11631    11729      +98     
==================================================================
+ Hits                                10364    10420      +56     
- Misses                               1267     1309      +42     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/ansys/speos/core/sensor.py Outdated
"""
if not cls._supports_template_v2:
return False
return server_version_checker.is_version_supported(*cls._SENSOR_TEMPLATE_V2_MIN_VERSION)

@echambla echambla Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems _SENSOR_TEMPLATE_V2_MIN_VERSION is not used somewhere else.
Maybe use here directly (2027, 1, 0)

And remove _SENSOR_TEMPLATE_V2_MIN_VERSION declaration

Comment thread src/ansys/speos/core/sensor.py Outdated
self._sensor_template_version = (
2 if isinstance(self.sensor_template_link, SensorTemplateLinkV2) else 1
)
self._sensor_template = self._new_sensor_template(name, description, metadata)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is useless.
Usually the _sensor_template and _sensor_instance are filled thanks to the reset() call just after
(see comment)

Comment thread src/ansys/speos/core/sensor.py Outdated
return ProtoSensorTemplate(name=name, description=description, metadata=metadata)

@property
def sensor_template_version(self) -> int:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a public property useful here?
As the sensor template version is something we want to hide from core user.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, that can be internal property

----------
wavelengths_range : ansys.api.speos.sensor.v1.common_pb2.WavelengthsRange
wavelengths_range : Union[\
ansys.api.speos.sensor.v1.common_pb2.WavelengthsRange, \

@echambla echambla Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ansys.api.speos.sensor.v1.sensor_pb2.SensorTemplate.Irradiance3D.TypeColorimetric

Comment thread src/ansys/speos/core/sensor.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing sensor_v2_pb2.SensorTemplate.WavelengthsRange

Comment thread src/ansys/speos/core/sensor.py Outdated
self.sensor_template_link = self._project.client.sensor_templates().create(
message=self._sensor_template
)
if self._sensor_template_version == 2:

@echambla echambla Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am doubting if we really need self._sensor_template_version
Because instead we can just check type of self._sensor_template

Avoiding information redundancy is a way to avoid discrepancies.

Comment thread src/ansys/speos/core/sensor.py Outdated
ansys.api.speos.sensor.v2.sensor_pb2.SensorTemplate.Irradiance]
Protobuf sub-message holding the irradiance sensor template definition.
"""
if self._sensor_template_version == 2:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead can check type of self._sensor_template
so that we can get rid of self._sensor_template_version

Comment thread src/ansys/speos/core/sensor.py Outdated
str
Name of the protobuf field for the sensor template version in use.
"""
if self._sensor_template_version == 2:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead can check type of self._sensor_template
so that we can get rid of self._sensor_template_version

Comment thread src/ansys/speos/core/sensor.py Outdated
One of ``"planar"``, ``"radial"``, ``"hemispherical"``, ``"cylindrical"``,
``"semi_cylindrical"``.
"""
if self._sensor_template_version == 2:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead can check type of self._sensor_template
so that we can get rid of self._sensor_template_version

Comment thread src/ansys/speos/core/sensor.py Outdated
bool
``True`` if the integration type is the one currently set.
"""
if self._sensor_template_version == 2:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead can check type of self._sensor_template
so that we can get rid of self._sensor_template_version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Package and maintenance related testing Anything related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate SensorIrradiance to support sensor template v1 and v2

4 participants