Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Vasudevan, Rama K
pycroscopy
Commits
77faee26
Commit
77faee26
authored
Nov 10, 2017
by
Unknown
Browse files
reshape_to_Ndims bugfix
Added support for get_labels option to the returns if reshape fails.
parent
89c5f314
Changes
1
Hide whitespace changes
Inline
Side-by-side
pycroscopy/io/hdf_utils.py
View file @
77faee26
...
...
@@ -759,10 +759,17 @@ def reshape_to_Ndims(h5_main, h5_pos=None, h5_spec=None, get_labels=False, verbo
warn
(
'Could not reshape dataset to full N-dimensional form. Attempting reshape based on position only.'
)
try
:
ds_Nd
=
np
.
reshape
(
ds_main
,
pos_dims
[
-
1
])
return
ds_Nd
,
'Positions'
if
get_labels
:
return
ds_Nd
,
'Positions'
,
[
'Position'
]
+
spec_labs
else
:
return
ds_Nd
,
'Positions'
except
ValueError
:
warn
(
'Reshape by position only also failed. Will keep dataset in 2d form.'
)
return
ds_main
,
False
if
get_labels
:
return
ds_main
,
False
,
[
'Position'
,
'Spectral Step'
]
else
:
return
ds_Nd
,
'Positions'
except
:
raise
except
:
...
...
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