Signal processing
Signal processing algorithms
- pyvib.signal.autocorrelation(y, normalize=False)
Get auto-correlation of the signal
- Parameters
- yfloat 1D array
Signal
- normalizeboolean, optional
Whether signal should be normalized
- Returns
- acfloat 1D array
Autocorrelated signal
- pyvib.signal.downsample(s, n, phase=0)
Direct downsampling of a signal
- Parameters
s (1D array) – Signal to downsample
n (int) – Downsampling factor
phase (int) – Phase lag before sampling
- Returns
s_out – Downsampled signal
- Return type
1D array
- pyvib.signal.encoder2position(t, enc, thr)
Converts from encoder pulses to position signal
- Parameters
t (float 1D array) – Time vector
enc (float 1D array) – Measured analog signal
thr (float) – Threshold for pulses going up or down
- Returns
t_s (float 1D array) – Position time vector
s (float 1D array) – Position vector
n (int) – Number of pulses encountered
- pyvib.signal.envelope(y, absolute=True)
Get envelope of signal.
- Parameters
y (float 1D array) – Signal to get envelope of
absolute (boolean, optional) –
Whether the absolute value (envelope is returned):
True for envelope
False for analytic signal
- Returns
env – Enveloped or analytic signal
- Return type
float 1D array
See also
fftwhilbert
function A faster way of calculating the analytic signal
- pyvib.signal.fftwconvolve(in1, in2, mode='full')
Convolve two N-dimensional arrays using PYFFTW. This is a modified version of scipy.signal.fftwconvolve
Convolve in1 and in2 using the fast Fourier transform method, with the output size determined by the mode argument.
- Parameters
in1 (float 1D array) – First input.
in2 (float 1D array) – Second input. Should have the same number of dimensions as in1. If operating in ‘valid’ mode, either in1 or in2 must be at least as large as the other in every dimension.
mode (str {'full', 'valid', 'same'}, optional) –
A string indicating the size of the output:
full
The output is the full discrete linear convolution of the inputs. (Default)
valid
The output consists only of those elements that do not rely on the zero-padding.
same
The output is the same size as in1, centered with respect to the ‘full’ output.
- Returns
out – An N-dimensional array containing a subset of the discrete linear convolution of in1 with in2.
- Return type
float 1D array
- pyvib.signal.generalized_synchronous_average(t, vib, t_s, s, R, ds=None)
Estimate the synchronous average of a signal that actually varies in speed
Based on Abboud, D., Antoni, J., Sieg-Zieba, S., & Eltabach, M. (2016). Deterministic-random separation in nonstationary regime. Journal of Sound and Vibration, 362, 305-326.
- Parameters
- tfloat 1D array
Time of signal
- yfloat
Signal
- t_sfloat 1D array
Time of shaft position
- sfloat
Shaft position
- Rint
Number of regimes
- dsfloat, optional
Force a certain delta position if wanted
- Returns
- gsafloat 1D array
Synchronous signal which can be removed
- s_otfloat 1D array
Order tracked position
- vib_otfloat 1D array
Order tracked signal
- pyvib.signal.ordertrack(t, y, t_s, s, ds, cubic=True)
Order track the vibration signal to match a desired position vector
- Parameters
- tfloat 1D array
Time signal
- yfloat 1D array
Signal to order track
- t_sfloat 1D array
Time of position signal
- sfloat 1D array
Position signal in number of rounds
- dsfloat
Desired delta position
- cubicboolean, optional
Whether cubic interpolation is used
- Returns
- s_otfloat 1D array
Shaft position of returned signal
- y_otfloat 1D array
Order tracked signal
- pyvib.signal.teager(vib)
Compute the teager energy operator
- Parameters
x (1D array) – Input signal
- Returns
x_teager – Teager energy operator
- Return type
float 1D array
- pyvib.signal.tsakeep(y, Fs, X, debug=False)
Duplicates the synchronous signal to the original length
- Parameters
- yfloat 1D array
Signal
- Fsfloat
Sampling rate in Hz
- Xfloat
Synchronous speed in Hz
- Returns
- y_syncfloat 1D array
Synchronous signal
- pyvib.signal.tsaremove(y, Fs, X, debug=False)
Subtracts the synchronous average of a signal
- Parameters
- yfloat 1D array
Signal
- Fsfloat
Sampling rate in Hz
- Xfloat
Synchronous speed in Hz
- Returns
- y_nonsyncfloat 1D array
Non-synchronous signal