mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-26 06:01:49 +02:00
disable float convertion on python side from and check only if it's possible
This commit is contained in:
parent
b0f1082ada
commit
89356b1b51
@ -1,7 +1,7 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from TexSoup import TexSoup
|
from TexSoup import TexSoup
|
||||||
from .LaTeX import newCommand
|
from .LaTeX import newCommand
|
||||||
from .utils import getValFromCell,toFloat
|
from .utils import getValFromCell,checkFloat
|
||||||
from TexSoup import TexNode
|
from TexSoup import TexNode
|
||||||
from enum import IntEnum,auto,unique,IntFlag
|
from enum import IntEnum,auto,unique,IntFlag
|
||||||
from .Format import Format
|
from .Format import Format
|
||||||
@ -139,8 +139,8 @@ class dataFileBase(object):
|
|||||||
mymethod=(method("TBE(FC)"),method("TBE"))
|
mymethod=(method("TBE(FC)"),method("TBE"))
|
||||||
finsts=dataFileBase.convertState(table[first:last+1,1],default=default,firstState=firstState,commands=commands)
|
finsts=dataFileBase.convertState(table[first:last+1,1],default=default,firstState=firstState,commands=commands)
|
||||||
for index,row in enumerate(table[first:last+1,]):
|
for index,row in enumerate(table[first:last+1,]):
|
||||||
oscilatorForces=toFloat(str(row[2]))
|
oscilatorForces=checkFloat(str(row[2]))
|
||||||
T1 = toFloat(str(row[3]))
|
T1 = checkFloat(str(row[3]))
|
||||||
val,unsafe = getValFromCell(row[4])
|
val,unsafe = getValFromCell(row[4])
|
||||||
corr,unsafecorr = getValFromCell(row[7])
|
corr,unsafecorr = getValFromCell(row[7])
|
||||||
finst=finsts[index]
|
finst=finsts[index]
|
||||||
|
@ -27,11 +27,12 @@ def getValFromCell(cell):
|
|||||||
if type(val) is TexNode and val.name=='emph':
|
if type(val) is TexNode and val.name=='emph':
|
||||||
unsafe=True
|
unsafe=True
|
||||||
val=val.string
|
val=val.string
|
||||||
val=toFloat(str(val))
|
val=checkFloat(str(val))
|
||||||
return (val,unsafe)
|
return (val,unsafe)
|
||||||
|
|
||||||
def toFloat(x):
|
def checkFloat(x):
|
||||||
try:
|
try:
|
||||||
return float(x)
|
float(x)
|
||||||
|
return x
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
Loading…
Reference in New Issue
Block a user