From 3402445caa49da15535e857b00c130222938f3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 21 Mar 2020 16:13:31 +0100 Subject: [PATCH] Starting to fix python code for QUEST#2 --- tools/lib/data.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/lib/data.py b/tools/lib/data.py index 3dc16bc4..f834dd0d 100644 --- a/tools/lib/data.py +++ b/tools/lib/data.py @@ -154,13 +154,26 @@ class dataFileBase(object): mytrans[i]=str(mathsoup) for col in range(3,np.size(table,1)): col=table[:,col] - mybasis=col[2] + mybasis=col[1] for index,cell in enumerate(col[first:last+1]): - mymethod=method(str(table[index,2],mybasis)) - if str(cell)!="": - m=re.match(r"(?P[-+]?\d*\.?\d+)\s*\((?:(?P\d*\.?\d+)\%)|(?P\d*\.?\d+)\)") - val,unsafe=getValFromCell(m.group("value")) - T1=m.group("T1") + methodnameAT1=str(table[first+index,2]) + PTString="($\%T_1$)" + HasT1=methodnameAT1.endswith(PTString) + if HasT1: + methodname=methodnameAT1[:-len(PTString)] + else: + methodname=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 finst=finsts[index] if (mymolecule,mymethod) in datacls: data=datacls[(mymolecule,mymethod)]