Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
kmap
xsocs
Commits
f96da673
Commit
f96da673
authored
Apr 03, 2018
by
Thomas Vincent
Browse files
Only returns 1D dataset as normalizers
parent
7e07a8ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
xsocs/io/XsocsH5.py
View file @
f96da673
...
...
@@ -250,29 +250,28 @@ class XsocsH5(XsocsH5Base):
@
_process_entry
def
normalizers
(
self
,
entry
):
"""Returns dataset in measurement that
might
be used to normalize data
"""Returns
names of
dataset in measurement that
can
be used to normalize data
It returns names of
scalar values and
1D datasets with same number
of elements as images
that are available in the measurement group
It returns names of 1D datasets with same number
of elements as images
that are available in the measurement group
.
:return:
Dictionary of {name: data}
that might be normalizers
:rtype:
collections.OrderedDict
:return:
List of dataset names in measurement
that might be normalizers
:rtype:
List[str]
"""
normalizers
=
OrderedDict
()
normalizers
=
[]
nb_images
=
self
.
n_images
(
entry
)
path
=
self
.
measurement_tpl
.
format
(
entry
)
+
'/'
with
self
.
_get_file
()
as
h5_file
:
for
name
,
node
in
h5_file
[
path
].
items
():
if
isinstance
(
node
,
_h5py
.
Dataset
)
and
node
.
dtype
.
kind
in
'iuf'
:
if
(
isinstance
(
node
,
_h5py
.
Dataset
)
and
node
.
dtype
.
kind
in
'iuf'
and
node
.
ndim
==
1
and
node
.
shape
[
0
]
==
nb_images
):
# Only get (u)int and float datasets
if
node
.
ndim
==
0
:
# single scalar, make an array of it
normalizers
[
name
]
=
_np
.
array
([
node
[()]]
*
nb_images
)
elif
node
.
ndim
==
1
and
node
.
shape
[
0
]
==
nb_images
:
# same number of values as number of images
normalizers
[
name
]
=
node
[()]
# with same number of values as number of images
normalizers
.
append
(
name
)
return
normalizers
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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