[Mne_analysis] MNE-Python -- RawArray Info Question

Sam Zorowitz szorowi1 at gmail.com
Fri Dec 26 10:20:23 EST 2014
Search archives:

Thank you both for the help!
-Sam

On Thu, Dec 25, 2014 at 11:48 AM, Mainak Jas <mainakjas at gmail.com> wrote:

> I think you forgot to transpose your matrix before supplying it to
> RawArray :)
>
> On Thu, Dec 25, 2014 at 10:12 PM, Alexandre Gramfort <
> alexandre.gramfort at telecom-paristech.fr> wrote:
>
>> hi Sam,
>>
>> > I am trying out some new preprocessing tricks recommended by some
>> > collaborators, which involves bandstop filtering my data to the
>> frequencies
>> > of electrical artifact (60, 120, 180 Hz, etc), and subtracting the
>> resulting
>> > time courses from the true data. (Their claim is that this preserves
>> > coherence.) To do so, I have been trying the RawArray function, but am
>> > having trouble passing it an Info instance. Even using the following
>> code
>> > produces the error reproduced below. This is surprising, as I'm only
>> > translating an instance of raw to a PANDAS dataframe, and then a Numpy
>> > array. Any advice?
>>
>> you don't need to have a pandas dataframe as you already have a numpy
>> array in raw._data
>>
>> so raw_mat is just raw._data
>>
>> also a recommendation is to never use numpy matrices but just arrays.
>>
>> HTH
>> Alex
>>
>> > raw = mne.io.Raw('some_data.fif', preload=True)
>> > raw_df = raw.as_data_frame()
>> > raw_mat = raw_df.as_matrix()
>> > new_raw = mne.io.RawArray(raw_mat, raw.info)
>> >
>> > ValueError                                Traceback (most recent call
>> last)
>> > <ipython-input-162-10b3fdc10c23> in <module>()
>> >       1 raw_mat = raw.as_data_frame()
>> >       2 raw_mat = raw_mat.as_matrix()
>> > ----> 3 new_raw = mne.io.RawArray(raw_mat, raw.info)
>> >
>> > /mne/io/array/array.pyc in __init__(self, data, info, verbose)
>> >
>> > /mne/utils.pyc in verbose(function, *args, **kwargs)
>> >     549         return ret
>> >     550     else:
>> > --> 551         ret = function(*args, **kwargs)
>> >     552         return ret
>> >     553
>> >
>> >
>> /usr/pubsw/packages/python/anaconda/lib/python2.7/site-packages/mne/io/array/array.pyc
>> > in __init__(self, data, info, verbose)
>> >      39
>> >      40         if len(data) != len(info['ch_names']):
>> > ---> 41             raise ValueError('len(data) does not match
>> > len(info["ch_names"])')
>> >      42         assert len(info['ch_names']) == info['nchan']
>> >      43
>> >
>> > ValueError: len(data) does not match len(info["ch_names"])
>> >
>> >
>> > Best,
>> > Sam Zorowitz
>> >
>> > Clinical Research Coordinator
>> > Department of Psychiatry: Neurosciences
>> > Division of Neurotherapeutics
>> > Massachusetts General Hospital
>> >
>> > _______________________________________________
>> > 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141226/59a8f1ed/attachment.html 


More information about the Mne_analysis mailing list