From 829ba34ee1cbfb65586fcea9919278813e170bc6 Mon Sep 17 00:00:00 2001 From: Martin Teichmann <martin.teichmann@xfel.eu> Date: Thu, 8 Dec 2022 11:30:26 +0100 Subject: [PATCH] add a very simple test for hrixs integration --- src/toolbox_scs/test/test_hrixs.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/toolbox_scs/test/test_hrixs.py diff --git a/src/toolbox_scs/test/test_hrixs.py b/src/toolbox_scs/test/test_hrixs.py new file mode 100644 index 0000000..9a50588 --- /dev/null +++ b/src/toolbox_scs/test/test_hrixs.py @@ -0,0 +1,25 @@ +import unittest + +import numpy as np +from numpy.testing import assert_array_equal +import xarray as xa +from .. import hRIXS + +class TestHRIXS(unittest.TestCase): + def test_integration(self): + data = xa.Dataset() + img = np.arange(100 * 200 * 2) + img.shape = (2, 100, 200) + data['hRIXS_det'] = (('trainId', 'x', 'y'), img) + + h = hRIXS() + h.CURVE_A = 0.1 + h.CURVE_B = 0.01 + h.Y_RANGE = slice(30, 170) + data = h.integrate(data) + self.assertEqual(data['spectrum'][1, 50].values[()], + 28517.704705882352) + self.assertEqual(data['spectrum'][1, 50].coords['energy'], 90) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file -- GitLab