<div dir="ltr">Dear Stephen,<div><br></div><div>You are absolutely right. This is what Dana asked.<br></div><div><br></div><div><span style="font-family:Calibri;font-size:14.6666669845581px">> e.g.; I would like to remove epochs where the <b>difference between the maximum and minimum</b> in an interval of a selectable length, and the difference between the maximum and minimum in the epoch itself, exceeds a specific value.</span><br></div><div><span style="font-family:Calibri;font-size:14.6666669845581px"><br></span></div><div><span style="font-size:12.8000001907349px">> which would be similar to what eeg_rejthresh does (I think)</span><br></div><div><span style="font-family:Calibri;font-size:14.6666669845581px"><br></span></div><div><span style="font-family:Calibri;font-size:14.6666669845581px">I don't know either :-)</span></div><div><span style="font-family:Calibri;font-size:14.6666669845581px"><br></span></div><div>I often use this simple amplitude thresholding for epoch rejection, and it works well. I wonder why. Maybe it's because noise in EEG recording is often associated with high amplitude. In the sense we are lucky, aren't we? There could be a parallel universe where EEG noise has nothing to do with amplitude...</div><div><br></div><div><span style="font-family:Calibri;font-size:14.6666669845581px">Makoto</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 7, 2015 at 7:44 PM, Stephen Politzer-Ahles <span dir="ltr"><<a href="mailto:spa268@nyu.edu" target="_blank">spa268@nyu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hm, good point. Since the OP asked for the difference between the epoch maximum and minimum, this seemed like the best way to do it (although there might be a cleaner way to code it. Looking at max(abs(EEG.data,[],2)) seems like it would instead find the greatest voltage in either direction, which would be similar to what eeg_rejthresh does (I think)<br><br></div>Best,<br></div>Seve<br></div><div class="gmail_extra"><span class=""><br clear="all"><div><div><div dir="ltr"><div><br><br></div>Stephen Politzer-Ahles<br>New York University, Abu Dhabi<br>Neuroscience of Language Lab<br><a href="http://www.nyu.edu/projects/politzer-ahles/" target="_blank">http://www.nyu.edu/projects/politzer-ahles/</a><br></div></div></div>
<br></span><div><div class="h5"><div class="gmail_quote">On Thu, May 7, 2015 at 11:01 PM, Makoto Miyakoshi <span dir="ltr"><<a href="mailto:mmiyakoshi@ucsd.edu" target="_blank">mmiyakoshi@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Stephen,<div><br></div><div>Very smart, as usual!</div><div><br></div><div>By the way, could you please tell me why you subtract min from max?</div><span><div>> diffs = squeeze( max(EEG.data,[],2) - min(EEG.data,[],2) );<br></div><div><br></div></span><div>What if you have max 10150 and min 10000? (after high-pass filtering it is not likely to happen though)<br></div><div><br></div><div>I thought this would be more straightforward</div><div>> diffs = squeeze(max(abs(EEG.data,[],2)));<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Am I missing something here? I appreciate your comment. Thank you!</div><span><font color="#888888"><div class="gmail_extra"><br></div><div class="gmail_extra">Makoto</div></font></span><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Mon, May 4, 2015 at 9:07 PM, Stephen Politzer-Ahles <span dir="ltr"><<a href="mailto:spa268@nyu.edu" target="_blank">spa268@nyu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Dana,<br><br></div>I also would have thought these would be implemented, but I couldn't find t hem just now; maybe they're in ERPLAB.<br><br></div>It shouldn't be hard, though, to code this yourself. Below is a quick sample I just made; I can't guarantee this will work in all cases but it gives you an idea. You could easily run some simple code like this and then just add the bad trial list into the EEG.reject structure.<br><br></div>Best,<br></div>Steve<br><div><div><br><br>%%% MAXMIN CRITERION<br><br>% Finds the difference between the maximum and minimum of each epoch. Could<br>% be tweaked to look only at a certain time range within the epoch<br>diffs = squeeze( max(EEG.data,[],2) - min(EEG.data,[],2) );<br><br>% We'll kick out any trials whose difference exceeds this uV threshhold<br>threshold = 200;<br><br>% Find samples that exceed the threshhold<br>[chanidx, epochidx] = find( diffs > threshold );<br><br>% Find epochs that have at least one sample, at any channel, exceeding the<br>% threshhold<br>badepochs.maxmin = unique( epochidx );<br><br><br><br><br><br><br><br><br><br>%%% NEIGHBORING SAMPLES CRITERION<br><br>% Find the difference between neighboring samples each pair of neighboring samples<br>diffs = arrayfun( @(x)( squeeze (EEG.data(:,x,:) - EEG.data(:,x-1,:) ) ), 2:size(EEG.data,2), 'UniformOutput', false );<br><br></div><div>% organize that cell array into a matrix, which will be easier to work with<br></div><div>n_chan = size(diffs{1},1);<br>n_samp = length(diffs);<br>n_trial = size(diffs{1},2);<br>diffs = reshape(cell2mat(diffs), n_chan, n_samp, n_trial);<br><br>% get the max difference across samples, for each trial<br>diffs = squeeze( max(diffs,[],2) );<br><br>% We'll kick out any trials whose difference exceeds this uV threshhold<br>threshold = 75;<br><br>% Find samples that exceed the threshhold<br>[chanidx, epochidx] = find( diffs > threshold );<br><br>% Find epochs that have at least one sample, at any channel, exceeding the<br>% threshhold<br>badepochs.neighbsamp = unique( epochidx );<br></div></div></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><br><br></div>Stephen Politzer-Ahles<br>New York University, Abu Dhabi<br>Neuroscience of Language Lab<br><a href="http://www.nyu.edu/projects/politzer-ahles/" target="_blank">http://www.nyu.edu/projects/politzer-ahles/</a><br></div></div></div>
<br><div class="gmail_quote"><div><div>On Thu, Apr 30, 2015 at 12:37 PM, Son, D.M.E. van <span dir="ltr"><<a href="mailto:d.m.e.van.son@fsw.leidenuniv.nl" target="_blank">d.m.e.van.son@fsw.leidenuniv.nl</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
<div>
<font face="Calibri" size="2"><span style="font-size:11pt">
<div>Dear Eeglab members, <br>
<br>
Before manually selecting artifacts in my data, I would like to pre-select artifacts automatically. I have seen that Eeglab provides an automatic epoch rejection toolbox, but specific epoch selection that I would like to make, does not seem to be provided.
<br>
e.g.; I would like to remove epochs where the difference between the maximum and minimum in an interval of a selectable length, and the difference between the maximum and minimum in the epoch itself, exceeds a specific value. Also, I’d like to remove epochs
wherin the absolute difference between two neighboring sampling points exceeds a certain value.
<br>
<br>
Does anyone have an idea if this is possible in Eeglab automatically? Or perhaps it is possible that I script this separately?
<br>
<br>
Many thanks in advance<br>
<br>
Dana </div>
<div> </div>
</span></font>
</div>
<br></div></div><span>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a><br></span></blockquote></div><br></div>
<br>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a><br></blockquote></div><br><br clear="all"><div><br></div></div></div><span>-- <br><div><div dir="ltr">Makoto Miyakoshi<br>Swartz Center for Computational Neuroscience<br>Institute for Neural Computation, University of California San Diego<br></div></div>
</span></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Makoto Miyakoshi<br>Swartz Center for Computational Neuroscience<br>Institute for Neural Computation, University of California San Diego<br></div></div>
</div>