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:
commit
1f60f96376
@ -7,11 +7,11 @@ from pathlib import Path
|
|||||||
from lib import LaTeX
|
from lib import LaTeX
|
||||||
from lib.Format import Format
|
from lib.Format import Format
|
||||||
from TexSoup import TexSoup
|
from TexSoup import TexSoup
|
||||||
from lib.data import dataFileBase,dataType
|
from lib.data import dataFileBase,DataType
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--file', type=argparse.FileType('r'))
|
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('--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('--debug', action='store_true', help='Debug mode')
|
||||||
parser.add_argument('--suffix',type=str,default=None)
|
parser.add_argument('--suffix',type=str,default=None)
|
||||||
@ -26,6 +26,6 @@ if args.debug:
|
|||||||
datapath=datapath/"test"
|
datapath=datapath/"test"
|
||||||
if not datapath.exists():
|
if not datapath.exists():
|
||||||
datapath.mkdir()
|
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:
|
for data in datalst:
|
||||||
data.toFile(datapath,args.suffix)
|
data.toFile(datapath,args.suffix)
|
@ -17,7 +17,7 @@ class state:
|
|||||||
|
|
||||||
|
|
||||||
@unique
|
@unique
|
||||||
class dataType(IntEnum):
|
class DataType(IntEnum):
|
||||||
ABS=auto()
|
ABS=auto()
|
||||||
FLUO=auto()
|
FLUO=auto()
|
||||||
class dataFileBase(object):
|
class dataFileBase(object):
|
||||||
@ -38,7 +38,7 @@ class dataFileBase(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@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=[]
|
tmplst=[]
|
||||||
for TexState in StateTablelist:
|
for TexState in StateTablelist:
|
||||||
math=TexState.find("$")
|
math=TexState.find("$")
|
||||||
@ -58,7 +58,7 @@ class dataFileBase(object):
|
|||||||
symm=m.group("symm")
|
symm=m.group("symm")
|
||||||
spgrp=m.group("special")
|
spgrp=m.group("special")
|
||||||
if spgrp is not None and spgrp=="F":
|
if spgrp is not None and spgrp=="F":
|
||||||
trsp=dataType.FLUO
|
trsp=DataType.FLUO
|
||||||
else:
|
else:
|
||||||
trsp=default
|
trsp=default
|
||||||
tygrp=m.group("type")
|
tygrp=m.group("type")
|
||||||
@ -73,7 +73,7 @@ class dataFileBase(object):
|
|||||||
return lst
|
return lst
|
||||||
|
|
||||||
@staticmethod
|
@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):
|
def getSubtableIndex(table,firstindex=2,column=0,count=1):
|
||||||
subtablesindex=list()
|
subtablesindex=list()
|
||||||
i=firstindex+count
|
i=firstindex+count
|
||||||
@ -89,8 +89,8 @@ class dataFileBase(object):
|
|||||||
|
|
||||||
datalist=list()
|
datalist=list()
|
||||||
switcher={
|
switcher={
|
||||||
dataType.ABS:AbsDataFile,
|
DataType.ABS:AbsDataFile,
|
||||||
dataType.FLUO:FluoDataFile,
|
DataType.FLUO:FluoDataFile,
|
||||||
}
|
}
|
||||||
if format==Format.LINE:
|
if format==Format.LINE:
|
||||||
for col in range(1,np.size(table,1)):
|
for col in range(1,np.size(table,1)):
|
||||||
@ -414,7 +414,7 @@ class AbsDataFile(oneStateDataFileBase):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GetFileType():
|
def GetFileType():
|
||||||
return dataType.ABS
|
return DataType.ABS
|
||||||
|
|
||||||
class FluoDataFile(oneStateDataFileBase):
|
class FluoDataFile(oneStateDataFileBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -422,7 +422,7 @@ class FluoDataFile(oneStateDataFileBase):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GetFileType():
|
def GetFileType():
|
||||||
return dataType.FLUO
|
return DataType.FLUO
|
||||||
|
|
||||||
|
|
||||||
class excitationBase:
|
class excitationBase:
|
||||||
|
Loading…
Reference in New Issue
Block a user