Skip to content

Commit

Permalink
Do not set values to 0 that are not referenced.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zack Singer committed Mar 29, 2024
1 parent 03f0e33 commit 35cf1fb
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

@profile
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 35cf1fb

Please sign in to comment.