switched to more robust line based output

This commit is contained in:
Philip Eisenlohr 2018-01-27 17:45:53 -05:00
parent 48f8bbeec0
commit 532d669d33
1 changed files with 7 additions and 12 deletions

View File

@ -73,22 +73,17 @@ for name in filenames:
table.head_write() table.head_write()
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
table.data_readArray()
mask = [] mask = []
for col,dim in zip(columns,dims): mask += range(col,col+dim) # isolate data columns to cumulate for col,dim in zip(columns,dims): mask += range(col,col+dim) # isolate data columns to cumulate
cumulated = np.zeros(len(mask),dtype=float) # prepare output field
cumulated = np.zeros((len(table.data),len(mask))) # prepare output field outputAlive = True
while outputAlive and table.data_read(): # read next data line of ASCII table
for i,col in enumerate(mask):
cumulated[i] += float(table.data[col]) # cumulate values
table.data_append(cumulated)
for i,values in enumerate(table.data[:,mask]): outputAlive = table.data_write() # output processed line
cumulated[i,:] = cumulated[max(0,i-1),:] + values # cumulate values
table.data = np.hstack((table.data,cumulated))
# ------------------------------------------ output result -----------------------------------------
table.data_writeArray()
# ------------------------------------------ output finalization ----------------------------------- # ------------------------------------------ output finalization -----------------------------------