From dfbcf4251f73db9abeeaf0e61814f7fa45795cc5 Mon Sep 17 00:00:00 2001 From: Gemma Fardell Date: Wed, 29 Apr 2026 15:56:21 +0000 Subject: [PATCH 1/2] Fix Parallel2D system_description precision error --- CHANGELOG.md | 1 + .../cil/framework/acquisition_geometry.py | 25 +++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae600908e2..97be8ed929 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 - Dependencies: - olefile and dxchange are optional dependencies, instead of required (#2209) - dxchange minimum version set to 0.2.1 to fix #2256 (#2268) 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): From 3ca3fa6932a7b3f58acd36dcb5f91a7591f60002 Mon Sep 17 00:00:00 2001 From: Gemma Fardell <47746591+gfardell@users.noreply.github.com> Date: Wed, 29 Apr 2026 17:40:20 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97be8ed929..0f38591de0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +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 + - Fix `Parallel2D` `system_description` raising exception for near-zero vectors (#2316) - Dependencies: - olefile and dxchange are optional dependencies, instead of required (#2209) - dxchange minimum version set to 0.2.1 to fix #2256 (#2268)