def test_plv(): data = np.load("../examples/data/eeg_32chans_10secs.npy") ts, avg = plv(data) ts = np.float32(ts) avg = np.float32(avg) expected_ts = np.load("data/test_plv_ts.npy") expected_ts = np.float32(expected_ts) np.testing.assert_array_equal(ts, expected_ts) # , rtol=1e-10, atol=0.0) expected_avg = np.load("data/test_plv_avg.npy") expected_avg = np.float32(expected_avg) np.testing.assert_array_equal(avg, expected_avg) # , rtol=1e-10, atol=0.0)
def test_fisher_z_plv(): """ WIP """ from dyconnmap.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)
import numpy as np np.set_printoptions(precision=3, linewidth=160, suppress=True) from dyconnmap.fc import plv, PLV, pac, PAC from dyconnmap 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
# -*- coding: utf-8 -*- import numpy as np np.set_printoptions(precision=3, linewidth=256) from dyconnmap.fc import plv, PLV if __name__ == "__main__": data = np.load("/home/makism/Github/dyconnmap/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