diff --git a/RMA2SERAPHIN_3DRMA11.py b/RMA2SERAPHIN_3DRMA11.py index 09f1eb5..75ea769 100644 --- a/RMA2SERAPHIN_3DRMA11.py +++ b/RMA2SERAPHIN_3DRMA11.py @@ -311,8 +311,15 @@ def writePCTL(c,pctl): f.write(struct.pack(">l",len(NodeList)*4)) columnName = [node2nodevalue[key] if key in node2nodevalue.keys() else key for key, value in nodeDict.items()] + global dfAll - dfAll = pd.DataFrame(columns=columnName) + dfAll = {} + + for key, value in nodeDict.items(): + if key in node2nodevalue.keys(): + key = node2nodevalue[key] + + dfAll[key] = np.array([]) cpt = 0 @@ -335,8 +342,8 @@ def writePCTL(c,pctl): for n in nodelayer[key]: tempArr.append(tempR[n]) tempVal1 = max(tempArr) - - dfAll.loc[cpt,key] = tempVal1 + dfAll[key] = np.append(dfAll[key],tempVal1) + cpt = cpt + 1 for p in pctl: @@ -345,7 +352,7 @@ def writePCTL(c,pctl): for key, value in nodeDict.items(): if key in node2nodevalue.keys(): key = node2nodevalue[key] - f.write(struct.pack(">f",dfAll[key].quantile(p))) + f.write(struct.pack(">f",np.quantile(dfAll[key],p))) f.write(struct.pack(">l",len(NodeList)*4)) @@ -447,7 +454,6 @@ for run in RMAfilenames: print(c) if option == 'Percentile': - df2 = pd.DataFrame() for c in constNum: writePCTL(c,percentiles) else: