From 35cf1fb8114700feac5a60736761a946964684ef Mon Sep 17 00:00:00 2001 From: Zack Singer Date: Fri, 29 Mar 2024 12:47:14 -0400 Subject: [PATCH 1/2] Do not set values to 0 that are not referenced. --- hexrd/instrument/detector.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hexrd/instrument/detector.py b/hexrd/instrument/detector.py index a05fc6c9c..bfcb94c5a 100644 --- a/hexrd/instrument/detector.py +++ b/hexrd/instrument/detector.py @@ -878,10 +878,9 @@ def clip_to_panel(self, xy, buffer_edges=True): idx = np.logical_or(roff, coff) - pix[idx, :] = 0 - - on_panel = self.panel_buffer[pix[:, 0], pix[:, 1]] - on_panel[idx] = False + on_panel = np.full(pix.shape[0], False) + valid_pix = pix[~idx, :] + on_panel[~idx] = self.panel_buffer[valid_pix[:, 0], valid_pix[:, 1]] else: xlim -= self.panel_buffer[0] ylim -= self.panel_buffer[1] @@ -931,6 +930,7 @@ def interpolate_nearest(self, xy, img, pad_with_nans=True): int_xy[on_panel] = int_vals return int_xy + @profile def interpolate_bilinear(self, xy, img, pad_with_nans=True): """ Interpolate an image array at the specified cartesian points. From c9518e03b940e3117526d64b1cc6805b3eab43d6 Mon Sep 17 00:00:00 2001 From: Zack Singer Date: Fri, 29 Mar 2024 12:52:09 -0400 Subject: [PATCH 2/2] Remove stray "@profile" --- hexrd/instrument/detector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hexrd/instrument/detector.py b/hexrd/instrument/detector.py index bfcb94c5a..587faced5 100644 --- a/hexrd/instrument/detector.py +++ b/hexrd/instrument/detector.py @@ -930,7 +930,7 @@ def interpolate_nearest(self, xy, img, pad_with_nans=True): int_xy[on_panel] = int_vals return int_xy - @profile + def interpolate_bilinear(self, xy, img, pad_with_nans=True): """ Interpolate an image array at the specified cartesian points.