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 a496267a authored by usov_i's avatar usov_i
Browse files

Simplify check for hkl/real indices

parent 1a3ebfbc
No related branches found
No related tags found
No related merge requests found
import os import os
import re import re
from collections import defaultdict from collections import defaultdict
from decimal import Decimal
import numpy as np import numpy as np
...@@ -132,8 +131,6 @@ def parse_1D(fileobj, data_type): ...@@ -132,8 +131,6 @@ def parse_1D(fileobj, data_type):
# read data # read data
scan = {} scan = {}
if data_type == ".ccl": if data_type == ".ccl":
decimal = list()
if metadata["zebra_mode"] == "bi": if metadata["zebra_mode"] == "bi":
ccl_first_line = CCL_FIRST_LINE_BI ccl_first_line = CCL_FIRST_LINE_BI
elif metadata["zebra_mode"] == "nb": elif metadata["zebra_mode"] == "nb":
...@@ -147,10 +144,6 @@ def parse_1D(fileobj, data_type): ...@@ -147,10 +144,6 @@ def parse_1D(fileobj, data_type):
for param, (param_name, param_type) in zip(line.split(), ccl_first_line): for param, (param_name, param_type) in zip(line.split(), ccl_first_line):
d[param_name] = param_type(param) d[param_name] = param_type(param)
decimal.append(bool(Decimal(d["h_index"]) % 1 == 0))
decimal.append(bool(Decimal(d["k_index"]) % 1 == 0))
decimal.append(bool(Decimal(d["l_index"]) % 1 == 0))
# second line # second line
next_line = next(fileobj) next_line = next(fileobj)
for param, (param_name, param_type) in zip(next_line.split(), ccl_second_line): for param, (param_name, param_type) in zip(next_line.split(), ccl_second_line):
...@@ -170,11 +163,6 @@ def parse_1D(fileobj, data_type): ...@@ -170,11 +163,6 @@ def parse_1D(fileobj, data_type):
scan[d["scan_number"]] = d scan[d["scan_number"]] = d
if all(decimal):
metadata["indices"] = "hkl"
else:
metadata["indices"] = "real"
elif data_type == ".dat": elif data_type == ".dat":
# skip the first 2 rows, the third row contans the column names # skip the first 2 rows, the third row contans the column names
next(fileobj) next(fileobj)
...@@ -213,6 +201,14 @@ def parse_1D(fileobj, data_type): ...@@ -213,6 +201,14 @@ def parse_1D(fileobj, data_type):
print("Unknown file extention") print("Unknown file extention")
# utility information # utility information
if all(
s["h_index"].is_integer() and s["k_index"].is_integer() and s["l_index"].is_integer()
for s in scan.values()
):
metadata["indices"] = "hkl"
else:
metadata["indices"] = "real"
metadata["data_type"] = data_type metadata["data_type"] = data_type
metadata["area_method"] = "fit" metadata["area_method"] = "fit"
......
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