mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-26 14:23:42 +01:00
Try support quest#2 format
This commit is contained in:
parent
64b78ec3bf
commit
b2834312f7
@ -3,4 +3,6 @@ from enum import IntEnum,auto,unique
|
|||||||
class Format(IntEnum):
|
class Format(IntEnum):
|
||||||
LINE=auto()
|
LINE=auto()
|
||||||
COLUMN=auto()
|
COLUMN=auto()
|
||||||
|
DOUBLECOLUMN=auto()
|
||||||
TBE=auto()
|
TBE=auto()
|
||||||
|
DOUBLETBE=auto()
|
@ -136,6 +136,43 @@ class dataFileBase(object):
|
|||||||
for value in datacls.values():
|
for value in datacls.values():
|
||||||
datalist.append(value)
|
datalist.append(value)
|
||||||
return datalist
|
return datalist
|
||||||
|
elif format==Format.DOUBLECOLUMN:
|
||||||
|
subtablesindex=getSubtableIndex(table)
|
||||||
|
for first, last in subtablesindex:
|
||||||
|
mymolecule=table[first,0]
|
||||||
|
mytrans=table[first:first+1,1]
|
||||||
|
for i,mystr in enumerate(mytrans)):
|
||||||
|
mystr=mytrans[i]
|
||||||
|
try:
|
||||||
|
mathsoup=TexSoup(mystr)
|
||||||
|
except:
|
||||||
|
print(f"Error when parsing latex state: {mystr}")
|
||||||
|
exit(-1)
|
||||||
|
newCommand.runAll(mathsoup,commands)
|
||||||
|
mytrans[i]=str(mathsoup)
|
||||||
|
for col in range(3,np.size(table,1)):
|
||||||
|
col=table[:,col]
|
||||||
|
mybasis=col[2]
|
||||||
|
for index,cell in enumerate(col[first:last+1]):
|
||||||
|
mymethod=method(str(table[index,2],mybasis))
|
||||||
|
if str(cell)!="":
|
||||||
|
m=re.match(r"(?P<value>[-+]?\d*\.?\d+)\s*\((?:(?P<T1>\d*\.?\d+)\%)|(?P<?>\d*\.?\d+)\)")
|
||||||
|
val,unsafe=getValFromCell(m.group("value"))
|
||||||
|
T1=m.group("T1")
|
||||||
|
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")
|
||||||
|
for i,item in enumerate(infin):
|
||||||
|
m=re.match(r"^(?P<number>\d)\\[,:;\s]\s*\^(?P<multiplicity>\d)(?P<sym>\S*)",item)
|
||||||
|
infin[i]=state(m.group("number"),m.group("multiplicity"),m.group("sym"))
|
||||||
|
data.excitations.append(excitationValue(infin[0],infin[0],val,type=mytrans[1],isUnsafe=unsafe))
|
||||||
|
for value in datacls.values():
|
||||||
|
datalist.append(value)
|
||||||
elif format==Format.TBE:
|
elif format==Format.TBE:
|
||||||
subtablesindex=getSubtableIndex(table)
|
subtablesindex=getSubtableIndex(table)
|
||||||
for first, last in subtablesindex:
|
for first, last in subtablesindex:
|
||||||
|
Loading…
Reference in New Issue
Block a user