def test_spectral(self): """Test filtering using the provided filters.""" data = np.random.rand(3, 1000) p = Pac() dcomplex = ['hilbert', 'wavelet'] for k in dcomplex: p.dcomplex = k p.filter(1024, data, n_jobs=1)
def test_filterfit(self): """Test filtering test computing PAC.""" data = np.random.rand(2, 1024) p = Pac(idpac=(4, 0, 0)) p.filterfit(1024, data, n_jobs=1) p.idpac = (1, 1, 1) p.filterfit(1024, data, data, n_jobs=1, n_perm=2) p.dcomplex = 'wavelet' p.filter(1024, data, n_jobs=1)
def test_spectral(): """Test filtering using the provided filters.""" data = np.random.rand(3, 1000) p = Pac() dcomplex = ['hilbert', 'wavelet'] filt = ['butter', 'fir1', 'bessel'] for k in dcomplex: for i in filt: p.dcomplex = k p.filt = i p.filter(1024, data, axis=1, njobs=1)
def test_properties(self): """Test Pac properties.""" p = Pac() # Idpac : p.idpac p.idpac = (2, 1, 1) # Dcomplex : p.dcomplex p.dcomplex = 'wavelet' # Cycle : p.cycle p.cycle = (12, 24) # Width : p.width p.width = 12
def test_properties(self): """Test Pac properties.""" p = Pac() # Idpac : p.idpac p.idpac = (2, 1, 1) # Filt : p.filt p.filt = 'butter' # Dcomplex : p.dcomplex p.dcomplex = 'wavelet' # Cycle : p.cycle p.cycle = (12, 24) # Filtorder : p.filtorder p.filtorder = 6 # Width : p.width p.width = 12
noise=1., n_epochs=n_epochs, n_times=n_times) # First, let's use the MVL, without any further correction by surrogates : p = Pac(idpac=(4, 0, 0), f_pha=(5, 14, 2, .3), f_amp=(80, 120, 2, 1), verbose=False) plt.figure(figsize=(18, 9)) # Define several cycle options for the fir1 (eegfilt like) filter : p.filt = 'fir1' print('Filtering with fir1 filter') for i, k in enumerate([(1, 3), (2, 4), (3, 6)]): p.cycle = k xpac = p.filterfit(1024, data) plt.subplot(2, 3, i + 1) p.comodulogram(xpac.mean(-1), title='Fir1 - cycle ' + str(k)) # Define several wavelet width : p.dcomplex = 'wavelet' print('Filtering with wavelets') for i, k in enumerate([7, 9, 12]): p.width = k xpac = p.filterfit(1024, data) plt.subplot(2, 3, i + 4) p.comodulogram(xpac.mean(-1), title='Wavelet - width ' + str(k)) plt.show()