10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01:00

Merge branch 'master' into specialTexCommandOption

This commit is contained in:
Mickaël Véril 2020-06-18 12:27:47 +02:00
commit 1f60f96376
2 changed files with 11 additions and 11 deletions

View File

@ -7,11 +7,11 @@ from pathlib import Path
from lib import LaTeX
from lib.Format import Format
from TexSoup import TexSoup
from lib.data import dataFileBase,dataType
from lib.data import dataFileBase,DataType
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--file', type=argparse.FileType('r'))
parser.add_argument('--defaultType', type=str, choices=[t.name for t in list(dataType)])
parser.add_argument('--defaultType', type=str, choices=[t.name for t in list(DataType)])
parser.add_argument('--format',type=str, choices=[t.name for t in list(Format)],default=Format.LINE.name)
parser.add_argument('--debug', action='store_true', help='Debug mode')
parser.add_argument('--suffix',type=str,default=None)
@ -26,6 +26,6 @@ if args.debug:
datapath=datapath/"test"
if not datapath.exists():
datapath.mkdir()
datalst=dataFileBase.readFromTable(dat,format=Format[args.format],default=dataType[args.defaultType],commands=commands)
datalst=dataFileBase.readFromTable(dat,format=Format[args.format],default=DataType[args.defaultType],commands=commands)
for data in datalst:
data.toFile(datapath,args.suffix)

View File

@ -17,7 +17,7 @@ class state:
@unique
class dataType(IntEnum):
class DataType(IntEnum):
ABS=auto()
FLUO=auto()
class dataFileBase(object):
@ -38,7 +38,7 @@ class dataFileBase(object):
pass
@staticmethod
def convertState(StateTablelist,default=dataType.ABS,firstState=state(1,1,"A_1"),commands=[]):
def convertState(StateTablelist,default=DataType.ABS,firstState=state(1,1,"A_1"),commands=[]):
tmplst=[]
for TexState in StateTablelist:
math=TexState.find("$")
@ -58,7 +58,7 @@ class dataFileBase(object):
symm=m.group("symm")
spgrp=m.group("special")
if spgrp is not None and spgrp=="F":
trsp=dataType.FLUO
trsp=DataType.FLUO
else:
trsp=default
tygrp=m.group("type")
@ -73,7 +73,7 @@ class dataFileBase(object):
return lst
@staticmethod
def readFromTable(table,format=Format.LINE,default=dataType.ABS ,firstState=state(1,1,"A_1"),commands=[]):
def readFromTable(table,format=Format.LINE,default=DataType.ABS ,firstState=state(1,1,"A_1"),commands=[]):
def getSubtableIndex(table,firstindex=2,column=0,count=1):
subtablesindex=list()
i=firstindex+count
@ -89,8 +89,8 @@ class dataFileBase(object):
datalist=list()
switcher={
dataType.ABS:AbsDataFile,
dataType.FLUO:FluoDataFile,
DataType.ABS:AbsDataFile,
DataType.FLUO:FluoDataFile,
}
if format==Format.LINE:
for col in range(1,np.size(table,1)):
@ -414,7 +414,7 @@ class AbsDataFile(oneStateDataFileBase):
@staticmethod
def GetFileType():
return dataType.ABS
return DataType.ABS
class FluoDataFile(oneStateDataFileBase):
def __init__(self):
@ -422,7 +422,7 @@ class FluoDataFile(oneStateDataFileBase):
@staticmethod
def GetFileType():
return dataType.FLUO
return DataType.FLUO
class excitationBase: