diff --git a/src/pyFAI/io/integration_config.py b/src/pyFAI/io/integration_config.py index 37dd30090..f4f998d03 100644 --- a/src/pyFAI/io/integration_config.py +++ b/src/pyFAI/io/integration_config.py @@ -31,7 +31,7 @@ __author__ = "Jerome Kieffer" __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "15/04/2024" +__date__ = "04/07/2024" __docformat__ = 'restructuredtext' import logging @@ -76,9 +76,12 @@ def _patch_v1_to_v2(config): :param dict config: Dictionary reworked inplace. """ - - value = config.pop("poni", None) detector = None + value = config.pop("poni", None) + if value is None and "poni_version" in config: + # Anachronistic configuration, bug found in #2227 + value = config.copy() + config.clear() # Do not change the object: empty in place if value: # Use the poni file while it is not overwrited by a key of the config # dictionary diff --git a/src/pyFAI/test/test_worker.py b/src/pyFAI/test/test_worker.py index b6437e536..a37f61fe2 100644 --- a/src/pyFAI/test/test_worker.py +++ b/src/pyFAI/test/test_worker.py @@ -32,7 +32,7 @@ __contact__ = "valentin.valls@esrf.fr" __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "30/04/2024" +__date__ = "04/07/2024" import unittest import logging @@ -439,6 +439,29 @@ def test_old(self): ai = worker.ai self.assertTrue(numpy.allclose(config["shape"], ai.detector.max_shape)) + def test_regression_2227(self): + """pixel size got lost with generic detector""" + worker_generic = Worker() + integration_options_generic = {'poni_version': 2.1, + 'detector': 'Detector', + 'detector_config': {'pixel1': 1e-4, + 'pixel2': 1e-4, + 'max_shape': [576, 748], + 'orientation': 3}, + 'dist': 0.16156348926909264, + 'poni1': 1.4999999999999998, + 'poni2': 1.4999999999999998, + 'rot1': 1.0822864853552985, + 'rot2': -0.41026007690779387, + 'rot3': 0.0, + 'wavelength': 1.0332016536100021e-10} + worker_generic.set_config(integration_options_generic) + self.assertEqual(worker_generic.ai.detector.pixel1, 1e-4, "Pixel1 size matches") + self.assertEqual(worker_generic.ai.detector.pixel2, 1e-4, "Pixel2 size matches") + self.assertEqual(worker_generic.ai.detector.shape, [576, 748], "Shape matches") + self.assertEqual(worker_generic.ai.detector.orientation, 3, "Orientation matches") + + def suite(): loader = unittest.defaultTestLoader.loadTestsFromTestCase testsuite = unittest.TestSuite() diff --git a/version.py b/version.py index 80034e256..c3b037f88 100755 --- a/version.py +++ b/version.py @@ -47,7 +47,7 @@ __authors__ = ["Jérôme Kieffer", "V. Valls"] __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "03/06/2024" +__date__ = "04/07/2024" __status__ = "production" __docformat__ = 'restructuredtext' __all__ = ["date", "version_info", "strictversion", "hexversion", "debianversion", @@ -61,7 +61,7 @@ "final": 15} MAJOR = 2024 -MINOR = 6 +MINOR = 7 MICRO = 0 RELEV = "dev" # <16 SERIAL = 0 # <16