Only read position coordinates for grid detection. Needs data_rewind before writing of (condensed due to readArray) head.

This commit is contained in:
Philip Eisenlohr 2016-04-24 09:22:07 -05:00
parent 3b53d1bc82
commit 648c2dd1d3
1 changed files with 5 additions and 5 deletions

View File

@ -76,14 +76,15 @@ for name in filenames:
# --------------- figure out size and grid --------------------------------------------------------- # --------------- figure out size and grid ---------------------------------------------------------
table.data_readArray() table.data_readArray(options.coords)
table.data_rewind()
coords = [np.unique(table.data[:,colCoord+i]) for i in xrange(3)] coords = [np.unique(table.data[:,i]) for i in xrange(3)]
mincorner = np.array(map(min,coords)) mincorner = np.array(map(min,coords))
maxcorner = np.array(map(max,coords)) maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i') grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1) size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings
packing = np.array(options.packing,'i') packing = np.array(options.packing,'i')
outSize = grid*packing outSize = grid*packing
@ -95,7 +96,6 @@ for name in filenames:
# ------------------------------------------ process data ------------------------------------------- # ------------------------------------------ process data -------------------------------------------
table.data_rewind()
data = np.zeros(outSize.tolist()+[len(table.labels)]) data = np.zeros(outSize.tolist()+[len(table.labels)])
p = np.zeros(3,'i') p = np.zeros(3,'i')