Z changed cami into h5meta
This commit is contained in:
parent
5c32478104
commit
f75d6c2f31
@ -50,14 +50,14 @@ filelist.on_change("value", filelist_callback)
|
|||||||
|
|
||||||
|
|
||||||
def fileinput_callback(_attr, _old, new):
|
def fileinput_callback(_attr, _old, new):
|
||||||
cami_list = pyzebra.read_cami(new)
|
h5meta_list = pyzebra.read_h5meta(new)
|
||||||
file_list = cami_list["filelist"]
|
file_list = h5meta_list["filelist"]
|
||||||
filelist.menu = file_list
|
filelist.menu = file_list
|
||||||
|
|
||||||
|
|
||||||
fileinput = TextInput()
|
fileinput = TextInput()
|
||||||
fileinput.on_change("value", fileinput_callback)
|
fileinput.on_change("value", fileinput_callback)
|
||||||
#fileinput.value = "/home/usov_i/psi-projects/sinq/data/1.cami"
|
fileinput.value = "/Users/zaharko/1work/ZeBRa/ZebraSoftware/python_for_zebra/hdfdata/1.cami"
|
||||||
|
|
||||||
|
|
||||||
def index_spinner_callback(_attr, _old, new):
|
def index_spinner_callback(_attr, _old, new):
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
import h5py
|
import h5py
|
||||||
|
|
||||||
|
|
||||||
def read_cami(filepath):
|
def read_h5meta(filepath):
|
||||||
"""Read and parse content of a cami file.
|
"""Read and parse content of a h5meta file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filepath (str): File path of a cami file.
|
filepath (str): File path of a h5meta file.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict: A dictionary with section names and their content.
|
dict: A dictionary with section names and their content.
|
||||||
"""
|
"""
|
||||||
cami_content = dict()
|
h5meta_content = dict()
|
||||||
with open(filepath, "r") as cami_file:
|
with open(filepath, "r") as h5meta_file:
|
||||||
line = cami_file.readline()
|
line = h5meta_file.readline()
|
||||||
while line:
|
while line:
|
||||||
if line.startswith("#begin"):
|
if line.startswith("#begin"):
|
||||||
# read section
|
# read section
|
||||||
section = line[7:-1] # len("#begin ") = 7
|
section = line[7:-1] # len("#begin ") = 7
|
||||||
cami_content[section] = []
|
h5meta_content[section] = []
|
||||||
line = cami_file.readline()
|
line = h5meta_file.readline()
|
||||||
while not line.startswith("#end"):
|
while not line.startswith("#end"):
|
||||||
cami_content[section].append(line[:-1])
|
h5meta_content[section].append(line[:-1])
|
||||||
line = cami_file.readline()
|
line = h5meta_file.readline()
|
||||||
|
|
||||||
# read next line after section's end
|
# read next line after section's end
|
||||||
line = cami_file.readline()
|
line = h5meta_file.readline()
|
||||||
|
|
||||||
return cami_content
|
return h5meta_content
|
||||||
|
|
||||||
|
|
||||||
def read_detector_data(filepath):
|
def read_detector_data(filepath):
|
||||||
@ -48,18 +48,18 @@ def read_detector_data(filepath):
|
|||||||
return detector_data
|
return detector_data
|
||||||
|
|
||||||
|
|
||||||
def open_cami(filepath):
|
def open_h5meta(filepath):
|
||||||
"""Open cami scan (?)
|
"""Open h5meta file
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filepath (str): File path of a cami file.
|
filepath (str): File path of a h5meta file.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict: A dictionary with h5 names and their detector data.
|
dict: A dictionary with h5 names and their detector data.
|
||||||
"""
|
"""
|
||||||
data = dict()
|
data = dict()
|
||||||
cami_content = read_cami(filepath)
|
h5meta_content = read_h5meta(filepath)
|
||||||
for file in cami_content["filelist"]:
|
for file in h5meta_content["filelist"]:
|
||||||
data[file] = read_detector_data(file)
|
data[file] = read_detector_data(file)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user