Identification of spectral properties in analog signals (e.g., the power spectrum).
elephant.spectral.
welch_cohere
(x, y, num_seg=8, len_seg=None, freq_res=None, overlap=0.5, fs=1.0, window='hanning', nfft=None, detrend='constant', scaling='density', axis=-1)[source]¶Estimates coherence between a given pair of analog signals. The estimation is performed with Welch’s method: the given pair of data are cut into short segments, cross-spectra are calculated for each pair of segments, and the cross-spectra are averaged and normalized by respective auto_spectra. By default the data are cut into 8 segments with 50% overlap between neighboring segments. These numbers can be changed through respective parameters.
Parameters: | x, y: Neo AnalogSignal or Quantity array or Numpy ndarray
num_seg: int, optional
len_seg: int, optional
freq_res: Quantity or float, optional
overlap: float, optional
fs: Quantity array or float, optional
window, nfft, detrend, scaling, axis: optional
|
---|---|
Returns: | freqs: Quantity array or Numpy ndarray
coherency: Numpy ndarray
phase_lag: Quantity array or Numpy ndarray
|
elephant.spectral.
welch_psd
(signal, num_seg=8, len_seg=None, freq_res=None, overlap=0.5, fs=1.0, window='hanning', nfft=None, detrend='constant', return_onesided=True, scaling='density', axis=-1)[source]¶Estimates power spectrum density (PSD) of a given AnalogSignal using Welch’s method, which works in the following steps:
- cut the given data into several overlapping segments. The degree of
- overlap can be specified by parameter overlap (default is 0.5, i.e. segments are overlapped by the half of their length). The number and the length of the segments are determined according to parameter num_seg, len_seg or freq_res. By default, the data is cut into 8 segments.
- apply a window function to each segment. Hanning window is used by
- default. This can be changed by giving a window function or an array as parameter window (for details, see the docstring of scipy.signal.welch())
- compute the periodogram of each segment
- average the obtained periodograms to yield PSD estimate
These steps are implemented in scipy.signal, and this function is a wrapper which provides a proper set of parameters to scipy.signal.welch(). Some parameters for scipy.signal.welch(), such as nfft, detrend, window, return_onesided and scaling, also works for this function.
Parameters: | signal: Neo AnalogSignal or Quantity array or Numpy ndarray
num_seg: int, optional
len_seg: int, optional
freq_res: Quantity or float, optional
overlap: float, optional
fs: Quantity array or float, optional
window, nfft, detrend, return_onesided, scaling, axis: optional
|
---|---|
Returns: | freqs: Quantity array or Numpy ndarray
psd: Quantity array or Numpy ndarray
|