Exemplo n.º 1
0
        # In[]: Plotting     
        print("Ploting ERPs for Class: " + Classes +" in Condition: " + Cond )
        print("with the information of Subjects: " + str(N_S_list ))        
        
        # Put all data
        X_S._data=X_data
        X_S.events=Y_data
        X_averaged=X_S.average()

        fig= plt.figure(figsize=(20,10))
        axs= fig.add_axes([0.1,0.1,0.8,0.8])
        
        # Plot Cues
        if plot_cues_bool:
            plt.plot([0,0],[-15,15],axes=axs,color='black')
            plt.plot([0.5,0.5],[-15,15],axes=axs,color='black')
            plt.plot([3,3],[-15,15],axes=axs,color='black')
        
        # Plot ERPs
        X_averaged.plot(spatial_colors = spatial_colors, picks = picks, ylim = ylim, axes = axs, xlim= [t_start , t_end])

        title = "ERPs - Condition: " + Cond + " in Class" + Classes
        axs.set_title(title, fontsize = fontsize)
        
        # Save Figure
        if save_bool:
            Ensure_dir(save_dir)
            fig.savefig(save_dir + prefix + '_' + Cond + '_' + Classes + '_' + channels + '_.png', transparent = True)   
        
Exemplo n.º 2
0
        # Check and Correct event
        events = Event_correction(N_S=N_S, N_E=N_B, events=events)

        # replace the raw events with the new corrected events
        rawdata.event = events

        report['Recording_time'] = int(
            np.round(rawdata.last_samp / rawdata.info['sfreq']))

        # Cognitive Control
        report['Ans_R'], report['Ans_W'] = Cognitive_control_check(events)

        # In[] Save report
        file_path = save_dir + Num_s + '/ses-0' + str(N_B)
        Ensure_dir(file_path)
        file_name = file_path + '/' + Num_s + '_ses-0' + str(
            N_B) + '_report.pkl'
        with open(file_name, 'wb') as output:
            pickle.dump(report, output, pickle.HIGHEST_PROTOCOL)

        # In[]:EXG
        #  the EXG Channels for saving
        picks_eog = mne.pick_types(rawdata.info,
                                   eeg=False,
                                   stim=False,
                                   include=[
                                       'EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5',
                                       'EXG6', 'EXG7', 'EXG8'
                                   ])
        epochsEOG = mne.Epochs(rawdata,