Skip to content

Commit

Permalink
resample: linspace wants inclusive bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
dstndstn committed May 4, 2015
1 parent 62968ba commit c851e97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions util/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ def streaming_text_table(forfn, skiplines=0, split=None, maxcols=None,
t1 = time.clock()

floattypes = [float,np.float32,np.float64]
inttypes = [int, np.int32, np.int64]
inttypes = [int, np.int16, np.int32, np.int64]

for dat,typ in zip(data, coltypes):
if typ in floattypes:
Expand All @@ -876,8 +876,13 @@ def streaming_text_table(forfn, skiplines=0, split=None, maxcols=None,
# trim to valid rows
data = [dat[:goodrows] for dat in data]
# convert
data = [np.array(dat).astype(typ) for dat,typ in zip(data, coltypes)]

try:
data = [np.array(dat).astype(typ) for dat,typ in zip(data, coltypes)]
except:
for name,dat,typ in zip(colnames, data, coltypes):
print 'Column', name
np.array(dat).astype(typ)
raise
t3 = time.clock()

#print 'Reading & splitting:', t1-t0
Expand Down
4 changes: 2 additions & 2 deletions util/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ def resample_with_wcs(targetwcs, wcs, Limages, L, spline=True,
margin = splineMargin
step = splineStep
xlo = max(0, x0-margin)
xhi = min(W, x1+margin+1)
xhi = min(W-1, x1+margin)
nx = np.ceil(float(xhi - xlo) / step) + 1
xx = np.linspace(xlo, xhi, nx)
ylo = max(0, y0-margin)
yhi = min(H, y1+margin+1)
yhi = min(H-1, y1+margin)
ny = np.ceil(float(yhi - ylo) / step) + 1
yy = np.linspace(ylo, yhi, ny)

Expand Down

0 comments on commit c851e97

Please sign in to comment.