Add code for 1D detector #69

Merged
usov_i merged 118 commits from det1d into master 2020-10-22 12:07:50 +02:00
10 changed files with 440 additions and 817 deletions
Showing only changes of commit 74151dd667 - Show all commits

View File

@ -72,19 +72,12 @@ def load_1D(filepath):
if "=" in line: if "=" in line:
variable, value = line.split("=") variable, value = line.split("=")
variable = variable.strip() variable = variable.strip()
try:
if variable in META_VARS_FLOAT: if variable in META_VARS_FLOAT:
det_variables["meta"][variable] = float(value) det_variables["meta"][variable] = float(value)
elif variable in META_VARS_STR: elif variable in META_VARS_STR:
det_variables["meta"][variable] = str(value)[:-1].strip() det_variables["meta"][variable] = str(value)[:-1].strip()
elif variable in META_UB_MATRIX: elif variable in META_UB_MATRIX:
det_variables["meta"][variable] = re.findall( det_variables["meta"][variable] = re.findall(r"[-+]?\d*\.\d+|\d+", str(value))
r"[-+]?\d*\.\d+|\d+", str(value)
)
except ValueError as error:
print(
"Some values are not in expected format (str or float), error:", str(error)
)
elif "#data" in line: elif "#data" in line:
if det_variables["file_type"] == "ccl": if det_variables["file_type"] == "ccl":