[Mne_analysis] Mne_analysis Digest, Vol 150, Issue 40

Dan McCloy dan at mccloy.info
Fri Jul 24 13:24:06 EDT 2020
Search archives:

        External Email - Use Caution        

Hi Rodney,
Could you take a look at these two tutorials, and suggest where you think the additional information would best fit in?

https://mne.tools/dev/auto_tutorials/preprocessing/plot_30_filtering_resampling.html

https://mne.tools/dev/auto_tutorials/discussions/plot_background_filtering.html

Or is there somewhere else the information should go? (maybe the glossary? https://mne.tools/dev/glossary.html)

If you end up with a clear idea of what should be added and where, you could open a pull request to improve the documentation yourself; if you're not sure, please open an issue with whatever information you *are* sure of (what terms need defining, on which page it should be done, etc).

-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, July 24, 2020 12:50 AM, Brunner, Clemens (clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at> wrote:

> External Email - Use Caution
>
> Hi Rodney!
>
> Yes, definitely. Given that the terms resampling, downsampling, upsampling, and decimation are ambiguous even in the signal processing literature, we will add a clarification/statement on how we define these terms in MNE.
>
> Clemens
>
> > On 24.07.2020, at 03:55, balandongiv at gmail.com wrote:
> >
> >        External Email - Use Caution
> >
> >
> > Dear Clemens, Larson, Phillip,
> > Thanks for the detail explanation, really appreciate it.
> > Just a suggestion, maybe part of the discussion can be incorporated
> > somewhere along with mne FAQ or equivalent. This might be helpful,
> > especially to those new in the field.
> > Rodney
> > -----Original Message-----
> > From: mne_analysis-bounces at nmr.mgh.harvard.edu
> > mne_analysis-bounces at nmr.mgh.harvard.edu On Behalf Of
> > mne_analysis-request at nmr.mgh.harvard.edu
> > Sent: Thursday, 23 July, 2020 9:10 PM
> > To: mne_analysis at nmr.mgh.harvard.edu
> > Subject: Mne_analysis Digest, Vol 150, Issue 40
> > Send Mne_analysis mailing list submissions to
> > mne_analysis at nmr.mgh.harvard.edu
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > or, via email, send a message with subject or body 'help' to
> > mne_analysis-request at nmr.mgh.harvard.edu
> > You can reach the person managing the list at
> > mne_analysis-owner at nmr.mgh.harvard.edu
> > When replying, please edit your Subject line so it is more specific than
> > "Re: Contents of Mne_analysis digest..."
> > Today's Topics:
> >
> > 1.  Re: Why does MNE resample method does not sample the data
> >     point to point? (Eric Larson)
> >
> > 2.  Re: Why does MNE resample method does not sample the data
> >     point to point? (Brunner, Clemens (clemens.brunner at uni-graz.at))
> >
> > 3.  Re: Why does MNE resample method does not sample the data
> >     point to point? (Phillip Alday)
> >
> >
> > Message: 1
> > Date: Thu, 23 Jul 2020 08:40:56 -0400
> > From: Eric Larson larson.eric.d at gmail.com
> > Subject: Re: [Mne_analysis] Why does MNE resample method does not
> > sample the data point to point?
> > To: Discussion and support forum for the users of MNE Software
> > mne_analysis at nmr.mgh.harvard.edu
> > Message-ID:
> > CAGu2niVV+79nq5Yu17B4VzB3PS71x7sFTy8HKNukDxnaDdi6hQ at mail.gmail.com
> > Content-Type: text/plain; charset="utf-8"
> >
> >        External Email - Use Caution
> >
> >
> > > My understanding of downsampling is that it is an operation to
> > > decrease the sample rate of x by keeping the first sample and then
> > > every nth sample after the first.
> >
> > Resampling typically consists of two steps: low-pass filtering to avoid
> > aliasing, then sample rate reduction (subselecting samples from the
> > resulting signal). The low-passing actually changes the values, so the
> > subselection-of-filtered-data step will not necessarily yield points that
> > were "on" the original signal.
> >
> > > May I know whether this issue is due to the ringing artifacts or due
> > > to other problems?
> >
> > In this case it's likely due to the (implicit) low-pass filtering in the
> > frequency-domain resampling of the signal. It looks pretty reasonable to me.
> > If you want to play around with it a bit, you can
> >
> > 1.  Call scipy.signal.resample directly on your data and see how closely it
> >     matches.
> >
> > 2.  Pad your signal, call scipy.signal.resample, and remove the (now
> >     reduced-length) padding -- this is what MNE does internally.
> >
> > 3.  Use scipy.signal.resample_poly directly on your data.
> > 4.  Manually low-pass filter and then directly subselect samples from the
> >     low-passed signal, which is what resample_poly does internally.
> >
> >
> > Hopefully these all give similar results for your signal(s).
> > Eric
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> > http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200723/
> > a8812d4e/attachment-0001.html
> >
> > Message: 2
> > Date: Thu, 23 Jul 2020 12:57:29 +0000
> > From: "Brunner, Clemens (clemens.brunner at uni-graz.at)"
> > clemens.brunner at uni-graz.at
> > Subject: Re: [Mne_analysis] Why does MNE resample method does not
> > sample the data point to point?
> > To: Discussion and support forum for the users of MNE Software
> > mne_analysis at nmr.mgh.harvard.edu
> > Message-ID: 21199B34-7BD6-4C1B-81CC-749DFB86E3FC at uni-graz.at
> > Content-Type: text/plain; charset="us-ascii"
> >
> >        External Email - Use Caution
> >
> >
> > Also note that the resample example
> > (https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample.
> > html) shows upsampling, i.e. the data has a lower sampling rate than the
> > resampled result. However, in the case of downsampling it is usually
> > necessary to avoid aliasing of frequencies above the resampled Nyquist
> > frequency. Therefore, the signal is typically low-pass filtered before the
> > resampling step. As Eric mentioned, this anti-aliasing filter is what
> > actually changes the signal values, but it is necessary to avoid aliasing
> > artifacts.
> > AFAIK, scipy.signal.resample doesn't include an anti-aliasing filter, but
> > both scipy.signal.resample_poly as well as scipy.signal.decimate apply such
> > a low-pass filter before resampling. That's also what MNE does.
> > Clemens
> >
> > > On 23.07.2020, at 14:40, Eric Larson larson.eric.d at gmail.com wrote:
> > >
> > >        External Email - Use Caution
> > >
> > >
> > > My understanding of downsampling is that it is an operation to decrease
> > > the sample rate of x by keeping the first sample and then every nth sample
> > > after the first.
> > > Resampling typically consists of two steps: low-pass filtering to avoid
> > > aliasing, then sample rate reduction (subselecting samples from the
> > > resulting signal). The low-passing actually changes the values, so the
> > > subselection-of-filtered-data step will not necessarily yield points that
> > > were "on" the original signal.
> > > May I know whether this issue is due to the ringing artifacts or due to
> > > other problems?
> > > In this case it's likely due to the (implicit) low-pass filtering in
> > > the frequency-domain resampling of the signal. It looks pretty
> > > reasonable to me. If you want to play around with it a bit, you can
> > >
> > > 1.  Call scipy.signal.resample directly on your data and see how closely it
> > >     matches.
> > >
> > > 2.  Pad your signal, call scipy.signal.resample, and remove the (now
> > >     reduced-length) padding -- this is what MNE does internally.
> > >
> > > 3.  Use scipy.signal.resample_poly directly on your data.
> > > 4.  Manually low-pass filter and then directly subselect samples from the
> > >     low-passed signal, which is what resample_poly does internally.
> > >
> > >
> > > Hopefully these all give similar results for your signal(s).
> > > Eric
> > >
> > > Mne_analysis mailing list
> > > Mne_analysis at nmr.mgh.harvard.edu
> > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >
> > Message: 3
> > Date: Thu, 23 Jul 2020 15:09:44 +0200
> > From: Phillip Alday phillip.alday at mpi.nl
> > Subject: Re: [Mne_analysis] Why does MNE resample method does not
> > sample the data point to point?
> > To: Discussion and support forum for the users of MNE Software
> > mne_analysis at nmr.mgh.harvard.edu, "Brunner, Clemens
> > (clemens.brunner at uni-graz.at)" clemens.brunner at uni-graz.at
> > Message-ID: 16e39842-34bd-465d-9491-b5651302add4 at mpi.nl
> > Content-Type: text/plain; charset="utf-8"
> >
> >        External Email - Use Caution
> >
> >
> > I think the up- vs. downsampling distinction is also really important for
> > expectations here, as is the distinction between decimating and resampling
> > (I recall there was a thread about that a few years back with similar
> > confusion, if somebody wants to do the effort of searching for it)
> > Phillip
> > On 23/7/20 2:57 pm, Brunner, Clemens (clemens.brunner at uni-graz.at) wrote:
> >
> > >        External Email - Use Caution
> > >
> > >
> > > Also note that the resample example
> > > (https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample.
> > > html) shows upsampling, i.e. the data has a lower sampling rate than the
> > > resampled result. However, in the case of downsampling it is usually
> > > necessary to avoid aliasing of frequencies above the resampled Nyquist
> > > frequency. Therefore, the signal is typically low-pass filtered before the
> > > resampling step. As Eric mentioned, this anti-aliasing filter is what
> > > actually changes the signal values, but it is necessary to avoid aliasing
> > > artifacts.
> > > AFAIK, scipy.signal.resample doesn't include an anti-aliasing filter, but
> > > both scipy.signal.resample_poly as well as scipy.signal.decimate apply such
> > > a low-pass filter before resampling. That's also what MNE does.
> > > Clemens
> > >
> > > > On 23.07.2020, at 14:40, Eric Larson larson.eric.d at gmail.com wrote:
> > > >
> > > >        External Email - Use Caution
> > > >
> > > >
> > > > My understanding of downsampling is that it is an operation to decrease
> > > > the sample rate of x by keeping the first sample and then every nth sample
> > > > after the first.
> > >
> > > > Resampling typically consists of two steps: low-pass filtering to avoid
> > > > aliasing, then sample rate reduction (subselecting samples from the
> > > > resulting signal). The low-passing actually changes the values, so the
> > > > subselection-of-filtered-data step will not necessarily yield points that
> > > > were "on" the original signal.
> > >
> > > > May I know whether this issue is due to the ringing artifacts or due to
> > > > other problems?
> > >
> > > > In this case it's likely due to the (implicit) low-pass filtering in
> > > > the frequency-domain resampling of the signal. It looks pretty
> > > > reasonable to me. If you want to play around with it a bit, you can
> > > >
> > > > 1.  Call scipy.signal.resample directly on your data and see how closely
> > > >     it matches.
> > > >
> > >
> > > > 2.  Pad your signal, call scipy.signal.resample, and remove the (now
> > > >     reduced-length) padding -- this is what MNE does internally.
> > > >
> > >
> > > > 3.  Use scipy.signal.resample_poly directly on your data.
> > > > 4.  Manually low-pass filter and then directly subselect samples from the
> > > >     low-passed signal, which is what resample_poly does internally.
> > > >
> > >
> > > > Hopefully these all give similar results for your signal(s).
> > > > Eric
> > > >
> > > > Mne_analysis mailing list
> > > > Mne_analysis at nmr.mgh.harvard.edu
> > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > >
> > > Mne_analysis mailing list
> > > Mne_analysis at nmr.mgh.harvard.edu
> > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > End of Mne_analysis Digest, Vol 150, Issue 40
> >
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis





More information about the Mne_analysis mailing list