spectrochempy.identity๏
- identity(n, dtype=None, **kwargs)[source]๏
Return the identity
NDDatasetof a given shape.The identity array is a square array with ones on the main diagonal.
- Parameters:
n (int) โ Number of rows (and columns) in
nxnoutput.dtype (data-type, optional) โ Data-type of the output. Defaults to
float.**kwargs โ Other parameters to be passed to the object constructor (units, coordset, mask โฆ).
- Returns:
identity โ
nxnarray with its main diagonal set to one, and all other elements 0.
See also
Examples
>>> scp.identity(3).data array([[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]])