[Mne_analysis] How to filter harmonics?

Megan Schendel mschendel at mrn.org
Wed Mar 23 13:52:02 EDT 2016
Search archives:

Okay.  I see: the above replaces raw with the filtered data.

Thanks!
Megan

MEG Technician
The Mind Research Network
1101 Yale Blvd. NE
Albuquerque, New Mexico 87106
505-272-3304


On Wed, Mar 23, 2016 at 11:37 AM, Eric Larson <larson.eric.d at gmail.com>
wrote:

> raw.filter() operates inplace (and doesn't return anything, which is why
> you get None as a result), so your raw object is now filtered.
>
> You can use raw_2 = raw.copy(), raw_2.filter(...) if you don't want to
> modify your original raw instance.
>
> Eric
>
>
> On Wed, Mar 23, 2016 at 1:31 PM, Megan Schendel <mschendel at mrn.org> wrote:
>
>> Hi all,
>>      I've also been trying to figure out filtering, and getting a bit
>> stuck on what to do with the result of such.  If I follow along above and
>> then do something like:
>>
>> filtered_data = raw.notch_filter(freqs=harmonics[:-1]+noise_freq//2,
>> notch_widths=noise_freq - 2*width)
>>
>> I can't treat the result like a raw RawFIF, and if I ask python
>>
>> type(filtered_data)
>> NoneType
>>
>> So how does one use (say, plot) such a result?
>>
>> Thanks!
>> Megan
>>
>>
>>
>>
>> MEG Technician
>> The Mind Research Network
>> 1101 Yale Blvd. NE
>> Albuquerque, New Mexico 87106
>> 505-272-3304
>>
>>
>> On Wed, Mar 23, 2016 at 10:10 AM, JR KING <jeanremi.king at gmail.com>
>> wrote:
>>
>>> Thanks!
>>>
>>> For the record I did:
>>>
>>> noise_freq = 60.  # US line noise
>>> width = 2. # notch widh in Hz
>>>
>>> # harmonics until nquist
>>> n_harm = raw.info['sfreq'] // (2. * noise_freq) + 1
>>>
>>> # band pass first to last harmonics
>>> harmonics = noise_freq * np.arange(1, n_harm)
>>> raw.filter(noise_freq - width, harmonics[-1] + width)
>>>
>>> # band stop filter in between harmonics (it's not really a notch, since
>>> the freq width is very large)
>>> raw.notch_filter(freqs=harmonics[:-1]+noise_freq//2,
>>> notch_widths=noise_freq - 2*width)
>>>
>>> JR
>>>
>>> On 23 March 2016 at 10:13, dgw <dgwakeman at gmail.com> wrote:
>>>
>>>> Hi JR,
>>>>
>>>> what about:
>>>> bandpass: 55: 245, plus notch filters for the other gaps
>>>>
>>>> d
>>>>
>>>> On Wed, Mar 23, 2016 at 10:11 AM, JR KING <jeanremi.king at gmail.com>
>>>> wrote:
>>>> > Hi all,
>>>> >
>>>> > Is there a way in MNE to do the opposite of notch-filtering so as to
>>>> filter
>>>> > out everything but the line noise and its harmonics?
>>>> >
>>>> > I'm typically trying to filter the signals so as to only keep the 60,
>>>> 120,
>>>> > 180, 240 Hz frequency bands.
>>>> >
>>>> > Thanks!
>>>> >
>>>> > JR
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Mne_analysis mailing list
>>>> > Mne_analysis at nmr.mgh.harvard.edu
>>>> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>> >
>>>> >
>>>> > The information in this e-mail is intended only for the person to
>>>> whom it is
>>>> > addressed. If you believe this e-mail was sent to you in error and the
>>>> > e-mail
>>>> > contains patient information, please contact the Partners Compliance
>>>> > HelpLine at
>>>> > http://www.partners.org/complianceline . If the e-mail was sent to
>>>> you in
>>>> > error
>>>> > but does not contain patient information, please contact the sender
>>>> and
>>>> > properly
>>>> > dispose of the e-mail.
>>>> >
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>> The information in this e-mail is intended only for the person to whom
>>> it is
>>> addressed. If you believe this e-mail was sent to you in error and the
>>> e-mail
>>> contains patient information, please contact the Partners Compliance
>>> HelpLine at
>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>> in error
>>> but does not contain patient information, please contact the sender and
>>> properly
>>> dispose of the e-mail.
>>>
>>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> The information in this e-mail is intended only for the person to whom it
>> is
>> addressed. If you believe this e-mail was sent to you in error and the
>> e-mail
>> contains patient information, please contact the Partners Compliance
>> HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you
>> in error
>> but does not contain patient information, please contact the sender and
>> properly
>> dispose of the e-mail.
>>
>>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160323/e9eb642f/attachment.html 


More information about the Mne_analysis mailing list