[Eeglablist] Shifted rejection boundaries in continuous data

James Desjardins jdesjardins at brocku.ca
Sat Nov 24 19:08:37 PST 2012


Hi Maria,

The error in issue 1 was probably due to the presence of "boundary" events in the file that was used (their latency values are not integers as they are meant to sit between data points). The following script will not bother placing a square wave at boundary latencies. Also it will make the square wave 5 points wide so that it can be seen from behind the black line in the ERPimage figure.

** Run this script on a file that has produced the boundary shift. But, run it on the file before rejecting time periods. Once it saves the new file with the trigger channel named "trig_test.set" open that file and perform your manual rejection procedure on it.

EEG.nbchan=EEG.nbchan+1;
EEG.data(EEG.nbchan,:)=zeros(size(EEG.data(1,:)));
EEG.chanlocs(EEG.nbchan).labels='trig';
for i=1:length(EEG.event);
    if ~strcmp(EEG.event(i).type,'boundary');
        EEG.data(EEG.nbchan,[EEG.event(i).latency:EEG.event(i).latency+5])=50;
    end
end

EEG=eeg_checkset(EEG);
eeglab redraw
EEG = pop_saveset( EEG, 'filename','trig_test.set', 'filepath',cd);


The error in the second procedure that you mention seems to be an EEGLab bug that interacts with the ERPimage axis limits. If we specify the "limits" option in the call to pop_erpimage the error does not occur. The script below takes care of this issue.

** once that you have manually rejected time periods from the "trig_test.set" file run the following script to see if the trigger channel is still lined up with the event markers (red vertical line behind the black vertical line in the ERPimage raster plot).


evtlst=unique({EEG.event.type});
evtlst(strmatch('boundary',evtlst))=[];
EEG = pop_epoch( EEG, unique({EEG.event.type}), [-0.4 0.4], ...
    'newname', 'trigLock', ...
    'epochinfo', 'yes');
EEG = eeg_checkset( EEG );
figure;
pop_erpimage(EEG,1, [EEG.nbchan],[[]],'trig',1,1,{},[],'' , ...
    'yerplabel','\muV', ...
    'erp','on', ...
    'cbar','on', ...
    'topo', { [EEG.nbchan] EEG.chanlocs EEG.chaninfo }, ...
    'limits',[-280,280,0,60,NaN,NaN,NaN,NaN,NaN]);



Is it the case that the boundary shift is only occurring for some of your data files?

And, for these files does the boundary shift only happen on some manual rejection attempts?

I think that you should open the "trig_test.set" file, perform manual rejection then plot the ERPimage (script 2 above)... then repeat this until you can generate the boundary shift reliably... then see if there is some characteristic of the procedure that relates.

In the mean time I am trying to cause the boundary shift to occur (from manual rejection) on some of my files here.

James Desjardins, MA
Electrophysiology Technologist
Cognitive and Affective Neuroscience Lab, Psychology Department
Jack and Nora Walker Centre for Lifespan Development Research
Brock University
500 Glenridge Ave.
St. Catharines, ON, Canada L2S 3A1
905-688-5550 x4676
--
"'Cause you never can tell What goes on down below!
"This pool might be bigger Than you or I know!"

McElligot's Pool
Dr.Seuss 1947
________________________________
From: Maria Teresa Wijaya [a0089301 at nus.edu.sg]
Sent: November-23-12 3:18 AM
To: James Desjardins
Cc: eeglablist at sccn.ucsd.edu
Subject: Re: [Eeglablist] Shifted rejection boundaries in continuous data

Hi James,

I have run your script:

1. On the files which have gone through the artifact rejection and had the rejection boundaries shifted: I did not get the 50µV ERP in the ERP image. I thought the ERP may be added at the wrong time point (not coinciding with the events) but I also did not see it in the channel data scroll at all. I am not sure if this is relevant but I got these error messages:
>> EEG.data(EEG.nbchan,[EEG.event.latency])=50;
??? Subscript indices must either be real positive integers or logicals.

>> pop_erpimage(EEG,1, [EEG.nbchan],[[]],'trig',1,1,{},[],'' , ...
'yerplabel','\muV', ...
'erp','on', ...
'cbar','on', ...
'topo', { [EEG.nbchan] EEG.chanlocs EEG.chaninfo } );
Command executed by pop_erpimage:

 erpimage( mean(EEG.data([72], :),1), ones(1, EEG.trials)*EEG.xmax*1000, linspace(EEG.xmin*1000, EEG.xmax*1000, EEG.pnts), 'trig', 1, 1 , 'yerplabel', '\muV', 'erp', 'on', 'cbar', 'on', 'topo', { [72]' EEG.chanlocs EEG.chaninfo });

Plotting input data as 683 epochs of 204 frames sampled at 256.0 Hz.
Sorting data on input sortvar.
100.00% of the trials (i.e., 683 out of 683) have the same sortvar value as at least one other trial.
Distribution of number ties per unique value of sortvar:
Min: 683, 25th ptile: 683, Median: 683, 75th ptile: 683, Max: 683

The caxis range will be the sym. abs. data range -> [-0,0].
Data will be plotted between -398.438 and 394.531 ms.
??? Error using ==> set
Bad property value found.
Object Name :  axes
Property Name : 'CLim'
Values must be increasing and non-NaN.

Error in ==> imagesc at 47
  set(cax,'CLim',clim)

Error in ==> erpimage at 2042
            h_eim=imagesc(times,outtrials,data',[mindat,maxdat]);% plot time on x-axis

Error in ==> pop_erpimage at 668
eval(com)


2. On the files from the same subjects which I re-did the the artifact rejection and now they have the correct boundaries: I got the 50µV ERP and the vertical stripe (though it's black) in the ERP image. I also got a slightly different message when running the pop_erpimage command on these files:
>> pop_erpimage(EEG,1, [EEG.nbchan],[[]],'trig',1,1,{},[],'' , ...
'yerplabel','\muV', ...
'erp','on', ...
'cbar','on', ...
'topo', { [EEG.nbchan] EEG.chanlocs EEG.chaninfo } );
Command executed by pop_erpimage:

 erpimage( mean(EEG.data([72], :),1), ones(1, EEG.trials)*EEG.xmax*1000, linspace(EEG.xmin*1000, EEG.xmax*1000, EEG.pnts), 'trig', 1, 1 , 'yerplabel', '\muV', 'erp', 'on', 'cbar', 'on', 'topo', { [72]' EEG.chanlocs EEG.chaninfo });

Plotting input data as 791 epochs of 204 frames sampled at 256.0 Hz.
Sorting data on input sortvar.
100.00% of the trials (i.e., 791 out of 791) have the same sortvar value as at least one other trial.
Distribution of number ties per unique value of sortvar:
Min: 791, 25th ptile: 791, Median: 791, 75th ptile: 791, Max: 791

The caxis range will be the sym. abs. data range -> [-50,50].
Data will be plotted between -398.438 and 394.531 ms.
Output data will be 204 frames by 791 smoothed trials.
Outtrials: 1.00 to 791.00
Overplotting sorted sortvar on data.
Plotting the ERP trace below the ERP image
??? Undefined function or variable "l1".

Error in ==> erpimage>plot1trace at 3566
plot_handle=[plot_handle l1 l2];

Error in ==> erpimage at 2878
            tmph = plot1trace(ax2,times,erp,limit,erpsig,[],[],erp_grid,erp_vltg_ticks); % plot ERP and 0+/-alpha threshold

Error in ==> pop_erpimage at 668
eval(com)
I also got similar message when running the scripts on data from subjects which never have any boundary problem.

Do you have any advice as to what I should look at next?

Thank you for your help.

Regards,
Maria




On Thursday 22,November,2012 10:37 PM, James Desjardins wrote:

Hi Maria,

We can check to see if your shift is affecting the event markers other than the "boundary" events.

Load a file like you normally do and copy the following code to the command line to create a "trig" channel in the EEG.data array (and save a test file named "trig_test.set" in the current directory):

EEG.nbchan=EEG.nbchan+1;
EEG.data(EEG.nbchan,:)=zeros(size(EEG.data(1,:)));
EEG.chanlocs(EEG.nbchan).labels='trig';
EEG.data(EEG.nbchan,[EEG.event.latency])=50;

EEG=eeg_checkset(EEG);
eeglab redraw

pop_eegplot( EEG, 1, 0, 1);

EEG = pop_saveset( EEG, 'filename','trig_test.set', ... 'filepath',cd);


At this point you can remove a data interval the way that you normally do (perhaps remove an approximately 1 second data portion following the 10th event marker).

Now copy the following code to the command line in order to segment +/-400ms intervals around all event types and plot an ERPimage figure.


EEG = pop_epoch( EEG, unique({EEG.event.type}), [-0.4 0.4], ...
'newname', 'trigLock', ...
'epochinfo', 'yes');
EEG = eeg_checkset( EEG );
figure;
pop_erpimage(EEG,1, [EEG.nbchan],[[]],'trig',1,1,{},[],'' , ...
'yerplabel','\muV', ...
'erp','on', ...
'cbar','on', ...
'topo', { [EEG.nbchan] EEG.chanlocs EEG.chaninfo } );


If everything is OK there should be a red vertical stripe in the surface plot at 0 ms and a 50 µV ERP at 0 ms in the bottom waveform.

If there is not a vertical stripe at 0 ms we can use the trig_test.set file to explore the cause of the shift.

This will also let us know if the "boundary" shift is a separate issue.

James
________________________________________
From: Maria Teresa Wijaya [a0089301 at nus.edu.sg<mailto:a0089301 at nus.edu.sg>]
Sent: November-22-12 1:53 AM
To: James Desjardins
Cc: mmiyakoshi at ucsd.edu<mailto:mmiyakoshi at ucsd.edu>; eeglablist at sccn.ucsd.edu<mailto:eeglablist at sccn.ucsd.edu>
Subject: Re: [Eeglablist] Shifted rejection boundaries in continuous data

Hi James,

I did everything using the GUI: plot > channel data (scroll) > drag and
click to specify the boundaries > reject button > save it as file . In
my case, my events seem to still be in the right place when I tried
using eeg_eegrej function with overlapping boundaries.

Maria


On Wednesday 21,November,2012 11:41 AM, James Desjardins wrote:
> Hi Maria,
>
> What were the exact functions or menu items that you used to select the periods for rejection?
>
> Similarly, what exactly did you use to remove the periods?
>
> I am interested in this problem because I have caused such things to happen while tinkering with the EEG structure from the command line. The shifting of events from their true position relative to the data can occur if there is overlap among the latency boundaries specified for removal in a call to the eeg_eegrej function, but I have never seen it happen while building latency boundaries or removing continuous data periods using the EEGLab GUI.
>
> For example, If I specify overlapping latency boundaries:
>
> rejarr=[10000 11000;10900 11900];
>
> Then try to remove both of them with one call to eeg_eegrej:
>
> EEG = eeg_eegrej(EEG, rejarr);
>
> I find that all of the events following the rejection period are shifted to the left (relative to their true position) in the data scroll (with the shift distance being equal to the duration of the overlap across the rejarr latency boundaries).
>
> If you are building latency boundaries outside of the EEGLab GUI and using eeg_eegrej to purge them it is crucial that you merge the overlapping latency boundaries.
>
> Again, I am very interested in this topic. I look forward to exploring this further if you have more to add.
>
>
> James
>
> ________________________________________
> From: eeglablist-bounces at sccn.ucsd.edu<mailto:eeglablist-bounces at sccn.ucsd.edu> [eeglablist-bounces at sccn.ucsd.edu<mailto:eeglablist-bounces at sccn.ucsd.edu>] on behalf of Maria Teresa Wijaya [a0089301 at nus.edu.sg<mailto:a0089301 at nus.edu.sg>]
> Sent: November-18-12 11:07 PM
> To: mmiyakoshi at ucsd.edu<mailto:mmiyakoshi at ucsd.edu>
> Cc: eeglablist at sccn.ucsd.edu<mailto:eeglablist at sccn.ucsd.edu>
> Subject: Re: [Eeglablist] Shifted rejection boundaries in continuous data
>
> Dear Makoto,
>
> I recorded my data using Biosemi Active two system with 64 electrodes at
> 256Hz. Data were band pass filtered at 0.1-20 Hz and re-referenced
> offline first to nose reference to remove bad channels. Removed channels
> were interpolated and the data were re-referenced to average reference.
> I then checked the continuous data for non-typical artifacts, removed
> them, and saved the data with a new name. The shifted rejection
> boundaries problem appeared in this new data set.
>
> Kindly let me know if I need to provide any other information.
>
> Thank you.
>
> Regards,
> Maria
>
>
>
> On Saturday 17,November,2012 01:33 PM, Makoto Miyakoshi wrote:
>
>> Dear Maria,
>>
>> We need more information to identify what caused this.
>> Could you tell me more detail?
>>
>> Makoto
>>
>> 2012/11/12 Maria Teresa Wijaya<a0089301 at nus.edu.sg><mailto:a0089301 at nus.edu.sg>:
>>
>>
>>> Dear list,
>>>
>>> I did rejection on continuous data and noticed that the rejection
>>> boundaries shifted from where they are supposed to be (picture here:
>>> http://www.flickr.com/photos/89964745@N02/8178303896/in/photostream).
>>> This happened to several of my subjects, and it also happened to someone
>>> else in our lab before. My questions are:
>>>
>>> - What are the possible reasons of this shift?
>>> - Is there any way I can know if any of my event triggers have also been
>>> shifted or if only the rejection boundaries are shifted?
>>>
>>> Thank you for your help.
>>>
>>> Regards,
>>> Maria
>>> _______________________________________________
>>> 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>
>>>
>>>
>>
>>
>>
> _______________________________________________
> 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>
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20121125/4a5eb5cf/attachment.html>


More information about the eeglablist mailing list