In [28]:
%pylab inline
In [29]:
import sys, string, commands
In [30]:
curFile = "L1_English_MeanAmpl_IndivTrials_300-400.txt"
In [31]:
ROIlabels = {'FP1':'Lant', 'FF3':'Lant', 'FP3':'Lant', 'F3':'Lant', 'F5':'Lant', 'F7':'Lant',
'FC3':'Lcent', 'FC5':'Lcent', 'FC7':'Lcent', 'C3':'Lcent', 'C5':'Lcent', 'T3':'Lcent', 'CP3':'Lcent', 'CT5':'Lcent', 'CT7':'Lcent',
'P3':'Lpost', 'P5':'Lpost', 'T5':'Lpost', 'O1':'Lpost', 'T01':'Lpost', 'IN3':'Lpost',
'FF1':'Mant', 'FPZ':'Mant', 'FF2':'Mant', 'F1':'Mant', 'FZ':'Mant', 'F2':'Mant',
'FC1':'Mcent', 'FC2':'Mcent', 'C1':'Mcent', 'CZ':'Mcent', 'C2':'Mcent', 'CP1':'Mcent', 'CP2':'Mcent',
'P1':'Mpost', 'PZ':'Mpost', 'P2':'Mpost', 'P03':'Mpost','POZ':'Mpost', 'PO4':'Mpost', 'OZ':'Mpost', 'INZ':'Mpost',
'FP2':'Rant', 'FF4':'Rant', 'FP4':'Rant', 'F4':'Rant', 'F6':'Rant', 'F8':'Rant',
'FC4':'Rcent', 'FC6':'Rcent', 'FC8':'Rcent', 'C4':'Rcent', 'C6':'Rcent', 'T4':'Rcent', 'CP4':'Rcent', 'CT6':'Rcent', 'CT8':'Rcent',
'P4':'Rpost', 'P6':'Rpost', 'T6':'Rpost', 'O2':'Rpost', 'T02':'Rpost', 'IN4':'Rpost',
'A1':'NULL', 'HEOG':'NULL', 'VEOG':'NULL'}
In [58]:
inFile = file(curFile, 'r')
In [59]:
outFile = file(curFile.split('.')[0] + '_forR.txt', 'w')
In [60]:
# First line of outFile is the header:
outFile.writelines("Subj SenType Condn ElecName ROI ElecNum Trial MeanAmpl\n")
for line in inFile:
Data = string.split(line)
Cond = Data[1].split('_')
outFile.writelines([Data[0], " ", Cond[0], " ", Cond[1], " ",
Data[2]," ", ROIlabels[Data[2]]," ",
Data[3], " ", Data[6], " ", Data[7], '\n'])
In [61]:
outFile.close()
inFile.close()