Warning

You are reading the documentation related to the development version. Go here if you are looking for the documentation of the stable release.

spectrochempy.general_hamming

general_hamming(alpha=None)def general_hamming(dataset, alpha, **kwargs)[source]

Calculate generalized Hamming apodization.

For multidimensional NDDataset, the apodization is by default performed on the last dimension.

The data in the last dimension MUST be time-domain or dimensionless, otherwise an error is raised.

Functional form of apodization window :

\[w(n) = \alpha - \left(1 - \alpha\right) \cos\left(\frac{2\pi{n}}{M-1}\right) \qquad 0 \leq n \leq M-1\]

where M is the number of point of the input dataset.

Both the common Hamming window and Hann window are special cases of the generalized Hamming window with \(\alpha\) = 0.54 and :math:alpha = 0.5, respectively

Parameters
  • dataset (array.) – Input dataset.

  • alpha (float) – The window coefficient, :math:alpha.

  • **kwargs – Optional keyword parameters (see Other Parameters).

Returns

  • apodized – Dataset.

  • apod_arr – The apodization array only if ‘retapod’ is True.

Other Parameters
  • dim (str or int, keyword parameter, optional, default=’x’) – Specify on which dimension to apply the apodization method. If dim is specified as an integer it is equivalent to the usual axis numpy parameter.

  • inv (bool, keyword parameter, optional, default=False) – True for inverse apodization.

  • rev (bool, keyword parameter, optional, default=False) – True to reverse the apodization before applying it to the data.

  • inplace (bool, keyword parameter, optional, default=False) – True if we make the transform inplace. If False, the function return a new dataset.

  • retapod (bool, keyword parameter, optional, default=False) – True to return the apodization array along with the apodized object.