bugfix to previous commit

This commit is contained in:
Michael Krayer 2021-06-03 14:59:32 +02:00
parent 3afdee9e15
commit d21bf975fd
1 changed files with 6 additions and 7 deletions

View File

@ -379,18 +379,17 @@ class Field3d:
if abs(rel_shift[axis])<self.eps_collapse:
continue
elif rel_shift[axis]>0:
weights = (1.0-rel_shift[axis],rel_shift[axis])
w = rel_shift[axis] if rel_shift[axis]<=1.0 else 1.0
weights = (1.0-w,w)
data = ndimage.correlate1d(data,weights,axis=axis,mode='constant',cval=numpy.nan,origin=-1)
origin[axis] += rel_shift[axis]*self.spacing[axis]
origin[axis] += w*self.spacing[axis]
if only_keep_interior:
sl[axis] = slice(0,-1)
else:
# It has been asserted that rel_shift is within range, so map it on boundaries if necessary
if rel_shift[axis]>1.0: rel_shift[axis]=1.0
if rel_shift[axis]<-1.0: rel_shift[axis]=-1.0
weights = (-rel_shift[axis],1.0+rel_shift[axis])
w = rel_shift[axis] if rel_shift[axis]>=-1.0 else -1.0
weights = (-w,1.0+w)
data = ndimage.correlate1d(data,weights,axis=axis,mode='constant',cval=numpy.nan,origin=0)
origin[axis] += rel_shift[axis]*self.spacing[axis]
origin[axis] += w*self.spacing[axis]
if only_keep_interior:
sl[axis] = slice(1,None)
origin[axis] += self.spacing[axis]