_spectral_helper(x, y, fs=1.0, window='hann', nperseg=None, noverlap=None, nfft=None, detrend='constant', return_onesided=True, scaling='density', axis=-1, mode='psd', boundary=None, padded=False)
This is a helper function that implements the commonality between the stft, psd, csd, and spectrogram functions. It is not designed to be called externally. The windows are not averaged over; the result from each window is returned.
Adapted from matplotlib.mlab
Array or sequence containing the data to be analyzed.
Array or sequence containing the data to be analyzed. If this is the same object in memory as x
(i.e. _spectral_helper(x,
x, ...)
), the extra computations are spared.
Sampling frequency of the time series. Defaults to 1.0.
Desired window to use. If :None:None:`window`
is a string or tuple, it is passed to get_window
to generate the window values, which are DFT-even by default. See get_window
for a list of windows and required parameters. If :None:None:`window`
is array_like it will be used directly as the window and its length must be nperseg. Defaults to a Hann window.
Length of each segment. Defaults to None, but if window is str or tuple, is set to 256, and if window is array_like, is set to the length of the window.
Number of points to overlap between segments. If :None:None:`None`
, noverlap = nperseg // 2
. Defaults to :None:None:`None`
.
Length of the FFT used, if a zero padded FFT is desired. If :None:None:`None`
, the FFT length is :None:None:`nperseg`
. Defaults to :None:None:`None`
.
Specifies how to detrend each segment. If detrend
is a string, it is passed as the :None:None:`type`
argument to the detrend
function. If it is a function, it takes a segment and returns a detrended segment. If detrend
is :None:None:`False`
, no detrending is done. Defaults to 'constant'.
If :None:None:`True`
, return a one-sided spectrum for real data. If :None:None:`False`
return a two-sided spectrum. Defaults to :None:None:`True`
, but for complex data, a two-sided spectrum is always returned.
Selects between computing the cross spectral density ('density') where :None:None:`Pxy`
has units of V**2/Hz and computing the cross spectrum ('spectrum') where :None:None:`Pxy`
has units of V**2, if x
and y
are measured in V and :None:None:`fs`
is measured in Hz. Defaults to 'density'
Axis along which the FFTs are computed; the default is over the last axis (i.e. axis=-1
).
Defines what kind of return values are expected. Defaults to 'psd'.
Specifies whether the input signal is extended at both ends, and how to generate the new values, in order to center the first windowed segment on the first input point. This has the benefit of enabling reconstruction of the first input point when the employed window function starts at zero. Valid options are ['even', 'odd', 'constant', 'zeros', None]
. Defaults to :None:None:`None`
.
Specifies whether the input signal is zero-padded at the end to make the signal fit exactly into an integer number of window segments, so that all of the signal is included in the output. Defaults to :None:None:`False`
. Padding occurs after boundary extension, if boundary
is not :None:None:`None`
, and :None:None:`padded`
is :None:None:`True`
.
Array of sample frequencies.
Array of times corresponding to each data segment
Array of output data, contents dependent on mode kwarg.
Calculate various forms of windowed FFTs for PSD, CSD, etc.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them