ppcpy.retrievals.ramanhelpers#

Functions

movingslope

MOVINGSLOPE estimates the local slope of a sequence of points using a sliding window.

movingslope_variedWin

MOVINGSLOPE_VARIEDWIN calculates the slope of the signal with a moving slope.

sigGenWithNoise

SIGGENWITHNOISE generate noise-containing signal with a certain noise-adding algorithm.

ppcpy.retrievals.ramanhelpers.movingslope_variedWin(signal, winWidth)[source]#

MOVINGSLOPE_VARIEDWIN calculates the slope of the signal with a moving slope. This is a wrapper for the movingslope function to make it compatible with height-independent smoothing windows.

Parameters:
  • signal (array_like) – Signal for each bin.

  • winWidth (int or ndarray) – If winWidth is an integer, the width of the window will be fixed. If winWidth is a k x 3 matrix, the width of the window will vary with height, like [[1, 20, 3], [18, 30, 5], [25, 40, 7]], which means: - The width will be 3 between indices 1 and 20, - 5 between indices 18 and 30, - and 7 between indices 25 and 40.

Returns:

  • slope (ndarray) – Slope at each bin.

  • History

  • ——-

  • - 2018-08-03 (First edition by Zhenping.)

ppcpy.retrievals.ramanhelpers.movingslope(vec, supportlength=3, modelorder=1, dt=1)[source]#

MOVINGSLOPE estimates the local slope of a sequence of points using a sliding window.

Parameters:
  • vec (array_like) – Row or column vector to be differentiated. Must have at least 2 elements.

  • supportlength (int, optional) – Number of points used for the moving window. Default is 3.

  • modelorder (int, optional) – Defines the order of the windowed model used to estimate the slope. Default is 1 (linear model).

  • dt (float, optional) – Spacing for sequences that do not have unit spacing. Default is 1.

Returns:

  • Dvec (ndarray) – Derivative estimates, same size and shape as vec.

  • History

  • ——-

  • - Original MATLAB implementation by John D’Errico.

  • Authors

  • ——-

  • - woodchips@rochester.rr.com

ppcpy.retrievals.ramanhelpers.sigGenWithNoise(signal, noise=None, nProfile=1, method='norm')[source]#

SIGGENWITHNOISE generate noise-containing signal with a certain noise-adding algorithm.

Parameters:
  • signal (array) – Signal strength.

  • noise (array, optional) – Noise. Unit should be the same as signal. Default is sqrt(signal).

  • nProfile (int, optional) – Number of signal profiles to generate. Default is 1.

  • method (str, optional) – ‘norm’: Normally distributed noise -> signalGen = signal + norm * noise. ‘poisson’: Poisson distributed noise -> signalGen = poisson(signal, nProfile). Default is ‘norm’.

Returns:

  • signalGen (array) – Noise-containing signal. Shape is (len(signal), nProfile).

  • History

  • ——-

  • - 2021-06-13 (First edition by Zhenping.)