Hello everyone,
I dont know if this is possible to answer in this setting…
I have a data set of TFR data (All_Data). I now want to export this data but seperately for each condition e.g. power_cspre with the events S 29 and S 28 and for certrain electrodes, frequency ranges and electrode clusters
The results I get, do make me suspicious, maybe I only exported the first trial instead of exporting the averaged trial. The error might be in the bold (**) printed lines.
power_cspre = All_Data['Stimulus/S 29','Stimulus/S 28']
power_cspre.pick_channels(ch_names=['Oz','O1','O2'])
power_cspre=power_cspre.crop(tmin=0.5, tmax=3,fmin=8, fmax=12, include_tmax=True)
**power_cspre=power_cspre[0]**
** alpha=np.mean(power_cspre.data, axis=1) #average electrode**
** alpha=np.mean(alpha.data, axis=0) #average electrode**
** freqs=np.mean(alpha.data, axis=0) #average frequencies**
** timeS=power_cspre.times[0:]**
** data = np.dstack((timeS,freqs))**
** data = data.reshape(626, 2)**
** index=power_cspre.times[0:]**
** columns=['time','value']**
df_data_CSplusR = pd.DataFrame(data=data , # values
index=index,
columns=columns) # 1st row as the column names
df_data_CSplusR['pptID'] = subject
df_data_CSplusR['condition'] = 'CPR'
df_data_CSplusR['shock'] = 'P'
df_data_CSplusR['memory'] = 'R'
baseline_CPR = baseline_CPR.append(pd.DataFrame(data = df_data_CSplusR), ignore_index=True)
del power_cspre, alpha,freqs, df_data_CSplusR
#Averages values to 1 value each sec
baseline_CPR=baseline_CPR[baseline_CPR['time']!=0]
baseline_CPR['Sec']= baseline_CPR['time'].apply(np.ceil)
baseline_CPR_summary=pd.pivot_table(baseline_CPR,values='value',index=['pptID'],columns=['Sec'],aggfunc=np.mean)
I know this might be difficult to answer, but maybe something catches the eye
Best
Franzi