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

Merge branch 'fix_bugs' into 'master'

Fix bugs

See merge request !135
parents dca8bd41 a165d784
Pipeline #53296 passed with stage
in 4 minutes and 55 seconds
......@@ -1504,11 +1504,15 @@ class Data(numpy.ndarray):
self._lock.release()
_file = h5py.File(save, 'a')
dataset_name = "dataset"
new_shape = self.shape if new_shape is None else tuple(new_shape)
if "dataset" in _file:
if new_shape is not None:
if new_shape != _file["dataset"].shape:
_file.create_dataset("update_dataset", new_shape, dtype=self.dtype)
else:
_file.create_dataset("update_dataset", data=_file["dataset"])
_file.create_dataset("update_dataset", shape=_file["dataset"].shape, dtype=_file["dataset"].dtype)
for i, img in enumerate(_file["dataset"]):
_file["update_dataset"][i] = img
dataset_name = "update_dataset"
else:
new_shape = self.shape if new_shape is None else new_shape
......@@ -1567,9 +1571,11 @@ class Data(numpy.ndarray):
_file = h5py.File(path, 'a')
new_shape = self.shape if new_shape is None else tuple(new_shape)
if "dataset" not in _file:
_file.create_dataset("dataset", self.shape, dtype=self.dtype)
elif new_shape is not None:
elif new_shape != _file["dataset"].shape:
del _file["dataset"]
_file.create_dataset("dataset", new_shape, dtype=self.dtype)
......
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