Rename data into counts for hdf5 zebra data
This commit is contained in:
@ -260,10 +260,10 @@ def create():
|
|||||||
|
|
||||||
def update_overview_plot():
|
def update_overview_plot():
|
||||||
scan = _get_selected_scan()
|
scan = _get_selected_scan()
|
||||||
h5_data = scan["data"]
|
counts = scan["counts"]
|
||||||
n_im, n_y, n_x = h5_data.shape
|
n_im, n_y, n_x = counts.shape
|
||||||
overview_x = np.mean(h5_data, axis=1)
|
overview_x = np.mean(counts, axis=1)
|
||||||
overview_y = np.mean(h5_data, axis=2)
|
overview_y = np.mean(counts, axis=2)
|
||||||
|
|
||||||
# normalize for simpler colormapping
|
# normalize for simpler colormapping
|
||||||
overview_max_val = max(np.max(overview_x), np.max(overview_y))
|
overview_max_val = max(np.max(overview_x), np.max(overview_y))
|
||||||
|
@ -115,7 +115,7 @@ def create():
|
|||||||
print("Could not read data from the file.")
|
print("Could not read data from the file.")
|
||||||
return
|
return
|
||||||
|
|
||||||
last_im_index = scan["data"].shape[0] - 1
|
last_im_index = scan["counts"].shape[0] - 1
|
||||||
|
|
||||||
index_spinner.value = 0
|
index_spinner.value = 0
|
||||||
index_spinner.high = last_im_index
|
index_spinner.high = last_im_index
|
||||||
@ -157,7 +157,7 @@ def create():
|
|||||||
if index is None:
|
if index is None:
|
||||||
index = index_spinner.value
|
index = index_spinner.value
|
||||||
|
|
||||||
current_image = scan["data"][index]
|
current_image = scan["counts"][index]
|
||||||
proj_v_line_source.data.update(
|
proj_v_line_source.data.update(
|
||||||
x=np.arange(0, IMAGE_W) + 0.5, y=np.mean(current_image, axis=0)
|
x=np.arange(0, IMAGE_W) + 0.5, y=np.mean(current_image, axis=0)
|
||||||
)
|
)
|
||||||
@ -223,10 +223,10 @@ def create():
|
|||||||
)
|
)
|
||||||
|
|
||||||
def update_overview_plot():
|
def update_overview_plot():
|
||||||
h5_data = scan["data"]
|
counts = scan["counts"]
|
||||||
n_im, n_y, n_x = h5_data.shape
|
n_im, n_y, n_x = counts.shape
|
||||||
overview_x = np.mean(h5_data, axis=1)
|
overview_x = np.mean(counts, axis=1)
|
||||||
overview_y = np.mean(h5_data, axis=2)
|
overview_y = np.mean(counts, axis=2)
|
||||||
|
|
||||||
# normalize for simpler colormapping
|
# normalize for simpler colormapping
|
||||||
overview_max_val = max(np.max(overview_x), np.max(overview_y))
|
overview_max_val = max(np.max(overview_x), np.max(overview_y))
|
||||||
@ -438,13 +438,13 @@ def create():
|
|||||||
|
|
||||||
def box_edit_callback(_attr, _old, new):
|
def box_edit_callback(_attr, _old, new):
|
||||||
if new["x"]:
|
if new["x"]:
|
||||||
h5_data = scan["data"]
|
counts = scan["counts"]
|
||||||
x_val = np.arange(h5_data.shape[0])
|
x_val = np.arange(counts.shape[0])
|
||||||
left = int(np.floor(new["x"][0]))
|
left = int(np.floor(new["x"][0]))
|
||||||
right = int(np.ceil(new["x"][0] + new["width"][0]))
|
right = int(np.ceil(new["x"][0] + new["width"][0]))
|
||||||
bottom = int(np.floor(new["y"][0]))
|
bottom = int(np.floor(new["y"][0]))
|
||||||
top = int(np.ceil(new["y"][0] + new["height"][0]))
|
top = int(np.ceil(new["y"][0] + new["height"][0]))
|
||||||
y_val = np.sum(h5_data[:, bottom:top, left:right], axis=(1, 2))
|
y_val = np.sum(counts[:, bottom:top, left:right], axis=(1, 2))
|
||||||
else:
|
else:
|
||||||
x_val = []
|
x_val = []
|
||||||
y_val = []
|
y_val = []
|
||||||
|
@ -68,13 +68,13 @@ def read_detector_data(filepath, cami_meta=None):
|
|||||||
ndarray: A 3D array of data, omega, gamma, nu.
|
ndarray: A 3D array of data, omega, gamma, nu.
|
||||||
"""
|
"""
|
||||||
with h5py.File(filepath, "r") as h5f:
|
with h5py.File(filepath, "r") as h5f:
|
||||||
data = h5f["/entry1/area_detector2/data"][:]
|
counts = h5f["/entry1/area_detector2/data"][:]
|
||||||
|
|
||||||
# reshape data to a correct shape (2006 issue)
|
# reshape images (counts) to a correct shape (2006 issue)
|
||||||
n, cols, rows = data.shape
|
n, cols, rows = counts.shape
|
||||||
data = data.reshape(n, rows, cols)
|
counts = counts.reshape(n, rows, cols)
|
||||||
|
|
||||||
scan = {"data": data}
|
scan = {"counts": counts}
|
||||||
scan["original_filename"] = filepath
|
scan["original_filename"] = filepath
|
||||||
|
|
||||||
if "/entry1/zebra_mode" in h5f:
|
if "/entry1/zebra_mode" in h5f:
|
||||||
@ -145,7 +145,7 @@ def read_detector_data(filepath, cami_meta=None):
|
|||||||
|
|
||||||
|
|
||||||
def fit_event(scan, fr_from, fr_to, y_from, y_to, x_from, x_to):
|
def fit_event(scan, fr_from, fr_to, y_from, y_to, x_from, x_to):
|
||||||
data_roi = scan["data"][fr_from:fr_to, y_from:y_to, x_from:x_to]
|
data_roi = scan["counts"][fr_from:fr_to, y_from:y_to, x_from:x_to]
|
||||||
|
|
||||||
model = GaussianModel()
|
model = GaussianModel()
|
||||||
fr = np.arange(fr_from, fr_to)
|
fr = np.arange(fr_from, fr_to)
|
||||||
|
Reference in New Issue
Block a user