Commit 1ae9123a authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][dataset] Add dtype when creating h5py datasets

parent 03eaa368
......@@ -720,7 +720,7 @@ class Dataset():
new_data = apply_3D_ROI(self.running_data, origin, size, center).view(Data)
new_data.save(roi_dir + "/data.hdf5")
else:
shape = numpy.append([self.nframes], apply_2D_ROI(self.running_data[0], origin, size, center).shape)
shape = numpy.append([self.running_data.shape[0]], apply_2D_ROI(self.running_data[0], origin, size, center).shape)
urls = self.running_data.apply_funcs([(apply_2D_ROI, [origin, size, center])],
save=roi_dir + "/data.hdf5", text="Applying roi",
operation=Operation.ROI,
......@@ -790,10 +790,10 @@ class Dataset():
_file = h5py.File(_dir + '/data.hdf5', 'a')
dataset_name = "dataset"
if "dataset" in _file:
_file.create_dataset("update_dataset", data.shape)
_file.create_dataset("update_dataset", data.shape, dtype=data.dtype)
dataset_name = "update_dataset"
else:
_file.create_dataset("dataset", data.shape)
_file.create_dataset("dataset", data.shape, dtype=data.dtype)
io_utils.advancement_display(0, len(data), "Applying shift")
if dimension is not None:
......@@ -1486,10 +1486,10 @@ class Data(numpy.ndarray):
_file = h5py.File(save, 'a')
dataset_name = "dataset"
if "dataset" in _file:
_file.create_dataset("update_dataset", new_shape)
_file.create_dataset("update_dataset", new_shape, dtype=self.dtype)
dataset_name = "update_dataset"
else:
_file.create_dataset("dataset", new_shape)
_file.create_dataset("dataset", new_shape, dtype=self.dtype)
for i in indices:
if operation is not None and not self.operations[operation]:
......@@ -1545,7 +1545,7 @@ class Data(numpy.ndarray):
_file = h5py.File(path, 'a')
if "dataset" in _file:
del _file["dataset"]
_file.create_dataset("dataset", self.shape)
_file.create_dataset("dataset", self.shape, dtype=self.dtype)
for i, img in enumerate(data):
_file["dataset"][i] = img
......
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