示例#1
0
def test_plv():
    data = np.load("../examples/data/eeg_32chans_10secs.npy")
    ts, avg = plv(data, [1.0, 4.0], 128.0)

    expected_ts = np.load("data/test_plv_ts.npy")
    np.testing.assert_allclose(ts, expected_ts, rtol=1e-10, atol=0.0)

    expected_avg = np.load("data/test_plv_avg.npy")
    np.testing.assert_allclose(avg, expected_avg, rtol=1e-10, atol=0.0)
示例#2
0
def test_plv():
    data = np.load("../examples/data/eeg_32chans_10secs.npy")
    ts, avg = plv(data, [1.0, 4.0], 128.0)

    expected_ts = np.load("data/test_plv_ts.npy")
    np.testing.assert_array_equal(ts, expected_ts)

    expected_avg = np.load("data/test_plv_avg.npy")
    np.testing.assert_array_equal(avg, expected_avg)
示例#3
0
def test_fisher_z_plv():
    """ WIP """
    from dyfunconn.fc import plv

    np.set_printoptions(precision=2, linewidth=256)

    # print ""
    data = np.load("../examples/data/eeg_32chans_10secs.npy")
    ts, avg = plv(data, [1.0, 4.0], 128.0)

    symm_avg = avg + avg.T
    np.fill_diagonal(symm_avg, 1.0)

    # print symm_avg
    ts = fisher_z_plv(avg)
示例#4
0
import numpy as np
np.set_printoptions(precision=3, linewidth=160, suppress=True)

from dyfunconn.fc import plv, PLV, pac, PAC
from dyfunconn import tvfcg, tvfcg_ts, tvfcg_cfc

if __name__ == '__main__':

    data = np.load("../examples/data/eeg_32chans_10secs.npy")

    # PLV
    fb = [1.0, 4.0]
    fs = 128.0

    now = time.time()
    ts, avg = plv(data, fb, fs)
    print "Finished in", time.time() - now, "sec"

    # TVFCGs from time seriess
    now = time.time()
    fcgs = tvfcg_ts(ts, [1.0, 4.0], 128)
    print "Finished in", time.time() - now, "sec"

    # TVFCGs
    fb = [1.0, 4.0]
    fs = 128.0

    estimator = PLV(fb, fs)
    fcgs = tvfcg(data, estimator, fb, fs)

    # PAC
示例#5
0
# -*- coding: utf-8 -*-

import numpy as np
np.set_printoptions(precision=3, linewidth=256)

from dyfunconn.fc import plv, PLV


if __name__ == "__main__":
    data = np.load("/home/makism/Github/dyfunconn/examples/data/eeg_32chans_10secs.npy")
    data = data[0:5, ]

    ts, avg = plv(data, [1.0, 4.0], 128.0)
    print(avg)

    # p = PLV([1.0, 4.0], 128.0, pairs=None)
    # a = data[0, :]
    # b = data[1, :]
    #
    # tmp, tmp2 = p.estimate_pair(a, b)
    # print tmp, tmp2
    #
    # tmp, tmp2 = p.estimate(data[0:2, :])
    # print tmp, tmp2