forked from MadsJensen/CAA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_data_numb_trials.py
42 lines (36 loc) · 1.49 KB
/
extract_data_numb_trials.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
"""
@author: mje
"""
from my_settings import *
import mne
import pandas as pd
sides = ["left", "right"]
conditions = ["ctl", "ent"]
rois = ["lh", "rh"]
corr = ["correct", "incorrect"]
phase = ["in_phase", "out_phase"]
columns_keys = ["subject", "condition_type", "condition_side",
"correct", "n"]
df = pd.DataFrame(columns=columns_keys)
for subject in subjects_select:
epochs = mne.read_epochs(epochs_folder + "%s_target-epo.fif" % subject,
preload=False)
for condition in conditions:
for side in sides:
for roi in rois:
for cor in corr:
for p in phase:
row = pd.DataFrame([{"subject": subject,
"condition_type": condition,
"condition_side": side,
"ROI": roi,
"correct": cor,
"phase": p,
"n": len(epochs[condition + "/" +
side + "/" +
cor + "/" +
p])}])
df = df.append(row, ignore_index=True)
df.to_csv(data_path + "alpha_mean_n_data_extracted_phase_target.csv",
index=False)