Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 6f83292d authored by usov_i's avatar usov_i
Browse files

Temporary resolve issues with new format metadata

parent 7075e0f4
No related branches found
No related tags found
No related merge requests found
...@@ -109,24 +109,29 @@ def parse_1D(fileobj, data_type): ...@@ -109,24 +109,29 @@ def parse_1D(fileobj, data_type):
variable = variable.strip() variable = variable.strip()
value = value.strip() value = value.strip()
if variable in META_VARS_STR: try:
metadata[variable] = value if variable in META_VARS_STR:
metadata[variable] = value
elif variable in META_VARS_FLOAT:
if variable == "2-theta": # fix that angle name not to be an expression elif variable in META_VARS_FLOAT:
variable = "twotheta" if variable == "2-theta": # fix that angle name not to be an expression
if variable in ("a", "b", "c", "alpha", "beta", "gamma"): variable = "twotheta"
variable += "_cell" if variable in ("a", "b", "c", "alpha", "beta", "gamma"):
metadata[variable] = float(value) variable += "_cell"
metadata[variable] = float(value)
elif variable in META_UB_MATRIX:
if variable == "UB": elif variable in META_UB_MATRIX:
metadata["ub"] = np.array(literal_eval(value)).reshape(3, 3) if variable == "UB":
else: metadata["ub"] = np.array(literal_eval(value)).reshape(3, 3)
if "ub" not in metadata: else:
metadata["ub"] = np.zeros((3, 3)) if "ub" not in metadata:
row = int(variable[-2]) - 1 metadata["ub"] = np.zeros((3, 3))
metadata["ub"][row, :] = list(map(float, value.split())) row = int(variable[-2]) - 1
metadata["ub"][row, :] = list(map(float, value.split()))
except Exception:
print(f"Error reading {variable} with value '{value}'")
metadata[variable] = 0
if "#data" in line: if "#data" in line:
# this is the end of metadata and the start of data section # this is the end of metadata and the start of data section
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment