Загрузка
Remove the mean or best fit line from an array
Power spectral density using Welch's average periodogram
Spectrogram (spectrum over segments of time)
Return the complex-valued frequency spectrum of a signal
Return the magnitude of the frequency spectrum of a signal
Return the angle (wrapped phase) of the frequency spectrum of a signal
Return the phase (unwrapped angle) of the frequency spectrum of a signal
Remove the mean from a line.
Remove the best fit line from a line.
Return the original line.
Bases: object
Representation of a kernel-density estimate using Gaussian kernels.
Datapoints to estimate from. In case of univariate data this is a 1-D array, otherwise a 2D array with shape (# of dims, # of data).
The method used to calculate the estimator bandwidth. If a
float, this will be used directly as kde.factor. If a
callable, it should take a GaussianKDE instance as only
parameter and return a float. If None (default), 'scott' is used.
The dataset passed to the constructor.
Number of dimensions.
Number of datapoints.
The bandwidth factor, obtained from covariance_factor, with which
the covariance matrix is multiplied.
The covariance matrix of dataset, scaled by the calculated bandwidth
(kde.factor).
kde.evaluate(points) | (ndarray) Evaluate the estimated pdf on a provided set of points. |
kde(points) | (ndarray) Same as kde.evaluate(points) |
Evaluate the estimated pdf on a set of points.
Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.
The values at each point.
Compute the angle of the frequency spectrum (wrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, window_none, numpy.blackman, numpy.hamming,
numpy.bartlett, scipy.signal, , etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. While not increasing the actual resolution of the spectrum (the
minimum distance between resolvable peaks), this can give more points in
the plot, allowing for more detail. This corresponds to the n parameter
in the call to fft. The default is None, which sets pad_to
equal to the length of the input signal (i.e. no padding).
The angle of the frequency spectrum (wrapped phase spectrum).
The frequencies corresponding to the elements in spectrum.
The coherence between x and y. Coherence is the normalized cross spectral density:
Compute the complex-valued frequency spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, window_none, numpy.blackman, numpy.hamming,
numpy.bartlett, scipy.signal, , etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. While not increasing the actual resolution of the spectrum (the
minimum distance between resolvable peaks), this can give more points in
the plot, allowing for more detail. This corresponds to the n parameter
in the call to fft. The default is None, which sets pad_to
equal to the length of the input signal (i.e. no padding).
The complex-valued frequency spectrum.
The frequencies corresponding to the elements in spectrum.
Compute the cross-spectral density.
The cross spectral density by Welch's average periodogram method. The vectors x and y are divided into NFFT length segments. Each segment is detrended by function detrend and windowed by function window. noverlap gives the length of the overlap between segments. The product of the direct FFTs of x and y are averaged over each segment to compute , with a scaling to correct for power loss due to windowing.
Return x with its trend removed.
Array or sequence containing the data.
The detrending algorithm to use. 'default', 'mean', and 'constant' are
the same as detrend_mean. 'linear' is the same as detrend_linear.
'none' is the same as detrend_none. The default is 'mean'. See the
corresponding functions for more details regarding the algorithms. Can
also be a function that carries out the detrend operation.
The axis along which to do the detrending.
Return x minus best fit line; 'linear' detrending.
Array or sequence containing the data
Return x minus the mean(x).
Array or sequence containing the data Can have any dimensionality
The axis along which to take the mean. See numpy.mean for a
description of this argument.
Return x: no detrending.
An object containing the data
This parameter is ignored. It is included for compatibility with detrend_mean
Compute the magnitude (absolute value) of the frequency spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, window_none, numpy.blackman, numpy.hamming,
numpy.bartlett, scipy.signal, , etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. While not increasing the actual resolution of the spectrum (the
minimum distance between resolvable peaks), this can give more points in
the plot, allowing for more detail. This corresponds to the n parameter
in the call to fft. The default is None, which sets pad_to
equal to the length of the input signal (i.e. no padding).
The magnitude (absolute value) of the frequency spectrum.
The frequencies corresponding to the elements in spectrum.
Compute the phase of the frequency spectrum (unwrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, window_none, numpy.blackman, numpy.hamming,
numpy.bartlett, scipy.signal, , etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. While not increasing the actual resolution of the spectrum (the
minimum distance between resolvable peaks), this can give more points in
the plot, allowing for more detail. This corresponds to the n parameter
in the call to fft. The default is None, which sets pad_to
equal to the length of the input signal (i.e. no padding).
The phase of the frequency spectrum (unwrapped phase spectrum).
The frequencies corresponding to the elements in spectrum.
Compute the power spectral density.
The power spectral density by Welch's average periodogram method. The vector x is divided into NFFT length segments. Each segment is detrended by function detrend and windowed by function window. noverlap gives the length of the overlap between segments. The of each segment are averaged to compute .
If len(x) < NFFT, it will be zero padded to NFFT.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, , , ,
, , , etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
Compute a spectrogram.
Compute and plot a spectrogram of data in x. Data are split into NFFT length segments and the spectrum of each section is computed. The windowing function window is applied to each segment, and the amount of overlap of each segment is specified with noverlap.
1-D array or sequence.
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
, , , ,
, , , etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Return x times the Hanning (or Hann) window of len(x).
No window function; simply return x.
The inverse of covariance.
than the dimensionality of the KDE.
scipy.signal.get_windowReturns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, window_none, numpy.blackman, numpy.hamming,
numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. This can be different from NFFT, which specifies the number
of data points used. While not increasing the actual resolution of the
spectrum (the minimum distance between resolvable peaks), this can give
more points in the plot, allowing for more detail. This corresponds to
the n parameter in the call to fft. The default is None,
which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove
the mean or linear trend. Unlike in MATLAB, where the detrend parameter
is a vector, in Matplotlib it is a function. The mlab
module defines detrend_none, detrend_mean, and detrend_linear,
but you can use a custom function as well. You can also use a string to
choose one of the functions: 'none' calls detrend_none. 'mean' calls
detrend_mean. 'linear' calls .
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of 1/Hz. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The coherence vector.
The frequencies for the elements in Cxy.
scipy.signal.get_windowReturns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
If len(x) < NFFT or len(y) < NFFT, they will be zero padded to NFFT.
Arrays or sequences containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
window_hanningA function or a vector of length NFFT. To create window vectors see
window_hanning, window_none, numpy.blackman, numpy.hamming,
numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a
function is passed as the argument, it must take a data segment as an
argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. This can be different from NFFT, which specifies the number
of data points used. While not increasing the actual resolution of the
spectrum (the minimum distance between resolvable peaks), this can give
more points in the plot, allowing for more detail. This corresponds to
the n parameter in the call to fft. The default is None,
which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove
the mean or linear trend. Unlike in MATLAB, where the detrend parameter
is a vector, in Matplotlib it is a function. The mlab
module defines detrend_none, detrend_mean, and detrend_linear,
but you can use a custom function as well. You can also use a string to
choose one of the functions: 'none' calls detrend_none. 'mean' calls
detrend_mean. 'linear' calls .
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of 1/Hz. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The values for the cross spectrum before scaling (real valued)
The frequencies corresponding to the elements in Pxy
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
scipy.signal.get_windowReturns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
scipy.signal.get_windowReturns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. This can be different from NFFT, which specifies the number
of data points used. While not increasing the actual resolution of the
spectrum (the minimum distance between resolvable peaks), this can give
more points in the plot, allowing for more detail. This corresponds to
the n parameter in the call to fft. The default is None,
which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove
the mean or linear trend. Unlike in MATLAB, where the detrend parameter
is a vector, in Matplotlib it is a function. The mlab
module defines detrend_none, detrend_mean, and detrend_linear,
but you can use a custom function as well. You can also use a string to
choose one of the functions: 'none' calls detrend_none. 'mean' calls
detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of 1/Hz. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The values for the power spectrum (real valued)
The frequencies corresponding to the elements in Pxx
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing
the FFT. This can be different from NFFT, which specifies the number
of data points used. While not increasing the actual resolution of the
spectrum (the minimum distance between resolvable peaks), this can give
more points in the plot, allowing for more detail. This corresponds to
the n parameter in the call to fft. The default is None,
which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove
the mean or linear trend. Unlike in MATLAB, where the detrend parameter
is a vector, in Matplotlib it is a function. The mlab
module defines detrend_none, detrend_mean, and detrend_linear,
but you can use a custom function as well. You can also use a string to
choose one of the functions: 'none' calls detrend_none. 'mean' calls
detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of 1/Hz. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between blocks.
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the magnitude spectrum.
Returns the phase spectrum without unwrapping.
Returns the phase spectrum with unwrapping.
2D array, columns are the periodograms of successive segments.
1-D array, frequencies corresponding to the rows in spectrum.
1-D array, the times corresponding to midpoints of segments (i.e the columns in spectrum).
detrend and scale_by_freq only apply when mode is set to 'psd'.
detrend_lineardetrend_linear