def try_PAC(data): fb = [1.0, 4.0] fs = 128 pairs = None n_jobs = 1 plv = PLV(fb, fs, pairs) f_lo = [1.0, 4.0] f_hi = [20.0, 30.0] pac = PAC(f_lo, f_hi, fs, plv) phases, phases_lohi = pac.preprocess(data) cfc, avg = pac.estimate(phases, phases_lohi) return cfc, avg
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) # tvfcg_plv_fcgs = np.real(tvfcg_plv_fcgs) # np.save("data/test_tvfcgs_plv.npy", tvfcg_plv_fcgs) # 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)
def try_TVFCG_PAC(data): 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) fcgs = tvfcg_cfc(data, pac, f_lo, f_hi, fs) return fcgs
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() fcgs = tvfcg_cfc(data, pac_estimator, lo, hi, fs) print "Finished in", time.time() - now, "sec"
if __name__ == "__main__": data = np.load( "/home/makism/Github/dyfunconn/examples/data/eeg_32chans_10secs.npy") # # Common configuration # fb = [1.0, 4.0] fs = 128 pairs = None estimator = PLV(fb, fs, pairs) f_lo = [1.0, 4.0] f_hi = [20.0, 30.0] # # Functional # cfc, avg = pac(data, f_lo, f_hi, fs, estimator, pairs=None) print(avg) # # Object-oriented # pac = PAC(f_lo, f_hi, fs, estimator) phases, phases_lohi = pac.preprocess(data) cfc, avg = pac.estimate(phases, phases_lohi) print(avg)