Simplify check for hkl/real indices
This commit is contained in:
parent
1a3ebfbcbd
commit
a496267a9d
@ -1,7 +1,6 @@
|
|||||||
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):
|
|||||||
# 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):
|
|||||||
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):
|
|||||||
|
|
||||||
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):
|
|||||||
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"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user