fix crash in shifted_exyz

This commit is contained in:
Jan Petykiewicz 2019-12-13 01:22:00 -08:00
parent 43936d1415
commit a900946890
2 changed files with 2 additions and 2 deletions

View File

@ -139,7 +139,7 @@ class Grid(object):
# If shift is negative, use left cell's dx to determine shift
for a in range(3):
if shifts[a] < 0:
dxyz[a] = numpy.roll(dxyz, 1)
dxyz[a] = numpy.roll(dxyz[a], 1)
return [self.exyz[a] + dxyz[a] * shifts[a] for a in range(3)]

View File

@ -99,7 +99,7 @@ def pos2ind(self,
x = self.shifted_xyz(which_shifts)[a][xi]
dx = self.shifted_dxyz(which_shifts)[a][xi]
f = (r[a] - x) / dx
# Clip to centers
grid_pos[a] = numpy.clip(xi + f, 0, self.shape[a] - 1)
return grid_pos