From 8e8e7e9f53c7b56a701f84152f78d547fbcd6576 Mon Sep 17 00:00:00 2001 From: Hampus Wikmark Kreuger <hampus.wikmark@physics.uu.se> Date: Mon, 30 May 2022 17:21:42 +0200 Subject: [PATCH] Return_hits returns a "hits" array with both x and y of hits --- src/toolbox_scs/detectors/hrixs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/toolbox_scs/detectors/hrixs.py b/src/toolbox_scs/detectors/hrixs.py index 8af3c81..28d3d88 100644 --- a/src/toolbox_scs/detectors/hrixs.py +++ b/src/toolbox_scs/detectors/hrixs.py @@ -371,6 +371,7 @@ class hRIXS: bins = self.BINS hit_x = [] hit_y = [] + hits = [] ret = np.zeros((len(data["hRIXS_det"]), bins)) for image, r in zip(data["hRIXS_det"], ret): use_image = image.to_numpy() @@ -395,6 +396,7 @@ class hRIXS: if return_hits: hit_x.append(rc[:, 0]) hit_y.append(rc[:, 1]) + hits.append(rc) hy, hx = np.histogram( rc[:, 0], bins=bins, @@ -405,7 +407,9 @@ class hRIXS: energy=np.linspace(self.Y_RANGE.start, self.Y_RANGE.stop, bins) * self.ENERGY_SLOPE + self.ENERGY_INTERCEPT) if return_hits: - return data.assign(xhits=(("trainId"), hit_x), yhits=(("trainId"), hit_y)) + return data.assign(hits=(("trainId"), hits), + xhits=(("trainId"), hit_x), + yhits=(("trainId"), hit_y)) else: return data.assign(spectrum=(("trainId", "energy"), ret)) -- GitLab