- MNE version: e.g. 0.24.0
- operating system: Windows 10
Hello! I am a I am a bachelor student and I am doing a t-test to compare evoked responses between two conditions, using a script I got from my supervisor. However, there is a problem with extracting the data from a list of evokeds to create an array and I don’t understand how to solve it. Greatfull for the help. Thank you!
First, I create two lists of evokedes for all the participants.
#list of the participants
ls = ['0121', '0122', '0125', '0127', '0129']
#empty lists for all evoked responses for condition "200" and "201"
all_evoked_200 = []
all_evoked_201 = []
for i in range(0, len(ls)):
pname= ls[i]
#define main data path
data_path = 'C:/Users/test/Documents/Karin_kandidat/'
#define path for evoked_200 and load files
evoked_200_fname = os.path.join(data_path, 'Evoked', 'All_evoked', '221-200', 'evoked_200_{0}.fif'.format(pname))
evoked_200 = mne.read_evokeds(evoked_200_fname, baseline=None, proj=True)
print(evoked_200)
#define path for evoked_201 and load files
evoked_201_fname = os.path.join(data_path, 'Evoked', 'All_evoked','221-201', 'evoked_201_{0}.fif'.format(pname))
evoked_201 = mne.read_evokeds(evoked_201_fname, baseline=None, proj=True)
#append singel evokeds to all_evoked_201 and all_evoked_201
all_evoked_200.append(evoked_200)
all_evoked_201.append(evoked_201)
#extract all evoked_200 and evoked_201 data
X200 = numpy.array([p.data for p in all_evoked_201])
X201 = numpy.array([p.data for p in all_evoked_200])
This gives error message:
AttributeError Traceback (most recent call last)
Input In [33], in <cell line: 7>()
3 print(all_evoked_200)
5 #från Carine
6 #extract all evoked_200 and evoked_201 data
----> 7 X200 = np.array([p.data for p in all_evoked_201])
8 X201 = np.array([p.data for p in all_evoked_200])
Input In [33], in (.0)
3 print(all_evoked_200)
5 #från Carine
6 #extract all evoked_200 and evoked_201 data
----> 7 X200 = np.array([p.data for p in all_evoked_201])
8 X201 = np.array([p.data for p in all_evoked_200])
AttributeError: ‘list’ object has no attribute ‘data’