Пример #1
0
def test_pac_vec():
    """Definition of PAC vectors."""
    assert pac_vec()
    assert pac_vec(fpha=(1, 30, 2, 2), famp=(60, 200, 10, 5))
    assert pac_vec(fpha=[1, 2], famp=np.arange(50))
    assert pac_vec(fpha=np.array([[2, 4], [5, 7], [9, 10]]),
                   famp=np.array([[30, 60], [60, 90], [100, 200]]).T)
    assert pac_vec(fpha=[[1, 2], [5, 7]], famp=[60, 150])
Пример #2
0
 def __init__(self,
              f_pha=[2, 4],
              f_amp=[60, 200],
              dcomplex='hilbert',
              cycle=(3, 6),
              width=7):
     # Frequency checking :
     from tensorpac.utils import pac_vec
     self._f_pha, self._f_amp = pac_vec(f_pha, f_amp)
     self._xvec, self._yvec = self.f_pha.mean(1), self.f_amp.mean(1)
     # Check spectral properties :
     self._speccheck(dcomplex, cycle, width)
Пример #3
0
 def __init__(self,
              f_pha=[2, 4],
              f_amp=[60, 200],
              dcomplex='hilbert',
              filt='fir1',
              cycle=(3, 6),
              filtorder=3,
              width=7):
     # Frequency checking :
     self._f_pha, self._f_amp = pac_vec(f_pha, f_amp)
     self._xvec, self._yvec = self.f_pha.mean(1), self.f_amp.mean(1)
     # Check spectral properties :
     self._speccheck(filt, dcomplex, filtorder, cycle, width)
Пример #4
0
    avecm = avec.mean(1)
    plt.subplot(1, 4, nb)
    plt.vlines(pvecm, -10, 500, color='#ab4642')
    plt.hlines(avecm, -10, 500, color='slateblue')
    plt.xlabel('Frequency for phase (hz')
    plt.ylabel('Frequency for amplitude.mean(1)')
    plt.title(title)
    plt.xlim([0, 30])
    plt.ylim([60, 200])


plt.figure(figsize=(25, 5))
# 1 - Manual defintion :
fpha = [2, 4]
famp = [60, 160]
pvec1, avec1 = pac_vec(fpha, famp)
plot(1, pvec1, avec1, '1 - One frequency band')

# 2 - List/tuple/array :
fpha = [[2, 4], [5, 7], [8, 13]]
famp = ([60, 160], [60, 200])
pvec2, avec2 = pac_vec(fpha, famp)
plot(2, pvec2, avec2, 'Manually define several frequency bands')

# 3 - (start, end, width, step) :
fpha = (1, 30, 2, 1)
famp = (60, 200, 10, 5)
pvec3, avec3 = pac_vec(fpha, famp)
plot(3, pvec3, avec3, 'Use the (start, stop, width, step definition')

# 4 - Range :