### Navigation

- index
- modules |
- PySptools 0.12.2 beta documentation »

# Formating functions

This module supports functions to convert the HSI cube dimensions and to normalize the data.

## convert2d

`formatting.``convert2d`(M)

  Converts a 3D data cube (m x n x p) to a 2D matrix of points where N = m*n.

  Parameters:
    M: numpy array
      A HSI cube (m x n x p).
  Returns: numpy array
    2D data matrix (N x p)

## convert3d

`formatting.``convert3d`(N, h, w, sigLast=True)

  Converts a 1D (N) or 2D matrix (p x N) or (N x p) to a 3D data cube (m x n x p) where N = m * n

  Parameters:
    N: numpy array
      1D (N) or 2D data matrix (p x N) or (N x p)
    h: integer
      Height axis length (or y axis) of the cube.
    w: integer
      Width axis length (or x axis) of the cube.
    siglast: True [default False]
      Determine if input N is (p x N) or (N x p).
  Returns: numpy array
    A 3D data cube (m x n x p)

## normalize

`formatting.``normalize`(M)

  Normalizes M to be in range [0, 1].

  Parameters:
    M: numpy array
      1D, 2D or 3D data.
  Returns: numpy array
    Normalized data.

### Navigation

- index
- modules |
- PySptools 0.12.2 beta documentation »