10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 05:03:53 +01:00

Use the new extractMath function of bdd0982b92 for doubleColumn and doubleTBE handler

This commit is contained in:
Mickaël Véril 2020-08-03 17:08:20 +02:00
parent 3f52913a19
commit 6ca8c57086
2 changed files with 6 additions and 15 deletions

View File

@ -1,7 +1,7 @@
from ..formatHandlerBase import formatHandlerBase from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,AbsDataFile,getSubtablesRange,state from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,AbsDataFile,getSubtablesRange,state
from ...LaTeX import newCommand from ...LaTeX import newCommand,extractMath
import re import re
from TexSoup import TexSoup from TexSoup import TexSoup
import numpy as np import numpy as np
@ -19,13 +19,9 @@ class doubleColumnHandler(formatHandlerBase):
for rangeTrans in subtablestrans: for rangeTrans in subtablestrans:
mytrans=moltable[rangeTrans,:] mytrans=moltable[rangeTrans,:]
mytransdesc=mytrans[0:2,1] mytransdesc=mytrans[0:2,1]
for i in range(2): for i in range(2):
try: mathsoup=extractMath(mytransdesc[i],Soup=True,commands=self.commands)
mathsoup=TexSoup(mytransdesc[i])
except:
print(f"Error when parsing latex state: {str(mytransdesc[i])}")
exit(-1)
newCommand.runAll(mathsoup,self.commands)
mytransdesc[i]=str(mathsoup) mytransdesc[i]=str(mathsoup)
for colindex in range(3,np.size(table,1)): for colindex in range(3,np.size(table,1)):
col=mytrans[:,colindex] col=mytrans[:,colindex]

View File

@ -2,7 +2,7 @@ from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtablesRange,AbsDataFile,state from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtablesRange,AbsDataFile,state
from ...utils import getValFromCell, checkFloat from ...utils import getValFromCell, checkFloat
from ...LaTeX import newCommand from ...LaTeX import newCommand,extractMath
from TexSoup import TexSoup from TexSoup import TexSoup
import re import re
@formatName("doubleTBE") @formatName("doubleTBE")
@ -15,12 +15,7 @@ class doubleTBEHandler(formatHandlerBase):
data.molecule=str(table[rangeMol[0],0]) data.molecule=str(table[rangeMol[0],0])
data.method=method("TBE","CBS") data.method=method("TBE","CBS")
for mytrans in table[rangeMol]: for mytrans in table[rangeMol]:
try: mathsoup=extractMath(mytrans[1],Soup=True,commands=self.commands)
mathsoup=TexSoup(mytrans[1])
except:
print(f"Error when parsing latex state: {str(mytransdesc[i])}")
exit(-1)
newCommand.runAll(mathsoup,self.commands)
mytransdesc=str(mathsoup) mytransdesc=str(mathsoup)
infin=mytransdesc.split(r"\rightarrow") infin=mytransdesc.split(r"\rightarrow")
for i,item in enumerate(infin): for i,item in enumerate(infin):