Commit 05091086 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][dataset] Fix typo when data is empty

parent 2a702853
Pipeline #50354 passed with stage
in 2 minutes and 7 seconds
......@@ -796,6 +796,7 @@ class Dataset():
io_utils.advancement_display(0, len(data), "Applying shift")
if dimension is not None:
# Convert dimension and value into list
if type(dimension[0]) is int:
dimension[0] = [dimension[0]]
......@@ -1550,7 +1551,6 @@ class Data(numpy.ndarray):
del _file["dataset"]
_file.create_dataset("dataset", new_shape, dtype=self.dtype)
for i, img in enumerate(data):
_file["dataset"][i] = img
urls.append(DataUrl(file_path=path, data_path="/dataset", data_slice=i, scheme='silx'))
......@@ -1628,7 +1628,9 @@ class Data(numpy.ndarray):
raise TypeError("Axis must be None, 0 or 1")
else:
if axis == 0:
if not data.shape[0]:
if data.size == 0:
return numpy.array([])
elif not data.shape[0]:
return numpy.zeros(data[0].shape)
zsum = numpy.array(data[0], dtype=numpy.float64)
for i in range(1, len(data)):
......
Markdown is supported
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