Statistical functions

Statistical functions

pyvib.stats.EHNR(x, Fs=1.0, debug=False)

Get Envelope Harmonic-to-noise ratio Based on: Xu, X., Zhao, M., Lin, J., & Lei, Y. (2016). Envelope harmonic-to-noise ratio for periodic impulses

detection and its application to bearing diagnosis.

Measurement, 91, 385-397.

Parameters
  • x (float 1D array) – Signal

  • Fs (float, optional) – Sampling frequency

  • debug (boolean, optional) – Whether debug information is returned

Returns

EHNR – The EHNR value

Return type

float

pyvib.stats.arresidual(t, y, a)

Returns the residual of the autoregressive model with coefficients a

Parameters
  • t (float 1D array) – Time signal

  • y (float 1D array) – Signal to filter

  • a (float 1D array) – AR model coeffs

Returns

  • t (float 1D array) – New time signal

  • y (float 1D array) – Filtered signal

pyvib.stats.arresponse(t, y, a)

Returns the predicted response of the autoregressive model with coeffs a

Parameters
  • t (float 1D array) – Time signal

  • y (float 1D array) – Signal

  • a (float 1D array) – AR model coeffs

Returns

  • t (float 1D array) – New time signal

  • y (float 1D array) – Filtered signal

pyvib.stats.covariance(A, printSingular=False, tol=0.9, skipSignals=[])

Compute the covariance of columns in matrix A

Parameters
  • A (array) – [m,n] array with m observatios and n signals.

  • printSingular (bool, optional) – Print list of singular signals

Returns

  • rho (array) – Covariance matrix

  • occurences (array) – How many other signals each signal is similar to.

pyvib.stats.maximizeUncorrelatedSignals(A, tol=0.9)

Maximize number of signals such that all are uncorrelated according to the tolerance.

Aarray, or list of arrays

[m,n] array with m observatios and n signals. If list, n must be equal on all arrays

tolfloat, optional

Tolerance for covariance

pyvib.stats.percentile(v, p, w=None)

Gets the p percentile of a PDF with weights w and values v 0.0 <= p <= w.sum if w is None, w.sum == 1.0

Parameters
  • v (float 1D array) – Value samples

  • p (float) – Percentile

  • w (float 1D array, optional) – Weights of the value samples

Returns

percentile – The percentile

Return type

float

pyvib.stats.spearman(x1)

Computes the spearman coefficient of input x1 np.array Assumes the comparison vector is linearly increasing.

Parameters

x1 (float 1D array) – The signal to calculate Spearman coefficient of

Returns

spearman – Spearman coefficient

Return type

float