From 532d669d33832afbe24c7fe8c4a30de352f24520 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 27 Jan 2018 17:45:53 -0500 Subject: [PATCH] switched to more robust line based output --- processing/post/addCumulative.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/processing/post/addCumulative.py b/processing/post/addCumulative.py index 71fb1effc..4588d915c 100755 --- a/processing/post/addCumulative.py +++ b/processing/post/addCumulative.py @@ -73,22 +73,17 @@ for name in filenames: table.head_write() # ------------------------------------------ process data ------------------------------------------ - - table.data_readArray() - mask = [] 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 - - for i,values in enumerate(table.data[:,mask]): - cumulated[i,:] = cumulated[max(0,i-1),:] + values # cumulate values - - table.data = np.hstack((table.data,cumulated)) + 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) -# ------------------------------------------ output result ----------------------------------------- - - table.data_writeArray() + outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization -----------------------------------