[Eeglablist] Resampling "artefacts" 512-500 Hz

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Fri Jul 12 20:06:53 PDT 2019

Dear Annika,

Currently I have no idea how it happened, but as a general guess I would
doubt whether it is some kind of aliasing. If you send the data to Andreas,
please send it to me as well.

I agree with Ryan on general argument that having the same sampling rate
does not guarantee synchronicity between the two data streams. You need to
have common timestamps generated by a common mechanism. Lab streaming layer
(LSL) is a solution for this kind of situation. If you haven't checked it,
this is the link to start with


On Mon, Jul 8, 2019 at 8:35 AM Downey, Ryan J <RDowney at bme.ufl.edu> wrote:

> Annika,
> I just wanted to give a brief comment about low pass filtering to avoid
> aliasing before suggesting an alternative to resampling your EEG data.
> Low pass filters do in fact prevent aliasing but that is mostly only true
> for low pass filters applied during the data collection (analog circuits
> built into the amplifiers). As soon as you digitally sample the data, the
> aliasing has already occurred and it is too late for low pass filtering to
> be effective (high frequencies are already falsely appearing as low
> frequencies so using a filter to get rid of high frequencies doesn't help).
> So for example if you recorded at 1000 Hz sampling frequency and there was
> 4000 Hz noise that wasn't analog filtered at the time of collection, that
> 4000 Hz noise signal will persist in your digitally sampled data as low
> frequencies. Usually manufacturers have a low pass filter applied during
> data collection already, whether you are aware of it or not. Someimtes you
> can manipulate the parameters and sometimes not. The cut off frequency is
> typically set to 1/4 the sampling frequency). Note that no filters
> perfectly (100%) reject data in a specified frequency range so some
> aliasing may still occur but usually not much. The frequencies closest to
> the cut off are the ones most likely to slip by.
> The only case I can think of where applying a digital low pass filter
> (i.e. processing your data after it is recorded) would help remove aliasing
> is in the case of down sampling. For example if your raw data is recorded
> at 1000 Hz, it contains frequencies up to 500 Hz and if you want to down
> sample to say 200 Hz, then all the frequency content from 100 Hz (1/2 of
> 200) to 500 Hz (1/2 of 1000) needs to be removed BEFORE resampling.
> Thankfully EEGLAB automatically does this for you when you ask it to
> resample. Just remember that the low pass filter it applies can't really
> remove aliasing that already exists on your raw data. Technically speaking
> you could strongly filter the data to remove it, but you would have to know
> the frequency at which the aliasing is appearing and that would have to not
> also coincide with a frequency you are interested in (e.g. alpha in your
> data).
> Note that resampling the EEG signal from 512 to 500 Hz so it matches with
> your eye tracking 500 Hz data may not be the best approach. Even if you
> were able to resample your EEG data to 500 Hz without these artifacts,
> rarely do systems actually record at the sampling frequency they claim. For
> example, even if your EEG recorded at 500 Hz and your eye tracking recorded
> at 500 Hz, there is no guarantee they will line up. One system might
> actually record at 500.01 Hz and another at 499.99 Hz. If you just assume
> they both recorded at 500 Hz perfectly, then there will be a drift in their
> alignment over time; the longer your recording is, the worse the alignment
> will get. Ideally, you should have a start and a stop trigger signal or
> event markers common to your EEG and eye tracking system so that you can
> record these events in their local time systems and then properly align
> both the beginning and the ending points of the two systems together. Also,
> if you don't really need to have the eye tracking data and EEG data
> perfectly synched together (i.e. see their data streams simultaneously) but
> only need to know eye event timing (e.g.  when someone looked at a target),
> then you can simply linearly relate the eye tracking time to the EEG time
> (based on known common start/stop triggers) and then find the closest EEG
> sample that lines up with an eye tracking event of interest.
> Ryan J. Downey
> Postdoctoral Associate
> Human Neuromechanics Laboratory
> Biomedical Engineering Dept.
> University of Florida
> -----Original Message-----
> From: eeglablist <eeglablist-bounces at sccn.ucsd.edu> On Behalf Of Andreas
> Widmann
> Sent: Monday, July 8, 2019 6:59 AM
> To: Ziereis, Annika Carina <annika.ziereis at uni-goettingen.de>
> Cc: eeglablist at sccn.ucsd.edu
> Subject: Re: [Eeglablist] Resampling "artefacts" 512-500 Hz
> Hi Annika,
> from the sampling frequency I guess these are Biosemi data? Did you
> DC-correct (subtract mean per channel) or high-pass filter the data (before
> or after re-sampling)? In case not, could you please try first whether this
> solves the problem? In case the problem persists, could you please provide
> a sample file and the code of the preceding pre-processing steps (from eegh
> in case you used GUI).
> Best,
> Andreas
> > Am 04.07.2019 um 18:06 schrieb Ziereis, Annika Carina <
> annika.ziereis at uni-goettingen.de>:
> >
> > Dear all,
> >
> > (I'd like to say beforehand that I am a total beginner in signal
> > processing... so if you have an idea why this happened I'd be very
> > happy if you'd consider it in your explanation)
> >
> > For the EEG recording we use a sampling rate of 512 Hz which we want to
> down-sample to 500 Hz (we do simultaneous eye-tracking which records with
> 500 Hz and we want to do a co-registration).
> >
> > During the pre-processing I looked at the power spectral density and
> found a power increase for the harmonics of 12 Hz (so peaks at 12, 24, 36
> ... Hz) after resampling to 500 Hz. These peaks were not visible in the
> power spectral density plot of the raw data.
> > It was especially pronounced for participants with a higher alpha power
> and not so much for those with low alpha power.
> > I played with some resampling frequencies to check how it looks like for
> 499 Hz, 501 Hz 497 Hz... and 256 Hz (to compare to a integer ratio).
> > The "artefacts" only occur  for 499, 500 and 501 Hz-showing each the
> > harmonics of the difference in Hz e.g. for 499 Hz (which would be 13Hz
> less than the original sampling rate) I get the harmonic peaks for 13, 26
> and so on.
> > It disappears for Frequencies that are not in the alpha range (e.g. 15
> Hz, for resampling to 497 Hz).
> >
> > Then I read that one could do low-pass filtering to avoid aliasing
> effects (which I have to admit- I don' t understand very well). So I tried
> to low-pass filtering of 40 Hz  (I just used 40 Hz because we did so in
> another study) and do the resampling again. This resulted in the same
> harmonics and super strange peaks in the filtered out frequencies.
> > I uploaded a pdf with pictures here (hopefully, it makes it more clear
> > what I mean):
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_aziere
> > is_eegquestions_blob_master_downsampling.pdf&d=DwIGaQ&c=sJ6xIWYx-zLMB3
> > EPkvcnVg&r=Xqv3i1MFyNQV9dhuL1e9BtqA0SbF1UWmfPtBzxDT0xY&m=v0YIIJolrv-LJ
> > LgewPhhXUmnldQBmDQsGG--GMeQZ7c&s=GO4wqI0qRWKBRbjE7byitpUIyyirXImggx_hQ
> > ikppFE&e=
> >
> >
> > Has anybody encountered this problem before?
> > Is this artefact problematic?
> > Thank you very much for your help!!
> >
> > Best
> > Annika
> >
> >
> >
> > ---
> > Annika Carina Ziereis
> >
> > Georg-Elias-Müller Institute for Psychology
> > - Affective Neuroscience and Psychophysiology - University Göttingen
> > Goßlerstr. 14
> > 37073 Göttingen
> >
> > Phone +49 551 39 20623
> >
> > Email: annika.ziereis at uni-goettingen.de
> >
> >
> > _______________________________________________
> > Eeglablist page:
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__sccn.ucsd.edu_eegl
> > ab_eeglabmail.html&d=DwIGaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=Xqv3i1MFyNQV9dh
> > uL1e9BtqA0SbF1UWmfPtBzxDT0xY&m=v0YIIJolrv-LJLgewPhhXUmnldQBmDQsGG--GMe
> > QZ7c&s=4b-4tw26Fmqr1XzFkHnzbn_kyRPnAwz1qkjKPCoB1Ik&e=
> > To unsubscribe, send an empty email to
> > 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
> >
> _______________________________________________
> Eeglablist page:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__sccn.ucsd.edu_eeglab_eeglabmail.html&d=DwIGaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=Xqv3i1MFyNQV9dhuL1e9BtqA0SbF1UWmfPtBzxDT0xY&m=v0YIIJolrv-LJLgewPhhXUmnldQBmDQsGG--GMeQZ7c&s=4b-4tw26Fmqr1XzFkHnzbn_kyRPnAwz1qkjKPCoB1Ik&e=
> To unsubscribe, send an empty email to
> 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
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> 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

Makoto Miyakoshi
Assistant Project Scientist, Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego

More information about the eeglablist mailing list