diff --git a/src/toolbox_scs/detectors/hrixs.py b/src/toolbox_scs/detectors/hrixs.py index 5148c07acc29510433096aa1317e65a5a6979fe0..24f87bc7aad902187693b27e73a9971a8957f6f0 100644 --- a/src/toolbox_scs/detectors/hrixs.py +++ b/src/toolbox_scs/detectors/hrixs.py @@ -432,7 +432,7 @@ class hRIXS: margin = 10 ret = np.zeros((len(data["hRIXS_det"]), bins - 2 * margin)) if self.USE_DARK: - dark_image = self.dark_image[self.X_RANGE, self.Y_RANGE] + dark_image = self.dark_image.values[self.X_RANGE, self.Y_RANGE] images = data["hRIXS_det"].values[:, self.X_RANGE, self.Y_RANGE] x, y = np.ogrid[:images.shape[1], :images.shape[2]] diff --git a/src/toolbox_scs/test/test_hrixs.py b/src/toolbox_scs/test/test_hrixs.py index 59eed1bedd86f7b0824883606dec44dc827c2720..1b5957d0d572ad04091650b0f48fc812de5da84f 100644 --- a/src/toolbox_scs/test/test_hrixs.py +++ b/src/toolbox_scs/test/test_hrixs.py @@ -22,6 +22,12 @@ class TestHRIXS(unittest.TestCase): 28517.704705882363) self.assertEqual(data['spectrum'][1, 50].coords['energy'], 90) + h.dark_image = xa.DataArray(np.ones((100, 200)), dims=('x', 'y')) + h.USE_DARK = True + h.integrate(data) + self.assertEqual(data['spectrum'][1, 50].values[()], + 28516.704705882363) + def test_centroid(self): data = xa.Dataset() img = np.array([