spectrochempy.range_scale

range_scale(dataset, dim='y', inplace=False)[source]

Scale data by the range along a dimension.

Each variable (or observation) is divided by its range (max - min). This is sometimes called min-max scaling or range normalisation in the chemometric literature.

\[x_{ij}^\prime = \frac{x_{ij}}{\max(x_j) - \min(x_j)}\]
Parameters
  • dataset (NDDataset) – The input data.

  • dim (str or int, optional, default:’y’) – Dimension along which the range is computed.

  • inplace (bool, optional, default:False) – If True, scaling is performed in place.

Returns

NDDataset – The range-scaled dataset.

Examples

>>> dataset = scp.read("irdata/nh4y-activation.spg")
>>> nd = dataset.range_scale(dim="y")

See also

normalize

General normalisation (includes min-max to [0, 1]).