nigsp.io.check_mtx_dim¶
- nigsp.io.check_mtx_dim(fname, data, shape=None)[source]¶
Check dimensions of a matrix.
- Parameters:
- fname
str
The name of the file representing data
- data
np.ndarray
The data which dimensionality needs to be checked
- shape
None
, ‘square’, or ‘rectangle’},str
, optional Shape of matrix, if empty, skip shape check
- fname
- Returns:
np.ndarray
If data.ndim = 2, returns data. If data.ndim = 1 and shape == ‘rectangle’, Returns data with added empty axis.
- Raises:
NotImplementedError
If data has more than 3 dimensions. If shape is not None but data is 3D.
ValueError
If data is empty If shape == ‘square’ and data dimensions have different lengths.