def setup_module(module): global tvfcg_plv_ts global tvfcg_plv_fcgs global tvfcg_pac_plv_fcgs original_data = np.load("../examples/data/eeg_32chans_10secs.npy") # TVFCGS with PLV data = original_data[0:2, 0:1024] fb = [1.0, 4.0] fs = 128 estimator = PLV(fb, fs) tvfcg_plv_fcgs = tvfcg(data, estimator, fb, fs) # TVFCGS with PAC and PLV data = original_data[..., 0:1024] fb = [1.0, 4.0] fs = 128 f_lo = fb f_hi = [20.0, 30.0] estimator = PLV(fb, fs) pac = PAC(f_lo, f_hi, fs, estimator) tvfcg_pac_plv_fcgs = tvfcg_cfc(data, pac, f_lo, f_hi, fs) # TVFCGS with PLV (ts) fb = [1.0, 4.0] fs = 128.0 estimator = PLV(fb, fs) u_phases = estimator.preprocess(data) ts, avg = estimator.estimate(u_phases) tvfcg_plv_ts = tvfcg_ts(ts, [1.0, 4.0], 128, avg_func=estimator.mean)
def try_TVFCG(data): fb = [1.0, 4.0] fs = 128 pairs = None n_jobs = 1 cc = 2.0 step = 5 pli = PLI(fb, fs, pairs) fcgs = tvfcg(data, pli, fb, fs, cc, step) return fcgs
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 lo = [1.0, 4.0] hi = [8.0, 13.0] fs = 128.0 estimator = PLV(fb, fs) now = time.time() cfc_ts, cfc_avg = pac(data, lo, hi, fs, estimator) print("Finished in", time.time() - now, "sec") # TVFCGs + PAC pac_estimator = PAC(lo, hi, fs, estimator) now = time.time()