File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 4646import copy
4747from math import exp
4848from collections import namedtuple
49+ from typing import ClassVar
4950from ..containers import dataclass , fields
5051import numpy
5152from ..resources import resource_filename
@@ -165,6 +166,8 @@ class SensorConfig:
165166 "class for configuration of a sensor"
166167 material : SensorMaterial | str
167168 thickness : float = None
169+
170+ THICKNESS_TOLERANCE : ClassVar [float ] = 1e-6
168171
169172 def __repr__ (self ):
170173 return json .dumps (self .as_dict (), indent = 4 )
@@ -183,8 +186,11 @@ def __eq__(self, other):
183186 """Check for equality, especially for the thickness within 1µm"""
184187 if isinstance (other , self .__class__ ):
185188 if (self .material == other .material ):
186- if self .thickness and other .thickness and abs (self .thickness - other .thickness )< 1e-6 :
187- return True
189+ if (self .thickness and
190+ other .thickness and
191+ numpy .isclose (self .thickness , other .thickness , abs_tol = self .THICKNESS_TOLERANCE )):
192+
193+ return True
188194 else :
189195 return self .thickness == other .thickness
190196 return False
You can’t perform that action at this time.
0 commit comments