10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 22:03:49 +01:00

Use dictionary for GetTypeFromAcronym

This commit is contained in:
Mickaël Véril 2020-11-04 14:18:12 +01:00
parent 114a62bb11
commit a130be8fd6

View File

@ -7,22 +7,19 @@ import numpy as np
import json import json
import itertools import itertools
def GetTypeFromAcronym(acronym): def GetTypeFromAcronym(acronym):
if acronym=="npi": acroDict={
return r"n \rightarrow \pi^\star" "npi":r"n \rightarrow \pi^\star",
elif acronym=="ppi": "ppi":r"\pi \rightarrow \pi^\star",
return r"\pi \rightarrow \pi^\star" "n3s":r"n \rightarrow 3s",
elif acronym=="n3s": "dou":"double",
return r"n \rightarrow 3s" "p3p":r"\pi \rightarrow 3p",
elif acronym=="dou": "spi":r"\sigma \rightarrow \pi^\star",
return "double" "non-d":None
elif acronym=="p3p": }
return r"\pi \rightarrow 3p" try:
elif acronym=="spi": return acroDict[acronym]
return r"\sigma \rightarrow \pi^\star" except KeyError as ex:
elif acronym=="non-d": raise ValueError("Unrecognized acronym") from ex
return None
else:
raise ValueError("Unrecognized acronym")
def GetFullState(TexState,defaultDatatype=DataType.ABS,VR=None,typeAcronym=None,Soup=True): def GetFullState(TexState,defaultDatatype=DataType.ABS,VR=None,typeAcronym=None,Soup=True):
datatype=defaultDatatype datatype=defaultDatatype
lst=list(TexState) lst=list(TexState)