10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2025-01-12 14:08:28 +01:00

Fix undefined variables

This commit is contained in:
Mickaël Véril 2020-07-04 15:41:24 +02:00
parent 109ab8b0c5
commit 65bc85b76c
3 changed files with 13 additions and 11 deletions

View File

@ -12,7 +12,7 @@ class TBEHandler(formatHandlerBase):
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])
initialState=self.TexOps.initialStates[mymolecule] initialState=self.TexOps.initialStates[mymolecule]
mymethod=(method("TBE(FC)"),method("TBE")) mymethod=(method("TBE(FC)"),method("TBE"))
finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=TexOps.defaultType,commands=commands) finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=self.TexOps.defaultType,commands=self.commands)
for index,row in enumerate(table[first:last+1,]): for index,row in enumerate(table[first:last+1,]):
oscilatorForces=checkFloat(str(row[2])) oscilatorForces=checkFloat(str(row[2]))
T1 = checkFloat(str(row[3])) T1 = checkFloat(str(row[3]))

View File

@ -2,6 +2,7 @@ from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtableIndex from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtableIndex
from ...utils import getValFromCell from ...utils import getValFromCell
import numpy as np
@formatName("column") @formatName("column")
class columnHandler(formatHandlerBase): class columnHandler(formatHandlerBase):
def readFromTable(self,table): def readFromTable(self,table):
@ -12,9 +13,9 @@ class columnHandler(formatHandlerBase):
datacls=dict() datacls=dict()
col=table[:,col] col=table[:,col]
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])
initialState=TexOps.initialStates[mymolecule] initialState=self.TexOps.initialStates[mymolecule]
mymethod=method(str(col[1]),str(col[0])) mymethod=method(str(col[1]),str(col[0]))
finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=TexOps.defaultType,commands=commands) finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=self.TexOps.defaultType,commands=self.commands)
for index,cell in enumerate(col[first:last+1]): for index,cell in enumerate(col[first:last+1]):
if str(cell)!="": if str(cell)!="":
val,unsafe=getValFromCell(cell) val,unsafe=getValFromCell(cell)

View File

@ -1,9 +1,10 @@
from ..formatHandlerBase import formatHandlerBase from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtableIndex from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtableIndex,state
from ...utils import getValFromCell from ...utils import getValFromCell
from TexSoup import TexSoup from TexSoup import TexSoup,TexNode
from ...LaTeX import newCommand from ...LaTeX import newCommand
import numpy as np
import json import json
@formatName("exoticColumn") @formatName("exoticColumn")
class exoticColumnHandler(formatHandlerBase): class exoticColumnHandler(formatHandlerBase):
@ -13,26 +14,26 @@ class exoticColumnHandler(formatHandlerBase):
for first, last in subtablesindex: for first, last in subtablesindex:
valDic=dict() valDic=dict()
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])
initialState=TexOps.initialStates[mymolecule] initialState=self.TexOps.initialStates[mymolecule]
for col in range(2,np.size(table,1)): for col in range(2,np.size(table,1)):
col=table[:,col] col=table[:,col]
basis=str(col[0]) basis=str(col[0])
mymethcell=list(col[1]) mymethcell=list(col[1])
if isinstance(mymethcell[0],TexNode) and mymethcell[0].name=="$": if isinstance(mymethcell[0],TexNode) and mymethcell[0].name=="$":
kindSoup=TexSoup("".join(list(mymethcell[0].expr.all))) kindSoup=TexSoup("".join(list(mymethcell[0].expr.all)))
newCommand.runAll(kindSoup,commands) newCommand.runAll(kindSoup,self.commands)
kind=str(kindSoup) kind=str(kindSoup)
methodnameSoup=TexSoup(mymethcell[1].value) methodnameSoup=TexSoup(mymethcell[1].value)
newCommand.runAll(methodnameSoup,commands) newCommand.runAll(methodnameSoup,self.commands)
methodname=str(methodnameSoup) methodname=str(methodnameSoup)
else: else:
kind="" kind=""
methtex=col[1] methtex=col[1]
newCommand.runAll(methtex,commands) newCommand.runAll(methtex,self.commands)
methodname=str(methtex) methodname=str(methtex)
mymethod=method(methodname,basis) mymethod=method(methodname,basis)
methkey=json.dumps(mymethod.__dict__) methkey=json.dumps(mymethod.__dict__)
finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=TexOps.default,commands=commands) finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=self.TexOps.default,commands=self.commands)
for index,cell in enumerate(col[first:last+1]): for index,cell in enumerate(col[first:last+1]):
if str(cell)!="": if str(cell)!="":
val,unsafe=getValFromCell(cell) val,unsafe=getValFromCell(cell)
@ -56,7 +57,7 @@ class exoticColumnHandler(formatHandlerBase):
#data.excitations.append(excitationValue(initialState,finst[0],val,type=finst[2])) #data.excitations.append(excitationValue(initialState,finst[0],val,type=finst[2]))
for dt,methdic in valDic.items(): for dt,methdic in valDic.items():
for methstring,exdic in methdic.items(): for methstring,exdic in methdic.items():
data=switcher[dt]() data=datafileSelector[dt]()
data.molecule=mymolecule data.molecule=mymolecule
methdic=json.loads(methstring) methdic=json.loads(methstring)
data.method=method(methdic["name"],methdic["basis"]) data.method=method(methdic["name"],methdic["basis"])