metabci.brainda.algorithms.feature_analysis.time_freq_analysis module

class metabci.brainda.algorithms.feature_analysis.time_freq_analysis.TimeFrequencyAnalysis(fs)[source]

Bases: object

fun_hilbert(X, N=None, axis=-1)[source]

-author: Li Xiaoyu -Created on: 2022-8-8 -updata log:

2022-8-11 by Li Xiaoyu

Parameters:
  • X (ndarray) – the input data

  • N (int) – length of the hilbert used.

Returns:

discrete-time analytic signal realEnv(ndarray): the real part of the discrete-time analytic signal. imagEnv(ndarray): the imaginary part of the discrete-time analytical signal. angle(ndarray): the angle of the discrete-time analytical signal. envModu(ndarray): the envelope of the discrete-time analytical signal

Return type:

analytic_signal(ndarray)

fun_stft(data, fs=None, window='hann', nperseg=256, noverlap=None, nfft=None, detrend=False, return_onesided=True, boundary='zeros', padded=True, axis=-1)[source]

-author: Xin Fengran -Created on: 2022-8-8 -updata log:

2022-8-11 by Xin Fengran

Parameters:
  • data (ndarray) – the EEG data

  • fs (float) – the rasampling rate

  • window (str or tuple or ndarray) – desired window to use.

  • nperseg (int) – length of each segment.

  • noverlap (int) – number of points to overlap between segments.

  • nfft (int) – length of the FFT used.

  • detrend (str or function or False) – specifies how to detrend each segment.

  • return_onesided (bool) – If True, return a one-sided spectrum for real data. If False return a two-sided spectrum.

  • returned. (Defaults to True, but for complex data, a two-sided spectrum is always) –

  • boundary (str) – Specifies whether the input signal is extended at both ends, and how to generate the new values,

  • point. (in order to center the first windowed segment on the first input) –

  • padded (bool) – Specifies whether the input signal is zero-padded at the end.

  • axis (int) – axis along which the STFT is computed

Returns:

array of sample frequencies t(ndarray): array of segment times Zxx(ndarray): the STFT of the EEG data

Return type:

f(ndarray)

fun_topoplot(X, chan_names, sfreq=None, ch_types='eeg')[source]

-author: Li Xiaoyu -Created on: 2022-8-8 -updata log:

2022-8-11 by Li Xiaoyu

Parameters:
  • X (ndarray) – the input data

  • chan_names (list) – the name of channels

  • sfreq (float) – the sampling rate

  • ch_types (str) – the type of channel

func_morlet_wavelet(data, xtimes, omega, sigma, fs=None)[source]

-author: Xin Fengran -Created on: 2022-8-8 -update log:

2022-8-11 by Xin Fengran

Parameters:
  • data – ndarray(Nchannel, Ntimes), the EEG data

  • xtimes – ndarray(N,), timeline of the EEG data

  • omega – float.

  • sigma – float.

  • fs – float, the resampling rate

Returns:

ndarray(Nchannel, N, nTimes), square amplitude of Morlet wavelet transform S: ndarray(Nchannel, N, nTimes), complex values of Morlet wavelet transform

Return type:

P