Skip to content

Commit

Permalink
fix issue #7, needs testing to confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHancock committed Feb 4, 2020
1 parent 76b667b commit 7165d6d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions fits_warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,25 +458,21 @@ def correct_images(fnames, suffix, testimage=False, cores=1):
data = np.float32(newdata)
else:
# Testing shows that larger strides go OOM for the parallel version
stride = int( stride// 4)
mc_stride = int(stride // 4)
# Make sure it is row-divisible
stride = (stride//ny)*ny
print("Interpolating {0} rows at a time across {1} cores".format(stride//ny, cores))
mc_stride = (mc_stride//ny)*ny
print("Interpolating {0} rows at a time across {1} cores".format(mc_stride//ny, cores))
args = []
n = 0
borders = list(range(0, len(x)+1, stride))
borders = list(range(0, len(x)+1, mc_stride))
if borders[-1] != len(x):
borders.append(len(x))
for a, b in zip(borders, borders[1:]):
# indexes into the image based on the index into the raveled data
idx = np.unravel_index(range(a, b), data.shape)
# model using an extra few lines to avoid edge effects
bp = min(b + data.shape[0]*extra_lines, len(x))
# also go backwards by a few lines
ap = max(0, a - data.shape[0]*extra_lines)
idxp = np.unravel_index(range(ap, bp), data.shape)
# # evaluate the model over this range
# calc(x1 = x[ap:bp], y1 = y[ap:bp], data = data[idxp], x2 = xy[1, a:b], y2 = xy[0, a:b])
args.append((n, x[ap:bp], y[ap:bp], xy[1, a:b], xy[0, a:b], data[idxp]))
n += 1

Expand Down

0 comments on commit 7165d6d

Please sign in to comment.