<div dir="ltr">Dear Brian,<div><br></div><div><span style="color:rgb(68,68,68);font-family:"trebuchet ms",sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> A question for all - to further ameliorate the DC shift, would a linear detrend over the unepoched data prior to any other step potentially help with this problem? In a test on one file it seems to help. Then, I could potentially remove the mean of each channel over the whole recording?</span><br></div><div><br></div><div>Remember GIGO (garbage in, garbage out). If there is a known source of artifact in the recording environment, I would do something with it first before trying any signal processing.</div><div><br></div><div>I don't know much about electromagnetic field theory, but I remember a retired professor (audiophile) once told me that low-frequency shield (I assume 50 or 60 Hz line noise frequency) is required to be more like a magnetic shield rather than a electric shield. Standard copper mesh shield is not very effective to cut low-frequency like line noise. You may want to try a material with good magnetic permeability to make a hard shell/box. I just Googled it and found something like this. It seems worth trying.</div><div><br></div><div><a href="http://www.adrprovita.com/Magnet-Shield-Plate">http://www.adrprovita.com/Magnet-Shield-Plate</a><br></div><div><br></div><div>When CRT TVs were still popular, there were thin rolls /thick film of some magnetic material I saw in home centers. This thing can be applied to a side of a speaker enclosure whose driver units are not magnetically shielded so that their stray magnetic field does not affect CRT monitor. Maybe you can still find those products.</div><div><br></div><div>Makoto</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 23, 2018 at 9:42 AM Erickson <<a href="mailto:ericksonb.eng@gmail.com">ericksonb.eng@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)">Andreas, thanks for your detailed response. Regarding line noise, I think there's some kind of power substation box in the room. It is "non-ideal" to be sure, but presently that's what we're working with. Your suggestion for filtering in two steps with those filter orders is working much better than the automatic order option.<br></div><div dir="ltr"><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)"><br></div><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)">A question for all - to further ameliorate the DC shift, would a linear detrend over the unepoched data prior to any other step potentially help with this problem? In a test on one file it seems to help. Then, I could potentially remove the mean of each channel over the whole recording?</div><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)"><br></div><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)">Thank you,</div><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)">Brian</div><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_extra"><div style="font-family:"trebuchet ms",sans-serif;color:rgb(68,68,68)"><b style="font-family:arial,sans-serif;text-align:-webkit-auto;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;font-size:12.8px;color:rgb(0,51,119)">Brian Erickson</b><span style="font-family:arial,sans-serif;text-align:-webkit-auto;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;font-size:10pt;color:rgb(0,51,119)"><b>, Ph.D.</b></span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><font face="times new roman, serif"><span style="font-size:13.3333px"><i>Postdoctoral Researcher, CogNeW Lab</i></span></font></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div><font face="Helvetica Neue, serif" style="font-size:12.8px"><span style="font-size:13.3333px"><b><br></b></span></font><b style="font-size:12.8px;text-align:-webkit-auto;font-family:helvetica"><span style="color:rgb(0,51,119)"><font face="Arial, sans-serif"><span style="font-size:10pt">Drexel University</span></font></span></b><br style="font-size:12.8px"><span style="text-align:-webkit-auto;font-family:"times new roman",serif;font-size:13px">3141 Chestnut Street</span><br style="font-size:12.8px"><span style="text-align:-webkit-auto;font-family:"times new roman",serif;font-size:13px">Stratton Hall Room 320</span><br style="font-size:12.8px"><span style="text-align:-webkit-auto;font-family:"times new roman",serif;font-size:13px">Philadelphia, PA 19104</span></div></div>
</div><br><div class="gmail_quote">On Wed, Jul 18, 2018 at 3:04 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Andreas,<div><br></div><div>Just a quick input,</div><span><div><br></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> Not sure how Cleanline copes with the TMS artifacts, however.</span><br></div><div><br></div></span><div>Good point. CleanLine assumes that the noise (in this case, specifically 50/60Hz line noise) to be stationary across time (and purely sinusoidal). Temporally sparse noise like TMS artifact cannot be removed by CleanLine.</div><span class="gmail-m_3813714468402290205HOEnZb"><font color="#888888"><div><br></div><div>Makoto </div></font></span><div><div class="gmail-m_3813714468402290205h5"><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 17, 2018 at 10:39 PM Andreas Widmann <<a href="mailto:widmann@uni-leipzig.de" target="_blank">widmann@uni-leipzig.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Brian,<br>
<br>
this is indeed a prototypical filter edge artifact. Most commonly this type of artifact is observed with notch filters (but only because notch filters are most commonly applied for this type of interference) but can also be observed with low-pass or high-pass filters.<br>
<br>
I'm afraid that you will not get completely rid of this problem. Your line noise interference is very strong (~1 mV peak-to-peak max on AF3 and ~500 µV peak-to-peak on average across channels). Filters need some time to achieve full attenuation. The problem can, however, be significantly reduced using somewhat different filter settings.<br>
<br>
First, I would suggest to separate high-pass and low-pass filter. You may then use lower low-pass filter orders considerably reducing the temporal extent of the artifact. Further, I would suggest to use a lower low-pass cutoff frequency, e.g. 45 Hz (i.e., passband edge 40 Hz).<br>
EEG = pop_eegfiltnew(EEG, 1,[],6600,0,[],1);<br>
EEG = pop_eegfiltnew(EEG, [],40,660,0,[],1);<br>
<br>
When filtering, the data have to be padded at the edges. We do pad with a DC constant to reliably avoid DC artifacts. With a harmonic oscillation in the data, padding with a constant implies amplitude modulation and amplitude modulation spectrally smears the line noise interference to adjacent bands at the edges of the signal. Therefore you have to use cutoff frequencies further away from the line noise interference frequency if the signal edges are important and cannot be cut away. Intuitively, mirror padding might might be an apparent solution to this problem. However, this will introduce other nice edge artifacts due to phase reset and DC shifts.<br>
<br>
Usually, I would recommend to try other ways to remove the line noise interference, for example Cleanline or DFT filters. Not sure how Cleanline copes with the TMS artifacts, however. One more comment: The line noise interference is really strong, even for a recording in an unshielded environment. Might there possibly be a problem with common mode rejection in your EEG setup?<br>
<br>
Hope this helps! Best,<br>
Andreas<br>
<br>
> Am 16.07.2018 um 20:48 schrieb Erickson <<a href="mailto:ericksonb.eng@gmail.com" target="_blank">ericksonb.eng@gmail.com</a>>:<br>
> <br>
> Thanks for your responses.<br>
> <br>
> Andreas, I used the "basic FIR filter" on automatic order calculation filtering from 1 to 55.<br>
> <br>
> Here is a drive link to a zip file with 30s of example data. These data were imported using fileIO and the event channel (65) was imported as events (Nothing else has been done to this example data).<br>
> <a href="https://drive.google.com/open?id=1KPlpeBCrCnQJHCJOcMYsnNSJVOjj0bTO" rel="noreferrer" target="_blank">https://drive.google.com/open?id=1KPlpeBCrCnQJHCJOcMYsnNSJVOjj0bTO</a><br>
> <br>
> Then I plotted the data and cut out one section around a TMS event, and another section NOT around a TMS event;<br>
> EEG = eeg_eegrej( EEG, [4615 5372;11482 12002]);<br>
> [ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 1,'setname','with Rejections','gui','off'); <br>
> <br>
> filtered the data using the FIR filter from 1 to 55hz;<br>
> EEG = pop_eegfiltnew(EEG, 1,55,6600,0,[],1);<br>
> [ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 2,'setname','with Rejections and Filter','gui','off'); <br>
> <br>
> then plotting the data, the artifact is visible as a "pinching" around each boundary, with a faster oscillation riding on top. So basically just reject any section of data and filter and the artifact appears.<br>
> <br>
> Makoto, to answer the question about the spectra - if I cut out the TMS pulses and then filter, the PSD looks pretty normal. Prior to filtering there is so much DC power I can't visually inspect the data very well.<br>
> <br>
> The room is very noisy, but this artifact appears only wherever I make a boundary and filter so it seems like an edge effect due to filtering - but I've never encountered this kind of artifact before since EEGLAB knows not to filter over boundaries. Perhaps I cannot use the automatic filter order here due to some noise profile in my data?<br>
> <br>
> Thanks to you both for considering the problem!<br>
> <br>
> Brian<br>
> <br>
> <br>
> On Thu, Jul 12, 2018 at 8:54 PM, Makoto Miyakoshi <<a href="mailto:mmiyakoshi@ucsd.edu" target="_blank">mmiyakoshi@ucsd.edu</a>> wrote:<br>
> Dear Erickson<br>
> <br>
> Is this really a distortion introduced by the filter? Rather, isn't it the case that that portion of the data was poorly filtered i.e., your original data, before filtering, had that noise constantly? Could you please check your original data by eyeballing the raw time series and by checking power spectral density?<br>
> <br>
> Makoto<br>
> <br>
> On Thu, Jul 12, 2018 at 10:33 AM Erickson <<a href="mailto:ericksonb.eng@gmail.com" target="_blank">ericksonb.eng@gmail.com</a>> wrote:<br>
> Hello EEGLAB list,<br>
> <br>
> We are experiencing a strange artifact on only some of our EEG data. For some subjects, when we cut out portions of data (creating boundary events) and then filter (from 1 to 40 or 50hz) we observe a distortion around the boundary.<br>
> <br>
> Specifically, we see a rising or falling wave on either side of the boundary, with a fast oscillation riding on top of it. See here: <a href="https://drive.google.com/open?id=1yt6h_WLgI6jWAApVd52nwVLuiduYgXIH" rel="noreferrer" target="_blank">https://drive.google.com/open?id=1yt6h_WLgI6jWAApVd52nwVLuiduYgXIH</a><br>
> <br>
> Although this data is from concurrent TMS-EEG recording, the distortion has nothing to do with the TMS pulse itself - we get the same boundary-related distortion when we filter after cutting out a random section of continuous data (a section with no TMS in it).<br>
> <br>
> I am at a loss - we've tried a few different filters and nothing seems to solve this issue. Meanwhile, on some subjects there is no boundary-related filter distortion at all! There is a lot of noise in the room but I'm not sure how that could create this specific issue.<br>
> <br>
> Any perspectives on this issue are appreciated! Thank you,<br>
> <br>
> Brian<br>
> <br>
> Brian Erickson, Ph.D.<br>
> Postdoctoral Researcher, CogNeW Lab<br>
> <br>
> Drexel University<br>
> <a href="https://maps.google.com/?q=3141+Chestnut+Street&entry=gmail&source=g" target="_blank">3141 Chestnut Street</a><br>
> Stratton Hall Room 320<br>
> Philadelphia, PA 19104<br>
> <br>
> _______________________________________________<br>
> Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" rel="noreferrer" 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>
> <br>
> <br>
> -- <br>
> Makoto Miyakoshi<br>
> Swartz Center for Computational Neuroscience<br>
> Institute for Neural Computation, University of California San Diego<br>
> <br>
> _______________________________________________<br>
> Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" rel="noreferrer" 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>
<br>
_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" rel="noreferrer" 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></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_3813714468402290205m_-6839302223063137909gmail_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></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" 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>