Commit 54f48f6a authored by payno's avatar payno
Browse files

[add_dark_flat_nx_file] avoid loading the data to get dimensions

parent b0d5f2c5
Pipeline #37046 failed with stages
in 4 minutes and 27 seconds
......@@ -300,10 +300,19 @@ def add_dark_flat_nx_file(
n_frames_to_insert = 1
if isinstance(data, numpy.ndarray) and data.ndim == 3:
n_frames_to_insert = data.shape[0]
elif isinstance(data, DataUrl):
with HDF5File(data.file_path(), mode="r") as h5s:
if data.data_path() not in h5s:
raise KeyError(
"Path given ({}) is not in {}".format(
data.data_path(), data.file_path
data_node = data[data_path()]
if data_node.ndim is 3:
n_frames_to_insert = data_node.shape[0]
raw_data = get_data(data)
if raw_data.ndim is 3:
n_frames_to_insert = raw_data.shape[0]
raise TypeError("{} as input is not managed".format(type(data)))
if logger is not None:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment