Update load_1D.py

changed the dat part
This commit is contained in:
JakHolzer 2020-10-19 15:05:31 +02:00 committed by GitHub
parent 8104c54302
commit f62aab74b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,8 +96,8 @@ def parse_1D(fileobj, data_type):
break break
# read data # read data
measurements = {}
if data_type == ".ccl": if data_type == ".ccl":
measurements = {}
decimal = list() decimal = list()
for line in fileobj: for line in fileobj:
counts = [] counts = []
@ -155,8 +155,8 @@ def parse_1D(fileobj, data_type):
next(fileobj) next(fileobj)
next(fileobj) next(fileobj)
col_names = next(fileobj).split() col_names = next(fileobj).split()
data_cols = defaultdict(list) data_cols = defaultdict(list)
for line in fileobj: for line in fileobj:
if "END-OF-DATA" in line: if "END-OF-DATA" in line:
# this is the end of data # this is the end of data
@ -165,7 +165,15 @@ def parse_1D(fileobj, data_type):
for name, val in zip(col_names, line.split()): for name, val in zip(col_names, line.split()):
data_cols[name].append(float(val)) data_cols[name].append(float(val))
measurements = dict(data_cols) data_cols['h_index'] = float(metadata['title'].split()[-3])
data_cols['k_index'] = float(metadata['title'].split()[-2])
data_cols['l_index'] = float(metadata['title'].split()[-1])
data_cols['temperature'] = metadata['temp']
data_cols['mag_field'] = metadata['mf']
data_cols['omega_angle'] = metadata['omega']
data_cols['number_of_measurements'] = len(data_cols['om'])
data_cols['monitor'] = data_cols['Monitor1'][0]
measurements["1"] = dict(data_cols)
else: else:
print("Unknown file extention") print("Unknown file extention")