[Eeglablist] Scalp maps vs. scripted ERSP

Pollet S.C. sebastien.pollet at soton.ac.uk
Fri Feb 10 06:27:43 PST 2017


Thanks for the suggestion Makoto,

I’ve carried out an experiment.

Previously I had produced some averaged scalp maps using 10 datasets using STUDY functions. I’ve now appended those 10 datasets together into one, precomputed channel measures for that one dataset, and produced scalp maps for the same frequency range and time frames as the previous ones.

They are similar to the ones produced with 10 datasets averaged together, but have significant differences, which probably explains why the graphs I was plotting didn’t quite match what I could see on the scalp maps.

Do you think this might have something to do with how significance is calculated statistically? If it does it separately for 10 files (which is what it does from what I can see – there is one *.datersp file per dataset) then combines them, it might not produce the same results when all movements considered as a whole in one dataset?

Thanks
Seb


From: Makoto Miyakoshi [mailto:mmiyakoshi at ucsd.edu]
Sent: 10 February 2017 02:35
To: Pollet S.C. <sebastien.pollet at soton.ac.uk>
Cc: eeglablist at sccn.ucsd.edu
Subject: Re: [Eeglablist] Scalp maps vs. scripted ERSP

Dear Pollet,

> I don’t know where I’ve got it wrong. Is there an obvious error I have made?

I can't answer to this question. I also want someone to take a look at my groupSIFT code to guarantee there is no error.

> I wonder if the way EEGLAB calculates things when producing scalp maps is different from the script I have, and if you might know of a way that I could check this? Can I access the data that is used to create the scalp maps?

Yes, you can use a debug mode in Matlab. Open one of the functions being used to generate the figure, put a red circle on the left column of the edit window, then run the code. The process will stop there, so you can trace the process line by line. It's a basic technique so if you haven't tried it yet, I recommend you challenge it this time!

Makoto

On Mon, Feb 6, 2017 at 3:14 AM, Pollet S.C. <sebastien.pollet at soton.ac.uk<mailto:sebastien.pollet at soton.ac.uk>> wrote:
Hello,

I have 20 epoched datasets from 10 different subjects – 2 datasets per subject as there were 2 different conditions. I created averaged scalp maps (for all 10 subjects together, for all channels) in the alpha range (8-12Hz) using the ‘Study/Precompute channel measures’ and ‘Study/Plot channel measures’ functions. I used 10 EEGLAB ‘.set’ files for one condition and another 10 for a different condition.

When I ran the ‘Precompute channel measures routine’, I used these parameters: 'cycles', [3 0.5], 'baseline', [-3500 -1500], 'freqs', [2 60], 'alpha', 0.05, 'ntimesout', 400, 'padratio',1.

I then used ‘Plot channel measures’, using ‘8 12’ (8-12Hz) as the frequency parameter and did this repeatedly for 100ms time windows to see what is happening from -1000ms before the event to 1500ms after the event.

I then wanted to plot ERSP over time for a select number of channels (as visually identified using the scalp maps – those with strong ERD/ERS ), so I used a function created in MatLab that uses the ‘newtimef’ function, which creates the ‘ersp_sig’ variable containing significant ERSP. ‘ersp_sig’ is a 3-element vector – ersp_sig(a,b,c) where ‘a’ is frequency,’b’ is time points (400 per epoch), and ‘c’ is channels (35 in this case).

Here is the function I used:
-------------------------------------------------------------------------------

function [ersp,ersp_sig] = plotERSPTopo(dirname,filename)

eegchannels = 1:35;
cycles = [3 0.5];
freqs = [2 60];
baseline = [-3500 -1500];
tlimits = [-4000 4000];
alpha = 0.05;
mine = -7;
maxe = 7;

eeg = pop_loadset(filename,dirname);

close all;
for i=eegchannels

    tmpsig = eeg.data(i,:,:);
    tmpsig = tmpsig(:);
    triallength = size(eeg.data,2);
    close all;
    fprintf('PROCESSING CHANNEL #%2.0f\n' ,i);
    [ersp(:,:,i),itc,powbase,times,freqs,erspboot,itcboot] = ...
        newtimef(tmpsig,triallength,tlimits,eeg.srate,cycles, ...
        'baseline',baseline, 'alpha', alpha, 'freqs', freqs,'padratio',1, ...
        'plotersp','on','plotitc','off','timesout',400, ...,
        'title',eeg.chanlocs(i).labels,'erspmax',7);

    erspimage{i} = getframe(gcf,[116 80 347 308]);


    for i1=1:size(ersp,1);
        for i2=1:size(ersp,2);
            if (ersp(i1,i2,i)>erspboot(i1,1)) & (ersp(i1,i2,i)<erspboot(i1,2));
                ersp_sig(i1,i2,i)=0;
            else
                ersp_sig(i1,i2,i)=ersp(i1,i2,i);
            end
        end
    end

end

-------------------------------------------------------------------------------
I then used the following function to plot what I was interested in.
X is the file with all 10 datasets appended together for one condition and Y is another file with 10 appended datasets for the other condition.
(These are the same datasets I used to create the scalp maps).
-------------------------------------------------------------------------------

function erd_alpha_AB10 = erd_alpha_AB10(X,Y)

% Plot, for AB10, ERD% for selected channels

%Load file for left movements
ersp_alpha_left_sig = load(X,'ersp_sig');
ersp_alpha_left_sig = ersp_alpha_left_sig.ersp_sig;

%Load file for right movements
ersp_alpha_right_sig = load(Y,'ersp_sig');
ersp_alpha_right_sig = ersp_alpha_right_sig.ersp_sig;

%Convert to ERD/ERS%
erd_alpha_left_sig=((10.^((ersp_alpha_left_sig)/10))-1)*100;
erd_alpha_right_sig=((10.^((ersp_alpha_right_sig)/10))-1)*100;

%Calculate mean values for the alpha range
%(alpha range (8-12Hz) is actually indices 7-11 as frequency range starts at 2Hz)

for j=1:400;
    for k=1:35;
            erd_alpha_left_sig_mean(j,k)= (erd_alpha_left_sig(7,j,k)+erd_alpha_left_sig(8,j,k)+erd_alpha_left_sig(9,j,k)+erd_alpha_left_sig(10,j,k)+erd_alpha_left_sig(11,j,k))/5;
    end
end

for j=1:400;
    for k=1:35;
            erd_alpha_right_sig_mean(j,k)= (erd_alpha_right_sig(7,j,k)+erd_alpha_right_sig(8,j,k)+erd_alpha_right_sig(9,j,k)+erd_alpha_right_sig(10,j,k)+erd_alpha_right_sig(11,j,k))/5;
    end
end

% Plots
t=[-4000:20:3999];

% Left
ch1_left=12; %FC2
ch2_left=27; %CP4
ch3_left=23; %CP3
figure;
title(['Alpha ERD% for all AB10 subjects for left sided movements']);
xlabel('Time, in ms (relative to movement onset at 0)');
ylabel('ERD/ERS %')
axis([-4000 4000 -100 100]);
hold on;
plot(t,erd_alpha_left_sig_mean(:,ch1_left));
plot(t,erd_alpha_left_sig_mean(:,ch2_left),'r');
plot(t,erd_alpha_left_sig_mean(:,ch3_left),'g');
legend('FC2','CP4','CP3','Location','NorthWest');

% Right
ch1_right=11; %FCz
ch2_right=23; %CP3
ch3_right=27; %CP4
figure;
title(['Alpha ERD% for all AB10 subjects for right sided movements']);
xlabel('Time, in ms (relative to movement onset at 0)');
ylabel('ERD/ERS %')
axis([-4000 4000 -100 100]);
hold on;
plot(t,erd_alpha_right_sig_mean(:,ch1_right));
plot(t,erd_alpha_right_sig_mean(:,ch2_right),'r');
plot(t,erd_alpha_right_sig_mean(:,ch3_right),'g');
legend('FCz','CP3','CP4','Location','NorthWest');

end

-------------------------------------------------------------------------------
When I look at the plots, they don’t quite match what I see on the scalp maps. For example when I plot FC2, CP3 and CP4 together, my plots show that CP4 is activated before FC2 and a with a greater value, which is not what I see on the scalp maps – FC2 has a dark blue ‘patch’ (strong ERD) whilst CP4 is green – so I was expecting to see this reflected on the plot.


I don’t know where I’ve got it wrong. Is there an obvious error I have made? I wonder if the way EEGLAB calculates things when producing scalp maps is different from the script I have, and if you might know of a way that I could check this? Can I access the data that is used to create the scalp maps?


Thanks for any advice on this.

Seb

Sebastien Pollet
University of Southampton
sebastien.pollet at soton.ac.uk<mailto:sebastien.pollet at soton.ac.uk>


_______________________________________________
Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu<mailto:eeglablist-unsubscribe at sccn.ucsd.edu>
For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu<mailto:eeglablist-request at sccn.ucsd.edu>



--
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170210/16fbc0cf/attachment.html>


More information about the eeglablist mailing list