pyUSID.io.hdf_utils.model.reshape_from_n_dims¶
- pyUSID.io.hdf_utils.model.reshape_from_n_dims(data_n_dim, h5_pos=None, h5_spec=None, verbose=False)[source]¶
Reshape the input 2D matrix to be N-dimensions based on the position and spectroscopic datasets.
- Parameters:
data_n_dim (numpy.array or dask.array.core.Array) – N dimensional array arranged as [positions dimensions…, spectroscopic dimensions] If h5_pos and h5_spec are not provided, this function will have to assume that the dimensions are arranged as [positions slowest to fastest, spectroscopic slowest to fastest]. This restriction is removed if h5_pos and h5_spec are provided
h5_pos (HDF5 Dataset, numpy.array or dask.array.core.Array) – Position indices corresponding to rows in the final 2d array The dimensions should be arranged in terms of rate of change corresponding to data_n_dim. In other words if data_n_dim had two position dimensions arranged as [pos_fast, pos_slow, spec_dim_1….], h5_pos should be arranged as [pos_fast, pos_slow]
h5_spec (HDF5 Dataset, numpy. array or dask.array.core.Array) – Spectroscopic indices corresponding to columns in the final 2d array The dimensions should be arranged in terms of rate of change corresponding to data_n_dim. In other words if data_n_dim had two spectral dimensions arranged as [pos_dim_1,…, spec_fast, spec_slow], h5_spec should be arranged as [pos_slow, pos_fast]
verbose (bool, optional. Default = False) – Whether or not to print log statements
- Returns:
ds_2d (numpy.array) – 2 dimensional numpy array arranged as [positions, spectroscopic]
success (boolean or string) – True if full reshape was successful
”Positions” if it was only possible to reshape by the position dimensions
False if no reshape was possible
Notes
If either h5_pos or h5_spec are not provided, the function will assume the first dimension is position and the remaining are spectroscopic already in order from fastest to slowest.