Skip to content

Conversation

StefanThoene
Copy link
Collaborator

@StefanThoene StefanThoene commented Aug 6, 2025

Description

Implment property based approach

Issue linked

#685

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 StefanThoene linked an issue Aug 6, 2025 that may be closed by this pull request
@StefanThoene
Copy link
Collaborator Author

@pluAtAnsys can you have alook why the test_camera_modify_after_reset test is failing

@StefanThoene
Copy link
Collaborator Author

@SMoraisAnsys could you review the refactor?

@pluAtAnsys
Copy link
Collaborator

@pluAtAnsys can you have alook why the test_camera_modify_after_reset test is failing

feat_ssrs[0].set_type_colorimetric().set_wavelengths_range().set_end(value=800)
should be:
feat_ssrs[0].set_type_colorimetric().set_wavelengths_range().end = 800

@StefanThoene
Copy link
Collaborator Author

@pluAtAnsys can you have alook why the test_camera_modify_after_reset test is failing

feat_ssrs[0].set_type_colorimetric().set_wavelengths_range().set_end(value=800) should be: feat_ssrs[0].set_type_colorimetric().set_wavelengths_range().end = 800

That is the project unit test...

i didn'T even know yet that it is failing... i started with the sensor test

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 7, 2025
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.19%. Comparing base (52aa363) to head (a2004e5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #691      +/-   ##
==========================================
- Coverage   88.99%   88.19%   -0.81%     
==========================================
  Files          39       39              
  Lines        5653     6210     +557     
==========================================
+ Hits         5031     5477     +446     
- Misses        622      733     +111     

☔ View full report in Codecov by Sentry.
📢 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.

@github-actions github-actions bot added the testing Anything related to tests label Sep 23, 2025
Comment on lines +379 to +381
integration_type: Union[IntegrationTypes.planar, IntegrationTypes.radial] = (
IntegrationTypes.planar
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
integration_type: Union[IntegrationTypes.planar, IntegrationTypes.radial] = (
IntegrationTypes.planar
)
integration_type: IntegrationTypes = IntegrationTypes.planar

See below to post_init check

layer_type: Union[LayerTypes.none, LayerTypes.by_source] = LayerTypes.none
"""Layer separation type."""
geometries: list = None
"""Sensor geometry."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"""Sensor geometry."""
"""Sensor geometry."""
def __post_init__(self):
"""Verify the dataclass initiation."""
# Validation: restrict integration_type
if self.integration_type not in {IntegrationTypes.planar, IntegrationTypes.radial}:
raise ValueError(
f"Invalid integration_type '{self.integration_type }'. Must be planar, or radial."
)
if self.layer_type not in {None, layer_type.by_source}:
raise ValueError(
f"Invalid layer_type '{self.layer_type }'. Must be None, or by_source."
)

IntegrationTypes.planar
)
"""Integration type."""
rayfile_type: Union[RayfileTypes] = RayfileTypes.none
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
rayfile_type: Union[RayfileTypes] = RayfileTypes.none
rayfile_type: Optional[RayfileTypes] = None

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that will break the class

"""Integration type."""
rayfile_type: Union[RayfileTypes] = RayfileTypes.none
"""Rayfile type stored."""
layer_type: Union[LayerTypes.none, LayerTypes.by_source] = LayerTypes.none
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
layer_type: Union[LayerTypes.none, LayerTypes.by_source] = LayerTypes.none
layer_type: Optional[LayerTypes] = None

See below to post_init check

gamma_correction: float = 2.2
"""Gamma correction Value for the Camera Sensor."""
transmittance_file_uri: str = ""
"""Transmittance spectrum location"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"""Transmittance spectrum location"""
"""Transmittance spectrum location"""
def __post_init__(self):
"""Verify the dataclass initiation."""
# Validation: restrict layer_typenot
if self.layer_typenot in {None, LayerTypes.by_source}:
raise ValueError(
f"Invalid layer_typenot '{self.layer_typenot }'. Must be None, or by_source."
)

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

Labels

documentation Improvements or additions to documentation testing Anything related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor sensor

5 participants