Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XRD
darfix
Commits
1ae9123a
Commit
1ae9123a
authored
Jul 07, 2021
by
Julia Garriga Ferrer
Browse files
[core][dataset] Add dtype when creating h5py datasets
parent
03eaa368
Changes
1
Hide whitespace changes
Inline
Side-by-side
darfix/core/dataset.py
View file @
1ae9123a
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment