Badly resample signal

External Email - Use Caution

Dear All,

The issue is about sample badly approximated

Given an original signal sampled at 100Hz, the objective was to downsampled it into 50 Hz
The downsampling process was realised using the MNE resample.

However, as can be noticed from the image below, the sample is badly approximated. Instead of registering the original signal magnitude, the function RESAMPLE return an approximated signal magnitude.

This rise two question

  1. Is it common for such badly resample to occur?
  2. If yes, how to minimize this

The problem can be reproduced using the notebook which is accessible through this link<https://github.com/balandongiv/EyeCloseOpen/blob/master/HelpImportDownsample_EDF.ipynb>.

Thanks in advance for entertaining this request

[A close up of a map Description automatically generated]

Regards
Rodney
DISCLAIMER : This e-mail and any files transmitted with it ("Message") is intended only for the use of the recipient(s) named above and may contain confidential information. You are hereby notified that the taking of any action in reliance upon, or any review, retransmission, dissemination, distribution, printing or copying of this Message or any part thereof by anyone other than the intended recipient(s) is strictly prohibited. If you have received this Message in error, you should delete this Message immediately and advise the sender by return e-mail. Opinions, conclusions and other information in this Message that do not relate to the official business of Universiti Teknologi PETRONAS (UTP) shall be understood as neither given nor endorsed by Universiti Teknologi PETRONAS (UTP).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/857548e1/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 23070 bytes
Desc: image002.png
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/857548e1/attachment-0001.png

External Email - Use Caution

This is expected behavior for resampling. With resampling, you lose
temporal resolution, so fast, high amplitude deviations are lost.? This
is what happens at the beginning of your signal. Later in the signal you
see that the slower change in the mean of the signal is preserved, but
the bumps are list.

Intuitively: you have fewer samples, so you can't capture both the
deviations up and the deviations down, so they average out and you get
just the mean. So the big peak and big trough early in your example just
cancel out when resampled.

Phillip

???External Email - Use Caution???

Dear All,

?

The issue is about sample badly approximated

?

Given an original signal sampled at 100Hz, the objective was to
downsampled it into 50 Hz

The downsampling process was realised using the MNE resample.

?

However, as can be noticed from the image below, the sample is badly
approximated. Instead of registering the original signal magnitude,
the function RESAMPLE return an approximated signal magnitude.

?

This rise two question

1. Is it common for such badly resample to occur?
2. If yes, how to minimize this

?

The problem can be reproduced using the notebook which is accessible
through this link
<https://github.com/balandongiv/EyeCloseOpen/blob/master/HelpImportDownsample_EDF.ipynb&gt;\.

?

Thanks in advance for entertaining this request

?

?

A close up of a map Description automatically generated

?

?

Regards

Rodney

DISCLAIMER : This e-mail and any files transmitted with it ("Message")
is intended only for the use of the recipient(s) named above and may
contain confidential information. You are hereby notified that the
taking of any action in reliance upon, or any review, retransmission,
dissemination, distribution, printing or copying of this Message or
any part thereof by anyone other than the intended recipient(s) is
strictly prohibited. If you have received this Message in error, you
should delete this Message immediately and advise the sender by return
e-mail. Opinions, conclusions and other information in this Message
that do not relate to the official business of Universiti Teknologi
PETRONAS (UTP) shall be understood as neither given nor endorsed by
Universiti Teknologi PETRONAS (UTP).

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/7a676d32/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 23070 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/7a676d32/attachment-0001.png

External Email - Use Caution

Dear Phillip,

Thanks for the response,

Just wonder whether there exist different technique to address such an issue? For example, rather than using the averaging approach

Regards
Rodney

External Email - Use Caution

Appropriate filtering may help with some things, but .... I think we're
heading into XY question territory here (http://xyproblem.info/).

Why do you want to resample? What are you trying to accomplish?

Phillip

Dear Phillip,

?

Thanks for the response,

?

Just wonder whether there exist different technique to address such an
issue? For example, rather than using the averaging approach

?

Regards

Rodney

?

*From:*Phillip Alday <phillip.alday at mpi.nl>
*Sent:* Thursday, 22 August, 2019 4:33 PM
*To:* Discussion and support forum for the users of MNE Software
<mne_analysis at nmr.mgh.harvard.edu>; RODNEY PETRUS BALANDONG
<rodney.petrus_g03291 at utp.edu.my>
*Subject:* Re: [Mne_analysis] Badly resample signal

?

This is expected behavior for resampling. With resampling, you lose
temporal resolution, so fast, high amplitude deviations are lost.?
This is what happens at the beginning of your signal. Later in the
signal you see that the slower change in the mean of the signal is
preserved, but the bumps are list.

Intuitively: you have fewer samples, so you can't capture both the
deviations up and the deviations down, so they average out and you get
just the mean. So the big peak and big trough early in your example
just cancel out when resampled.

Phillip

    *???External Email - Use Caution???*

    Dear All,

    ?

    The issue is about sample badly approximated

    ?

    Given an original signal sampled at 100Hz, the objective was to
    downsampled it into 50 Hz

    The downsampling process was realised using the MNE resample.

    ?

    However, as can be noticed from the image below, the sample is
    badly approximated. Instead of registering the original signal
    magnitude, the function RESAMPLE return an approximated signal
    magnitude.

    ?

    This rise two question

     1. Is it common for such badly resample to occur?
     2. If yes, how to minimize this

    ?

    The problem can be reproduced using the notebook which is
    accessible through this link
    <https://github.com/balandongiv/EyeCloseOpen/blob/master/HelpImportDownsample_EDF.ipynb&gt;\.

    ?

    Thanks in advance for entertaining this request

    ?

    ?

    A close up of a map Description automatically generated

    ?

    ?

    Regards

    Rodney

    DISCLAIMER : This e-mail and any files transmitted with it
    ("Message") is intended only for the use of the recipient(s) named
    above and may contain confidential information. You are hereby
    notified that the taking of any action in reliance upon, or any
    review, retransmission, dissemination, distribution, printing or
    copying of this Message or any part thereof by anyone other than
    the intended recipient(s) is strictly prohibited. If you have
    received this Message in error, you should delete this Message
    immediately and advise the sender by return e-mail. Opinions,
    conclusions and other information in this Message that do not
    relate to the official business of Universiti Teknologi PETRONAS
    (UTP) shall be understood as neither given nor endorsed by
    Universiti Teknologi PETRONAS (UTP).

    _______________________________________________

    Mne_analysis mailing list

    Mne_analysis at nmr.mgh.harvard.edu <mailto:Mne_analysis at nmr.mgh.harvard.edu>

    https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

DISCLAIMER : This e-mail and any files transmitted with it ("Message")
is intended only for the use of the recipient(s) named above and may
contain confidential information. You are hereby notified that the
taking of any action in reliance upon, or any review, retransmission,
dissemination, distribution, printing or copying of this Message or
any part thereof by anyone other than the intended recipient(s) is
strictly prohibited. If you have received this Message in error, you
should delete this Message immediately and advise the sender by return
e-mail. Opinions, conclusions and other information in this Message
that do not relate to the official business of Universiti Teknologi
PETRONAS (UTP) shall be understood as neither given nor endorsed by
Universiti Teknologi PETRONAS (UTP).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/94003f8d/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 23070 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/94003f8d/attachment-0001.png

External Email - Use Caution

I need to downsample an original signal that sampled at 1000Hz to 100Hz.

External Email - Use Caution

But why do you need to resample? That's what I meant with an XY problem.

Why do you care about brief high-frequency peaks?

Phillip

I need to downsample an original signal that sampled at 1000Hz to 100Hz.

?

*From:*Phillip Alday <phillip.alday at mpi.nl>
*Sent:* Thursday, 22 August, 2019 4:44 PM
*To:* RODNEY PETRUS BALANDONG <rodney.petrus_g03291 at utp.edu.my>
*Cc:* mne_analysis at nmr.mgh.harvard.edu
*Subject:* Re: [Mne_analysis] Badly resample signal

?

Appropriate filtering may help with some things, but .... I think
we're heading into XY question territory here (http://xyproblem.info/).

Why do you want to resample? What are you trying to accomplish?

Phillip

    Dear Phillip,

    ?

    Thanks for the response,

    ?

    Just wonder whether there exist different technique to address
    such an issue? For example, rather than using the averaging approach

    ?

    Regards

    Rodney

    ?

    *From:*Phillip Alday <phillip.alday at mpi.nl>
    <mailto:phillip.alday at mpi.nl>
    *Sent:* Thursday, 22 August, 2019 4:33 PM
    *To:* Discussion and support forum for the users of MNE Software
    <mne_analysis at nmr.mgh.harvard.edu>
    <mailto:mne_analysis at nmr.mgh.harvard.edu>; RODNEY PETRUS BALANDONG
    <rodney.petrus_g03291 at utp.edu.my>
    <mailto:rodney.petrus_g03291 at utp.edu.my>
    *Subject:* Re: [Mne_analysis] Badly resample signal

    ?

    This is expected behavior for resampling. With resampling, you
    lose temporal resolution, so fast, high amplitude deviations are
    lost.? This is what happens at the beginning of your signal. Later
    in the signal you see that the slower change in the mean of the
    signal is preserved, but the bumps are list.

    Intuitively: you have fewer samples, so you can't capture both the
    deviations up and the deviations down, so they average out and you
    get just the mean. So the big peak and big trough early in your
    example just cancel out when resampled.

    Phillip

        *???External Email - Use Caution???*

        Dear All,

        ?

        The issue is about sample badly approximated

        ?

        Given an original signal sampled at 100Hz, the objective was
        to downsampled it into 50 Hz

        The downsampling process was realised using the MNE resample.

        ?

        However, as can be noticed from the image below, the sample is
        badly approximated. Instead of registering the original signal
        magnitude, the function RESAMPLE return an approximated signal
        magnitude.

        ?

        This rise two question

         1. Is it common for such badly resample to occur?
         2. If yes, how to minimize this

        ?

        The problem can be reproduced using the notebook which is
        accessible through this link
        <https://github.com/balandongiv/EyeCloseOpen/blob/master/HelpImportDownsample_EDF.ipynb&gt;\.

        ?

        Thanks in advance for entertaining this request

        ?

        ?

        A close up of a map Description automatically generated

        ?

        ?

        Regards

        Rodney

        DISCLAIMER : This e-mail and any files transmitted with it
        ("Message") is intended only for the use of the recipient(s)
        named above and may contain confidential information. You are
        hereby notified that the taking of any action in reliance
        upon, or any review, retransmission, dissemination,
        distribution, printing or copying of this Message or any part
        thereof by anyone other than the intended recipient(s) is
        strictly prohibited. If you have received this Message in
        error, you should delete this Message immediately and advise
        the sender by return e-mail. Opinions, conclusions and other
        information in this Message that do not relate to the official
        business of Universiti Teknologi PETRONAS (UTP) shall be
        understood as neither given nor endorsed by Universiti
        Teknologi PETRONAS (UTP).

        _______________________________________________

        Mne_analysis mailing list

        Mne_analysis at nmr.mgh.harvard.edu <mailto:Mne_analysis at nmr.mgh.harvard.edu>

        https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

    DISCLAIMER : This e-mail and any files transmitted with it
    ("Message") is intended only for the use of the recipient(s) named
    above and may contain confidential information. You are hereby
    notified that the taking of any action in reliance upon, or any
    review, retransmission, dissemination, distribution, printing or
    copying of this Message or any part thereof by anyone other than
    the intended recipient(s) is strictly prohibited. If you have
    received this Message in error, you should delete this Message
    immediately and advise the sender by return e-mail. Opinions,
    conclusions and other information in this Message that do not
    relate to the official business of Universiti Teknologi PETRONAS
    (UTP) shall be understood as neither given nor endorsed by
    Universiti Teknologi PETRONAS (UTP).

DISCLAIMER : This e-mail and any files transmitted with it ("Message")
is intended only for the use of the recipient(s) named above and may
contain confidential information. You are hereby notified that the
taking of any action in reliance upon, or any review, retransmission,
dissemination, distribution, printing or copying of this Message or
any part thereof by anyone other than the intended recipient(s) is
strictly prohibited. If you have received this Message in error, you
should delete this Message immediately and advise the sender by return
e-mail. Opinions, conclusions and other information in this Message
that do not relate to the official business of Universiti Teknologi
PETRONAS (UTP) shall be understood as neither given nor endorsed by
Universiti Teknologi PETRONAS (UTP).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/974adb8f/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 23070 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/974adb8f/attachment-0001.png

External Email - Use Caution

I only interested with the signal up to 100Hz, so it redundant and computationally expensive to handle signal with 1000Hz.

I'm just curious whether ignoring those brief high-frequency peaks will affect the overall analysis later. So, if there is a way to these brief high-frequency would be an advantage.

Anyhow, is it common practice to neglect the brief high-frequency peaks?

External Email - Use Caution

If you don't care about signals above > 100 Hz, then you by definition
don't care about high frequency stuff.?

You have to choose.

That said, there is a lot of documentation on the MNE website about
resampling:

http://martinos.org/mne/stable/auto_examples/preprocessing/plot_resample.html#sphx-glr-auto-examples-preprocessing-plot-resample-py

http://martinos.org/mne/stable/search.html?q=resampling&check_keywords=yes&area=default

I only interested with the signal up to 100Hz, so it redundant and
computationally expensive to handle signal with 1000Hz.

?

I'm just curious whether ignoring those brief high-frequency peaks
will affect the overall analysis later. ?So, if ?there is a way to
these brief high-frequency would be an advantage.

?

Anyhow, is it common practice to neglect the brief high-frequency peaks?

?

*From:*Phillip Alday <phillip.alday at mpi.nl>
*Sent:* Thursday, 22 August, 2019 4:53 PM
*To:* RODNEY PETRUS BALANDONG <rodney.petrus_g03291 at utp.edu.my>
*Cc:* mne_analysis at nmr.mgh.harvard.edu
*Subject:* Re: [Mne_analysis] Badly resample signal

?

But why do you need to resample? That's what I meant with an XY problem.

Why do you care about brief high-frequency peaks?

Phillip

    I need to downsample an original signal that sampled at 1000Hz to
    100Hz.

    ?

    *From:*Phillip Alday <phillip.alday at mpi.nl>
    <mailto:phillip.alday at mpi.nl>
    *Sent:* Thursday, 22 August, 2019 4:44 PM
    *To:* RODNEY PETRUS BALANDONG <rodney.petrus_g03291 at utp.edu.my>
    <mailto:rodney.petrus_g03291 at utp.edu.my>
    *Cc:* mne_analysis at nmr.mgh.harvard.edu
    <mailto:mne_analysis at nmr.mgh.harvard.edu>
    *Subject:* Re: [Mne_analysis] Badly resample signal

    ?

    Appropriate filtering may help with some things, but .... I think
    we're heading into XY question territory here
    (http://xyproblem.info/).

    Why do you want to resample? What are you trying to accomplish?

    Phillip

        Dear Phillip,

        ?

        Thanks for the response,

        ?

        Just wonder whether there exist different technique to address
        such an issue? For example, rather than using the averaging
        approach

        ?

        Regards

        Rodney

        ?

        *From:*Phillip Alday <phillip.alday at mpi.nl>
        <mailto:phillip.alday at mpi.nl>
        *Sent:* Thursday, 22 August, 2019 4:33 PM
        *To:* Discussion and support forum for the users of MNE
        Software <mne_analysis at nmr.mgh.harvard.edu>
        <mailto:mne_analysis at nmr.mgh.harvard.edu>; RODNEY PETRUS
        BALANDONG <rodney.petrus_g03291 at utp.edu.my>
        <mailto:rodney.petrus_g03291 at utp.edu.my>
        *Subject:* Re: [Mne_analysis] Badly resample signal

        ?

        This is expected behavior for resampling. With resampling, you
        lose temporal resolution, so fast, high amplitude deviations
        are lost.? This is what happens at the beginning of your
        signal. Later in the signal you see that the slower change in
        the mean of the signal is preserved, but the bumps are list.

        Intuitively: you have fewer samples, so you can't capture both
        the deviations up and the deviations down, so they average out
        and you get just the mean. So the big peak and big trough
        early in your example just cancel out when resampled.

        Phillip

            *???External Email - Use Caution???*

            Dear All,

            ?

            The issue is about sample badly approximated

            ?

            Given an original signal sampled at 100Hz, the objective
            was to downsampled it into 50 Hz

            The downsampling process was realised using the MNE resample.

            ?

            However, as can be noticed from the image below, the
            sample is badly approximated. Instead of registering the
            original signal magnitude, the function RESAMPLE return an
            approximated signal magnitude.

            ?

            This rise two question

             1. Is it common for such badly resample to occur?
             2. If yes, how to minimize this

            ?

            The problem can be reproduced using the notebook which is
            accessible through this link
            <https://github.com/balandongiv/EyeCloseOpen/blob/master/HelpImportDownsample_EDF.ipynb&gt;\.

            ?

            Thanks in advance for entertaining this request

            ?

            ?

            A close up of a map Description automatically generated

            ?

            ?

            Regards

            Rodney

            DISCLAIMER : This e-mail and any files transmitted with it
            ("Message") is intended only for the use of the
            recipient(s) named above and may contain confidential
            information. You are hereby notified that the taking of
            any action in reliance upon, or any review,
            retransmission, dissemination, distribution, printing or
            copying of this Message or any part thereof by anyone
            other than the intended recipient(s) is strictly
            prohibited. If you have received this Message in error,
            you should delete this Message immediately and advise the
            sender by return e-mail. Opinions, conclusions and other
            information in this Message that do not relate to the
            official business of Universiti Teknologi PETRONAS (UTP)
            shall be understood as neither given nor endorsed by
            Universiti Teknologi PETRONAS (UTP).

            _______________________________________________

            Mne_analysis mailing list

            Mne_analysis at nmr.mgh.harvard.edu <mailto:Mne_analysis at nmr.mgh.harvard.edu>

            Mne_analysis Info Page

        DISCLAIMER : This e-mail and any files transmitted with it
        ("Message") is intended only for the use of the recipient(s)
        named above and may contain confidential information. You are
        hereby notified that the taking of any action in reliance
        upon, or any review, retransmission, dissemination,
        distribution, printing or copying of this Message or any part
        thereof by anyone other than the intended recipient(s) is
        strictly prohibited. If you have received this Message in
        error, you should delete this Message immediately and advise
        the sender by return e-mail. Opinions, conclusions and other
        information in this Message that do not relate to the official
        business of Universiti Teknologi PETRONAS (UTP) shall be
        understood as neither given nor endorsed by Universiti
        Teknologi PETRONAS (UTP).

    DISCLAIMER : This e-mail and any files transmitted with it
    ("Message") is intended only for the use of the recipient(s) named
    above and may contain confidential information. You are hereby
    notified that the taking of any action in reliance upon, or any
    review, retransmission, dissemination, distribution, printing or
    copying of this Message or any part thereof by anyone other than
    the intended recipient(s) is strictly prohibited. If you have
    received this Message in error, you should delete this Message
    immediately and advise the sender by return e-mail. Opinions,
    conclusions and other information in this Message that do not
    relate to the official business of Universiti Teknologi PETRONAS
    (UTP) shall be understood as neither given nor endorsed by
    Universiti Teknologi PETRONAS (UTP).

DISCLAIMER : This e-mail and any files transmitted with it ("Message")
is intended only for the use of the recipient(s) named above and may
contain confidential information. You are hereby notified that the
taking of any action in reliance upon, or any review, retransmission,
dissemination, distribution, printing or copying of this Message or
any part thereof by anyone other than the intended recipient(s) is
strictly prohibited. If you have received this Message in error, you
should delete this Message immediately and advise the sender by return
e-mail. Opinions, conclusions and other information in this Message
that do not relate to the official business of Universiti Teknologi
PETRONAS (UTP) shall be understood as neither given nor endorsed by
Universiti Teknologi PETRONAS (UTP).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/3365d421/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 23070 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/3365d421/attachment-0001.png

External Email - Use Caution

Le 22/08/2019 ? 10:59, RODNEY PETRUS BALANDONG a ?crit?:

I only interested with the signal up to 100Hz, so it redundant and
computationally expensive to handle signal with 1000Hz.

If you're interested in frequencies up to 100Hz, you should resample at
least at 200Hz (see
https://en.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem).

??? HTH,

??? ??? B.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190822/8431934b/attachment.html

External Email - Use Caution

Hi Rodney,

there isn't a way around that, i.e., it is a theoretical limitation, (I dont know exactly your background, and apologize in advance in case you already know this, but:) you cannot represent frequency components wit a frequency > Fs/2, where Fs is your sampling frequency. In your case, you cannot analysis parts of the signal beyond 50Hz if you sample at 100
I do not know exactly what is the frequency of those fast variation, but I'd think that these are above 50ish Hz.
Hope that helps,
Sebasti?n

Sebastian Casta?o-Candamil
Doctorate student
Brain state decoding lab
University of Freiburg
E // sebastian.castano at blbt.uni-freiburg.de (mailto:sebastian.castano at blbt.uni-freiburg.de)