diff --git a/CHANGELOG.md b/CHANGELOG.md index 570e43b5f8..15bf2a936a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - `cilacc` path lookup no longer broken for editable installations (#2257) - update `version.py` to use `importlib` & fix tagless installation #2255 (#2269) - Fixed behaviour of `ZeissDataReader` when negative values are passed in the ROI (#2244) + - Fix `Parallel2D` `system_description` raising exception for near-zero vectors (#2316) - Fix `show2D` truncating plots when count is not a multiple of `num_cols` (#2315) - Dependencies: - olefile and dxchange are optional dependencies, instead of required (#2209) diff --git a/Wrappers/Python/cil/framework/acquisition_geometry.py b/Wrappers/Python/cil/framework/acquisition_geometry.py index 07e7388c13..29ca6cbb70 100644 --- a/Wrappers/Python/cil/framework/acquisition_geometry.py +++ b/Wrappers/Python/cil/framework/acquisition_geometry.py @@ -448,24 +448,17 @@ def system_description(self): \nReturns `advanced` if the the geometry has rotated or tilted rotation axis or detector, can also have offsets ''' + if not ComponentDescription.test_parallel(self.ray.direction, self.detector.normal): + return SystemConfiguration.SYSTEM_ADVANCED + + vec = ComponentDescription.create_vector(self.detector.position - self.rotation_axis.position) + dot_product = vec.dot(vec) - rays_perpendicular_detector = ComponentDescription.test_parallel(self.ray.direction, self.detector.normal) - - #rotation axis position + ray direction hits detector position - if numpy.allclose(self.rotation_axis.position, self.detector.position): #points are equal so on ray path - rotation_axis_centred = True - else: - vec_a = ComponentDescription.create_unit_vector(self.detector.position - self.rotation_axis.position) - rotation_axis_centred = ComponentDescription.test_parallel(self.ray.direction, vec_a) - - if not rays_perpendicular_detector: - config = SystemConfiguration.SYSTEM_ADVANCED - elif not rotation_axis_centred: - config = SystemConfiguration.SYSTEM_OFFSET + if abs(dot_product) < 1e-8: + return SystemConfiguration.SYSTEM_SIMPLE + else: - config = SystemConfiguration.SYSTEM_SIMPLE - - return config + return SystemConfiguration.SYSTEM_OFFSET def rotation_axis_on_detector(self):