Commit 77faee26 authored by Unknown's avatar Unknown
Browse files

reshape_to_Ndims bugfix

Added support for get_labels option to the returns if reshape fails.
parent 89c5f314
...@@ -759,10 +759,17 @@ def reshape_to_Ndims(h5_main, h5_pos=None, h5_spec=None, get_labels=False, verbo ...@@ -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.') warn('Could not reshape dataset to full N-dimensional form. Attempting reshape based on position only.')
try: try:
ds_Nd = np.reshape(ds_main, pos_dims[-1]) 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: except ValueError:
warn('Reshape by position only also failed. Will keep dataset in 2d form.') 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: except:
raise raise
except: except:
......
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