phys2cvr.utils.check_array_dim¶
- phys2cvr.utils.check_array_dim(fname, data, shape=None)[source]¶
Check dimensions of a matrix.
For future 3D implementation, check MIPLabCH/nigsp’s check_array_dim.
- Parameters:
- fname
str The name of the file representing
data.- data
np.ndarray The data which dimensionality needs to be checked.
- shape
None|'square'|'rectangle' Shape of matrix, if empty, skip shape check.
- fname
- Returns:
np.ndarrayIf
data.ndim = 2, returns data. Ifdata.ndim = 1andshape == 'rectangle', returns data with added empty axis.
- Raises:
NotImplementedErrorIf
datahas more than 2 dimensions.ValueErrorIf
datais empty Ifshape == 'square'anddatadimensions have different lengths.