From 782677f88b0403bd08b127c956346a319a22feec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Thu, 26 Mar 2020 16:29:18 +0100 Subject: [PATCH] Fix DOUBLECOLUMN format --- tools/lib/data.py | 100 +++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/tools/lib/data.py b/tools/lib/data.py index c03ba6eb..3d9c38cf 100644 --- a/tools/lib/data.py +++ b/tools/lib/data.py @@ -75,10 +75,14 @@ class dataFileBase(object): def readFromTable(table,format=Format.LINE,default=dataType.ABS ,firstState=state(1,1,"A_1"),commands=[]): def getSubtableIndex(table,firstindex=2,column=0,count=1): subtablesindex=list() - for i in range(firstindex+count,np.size(table,0)): + i=firstindex+count + while i[-+]?\d+\.?\d*)\s*\((?P\d*\.?\d+)\%\)$",strcell) - val,unsafe=getValFromCell(TexSoup(m.group("value"))) - T1=m.group("T1") + methodname=methodnameAT1[:-len(PTString)] else: - m=re.match(r"^[-+]?\d+\.?\d*",strcell) - val,unsafe=getValFromCell(TexSoup(m.group(0))) - T1=None - finst=finsts[index] - if (mymolecule,mymethod) in datacls: - data=datacls[(mymolecule,mymethod)] - else: - data=AbsDataFile() - data.molecule=mymolecule - data.method=mymethod - infin=mytrans.split("\rightarrow") + methodname=str(methodnameAT1) + mymethod=method(methodname,mybasis) + strcell=str(cell) + if strcell!="": + if HasT1: + m=re.match(r"^(?P[-+]?\d+\.?\d*)\s*(?:\((?P\d+\.?\d*)\\\%\))?",strcell) + val,unsafe=getValFromCell(TexSoup(m.group("value"))) + T1=m.group("T1") + else: + m=re.match(r"^[-+]?\d+\.?\d*",strcell) + val,unsafe=getValFromCell(TexSoup(m.group(0))) + T1=None + if (mymolecule,mymethod.name,mymethod.basis) in datacls: + data=datacls[(mymolecule,mymethod.name,mymethod.basis)] + else: + data=AbsDataFile() + data.molecule=mymolecule + data.method=mymethod + datacls[(mymolecule,mymethod.name,mymethod.basis)]=data + infin=mytransdesc[0].split(r"\rightarrow") for i,item in enumerate(infin): - m=re.match(r"^(?P\d)\\[,:;\s]\s*\^(?P\d)(?P\S*)",item) + m=re.match(r"^(?P\d)\\[,:;\s]\s*\^(?P\d)(?P\S*)",item.strip()) infin[i]=state(m.group("number"),m.group("multiplicity"),m.group("sym")) - data.excitations.append(excitationValue(infin[0],infin[1],val,type=mytrans[1],isUnsafe=unsafe,T1=T1)) - for value in datacls.values(): - datalist.append(value) + data.excitations.append(excitationValue(infin[0],infin[1],val,type=mytransdesc[1],isUnsafe=unsafe,T1=T1)) + for value in datacls.values(): + datalist.append(value) + return datalist elif format==Format.TBE: subtablesindex=getSubtableIndex(table) for first, last in subtablesindex: