Skip to content

Check the precision for the thickness and stop complaining for difference in the nm scale#2770

Merged
kif merged 7 commits intosilx-kit:mainfrom
kif:2765_precison_thickness
Jan 30, 2026
Merged

Check the precision for the thickness and stop complaining for difference in the nm scale#2770
kif merged 7 commits intosilx-kit:mainfrom
kif:2765_precison_thickness

Conversation

@kif
Copy link
Member

@kif kif commented Jan 27, 2026

close #2765

@gudlot
Copy link
Collaborator

gudlot commented Jan 27, 2026

@kif I see you are working on this issue. I would like to show you my version in a bit, too. Should I do this in a new PR then?

@kif
Copy link
Member Author

kif commented Jan 27, 2026

You can submit another PR ...

return self.thickness == other.thickness
if isinstance(other, self.__class__):
if (self.material == other.material):
if self.thickness and other.thickness and abs(self.thickness - other.thickness)<1e-6:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another option would be to use isclose
isclose(self.thickness, other.thickness, abs_tol=SensorConfig.THICKNESS_TOLERANCE)

I declared the tolerance as class variable.

if isinstance(sensor, SensorConfig):
if sensor not in self.SENSORS:
logger.warning("Sensor %s not in allowed SENSORS: %s", sensor, self.SENSORS)
logger.warning("Sensor %s not in allowed SENSORS: [%s].", sensor, "|".join([str(i) for i in self.SENSORS]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

@kif Could you also choose here directly a generator comprehension?

Copy link
Collaborator

@gudlot gudlot left a comment

Choose a reason for hiding this comment

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

Nice, @kif !

@gudlot gudlot closed this Jan 30, 2026
@kif kif reopened this Jan 30, 2026
@kif kif merged commit 136d73c into silx-kit:main Jan 30, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating-point precision in PONI serialization causes sensor validation warnings

2 participants