Skip to content

Commit

Permalink
Merge pull request #624 from HEXRD/clip-to-panel-speedup
Browse files Browse the repository at this point in the history
Do not set values to 0 that are not referenced.
  • Loading branch information
Zack authored Apr 2, 2024
2 parents 68bff27 + c9518e0 commit 74229b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hexrd/instrument/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -931,6 +930,7 @@ def interpolate_nearest(self, xy, img, pad_with_nans=True):
int_xy[on_panel] = int_vals
return int_xy


def interpolate_bilinear(self, xy, img, pad_with_nans=True):
"""
Interpolate an image array at the specified cartesian points.
Expand Down

0 comments on commit 74229b8

Please sign in to comment.