[Mne_analysis] problem with combine_evoked() function

Eric Larson larson.eric.d at gmail.com
Thu Feb 20 08:03:35 EST 2020
Search archives:

        External Email - Use Caution        

read_evokeds returns a list. So list_evokeds will be a list of a list of
evoked, rather than a list of evoked. Either do
list_evokeds.extend(evoked), or list_evokeds.append(evoked[0]) and you
should be good to go.

Eric


On Thu, Feb 20, 2020 at 8:01 AM nick menger <nickmenger at hotmail.com> wrote:

>         External Email - Use Caution
>
> Dear all,
>
> The combine_evoked() function seems to be not working in my code (using
> MNE 20.0 (dev) on Windows 10, Python 3.7.5). I tried reading in some saved
> evoked files for multiple participants with the following code:
>
> # Read in evoked EEG for all participants
> list_evokeds = list()                   # list to append evokeds to
> for subject in subject_list:            # looping through my directory with computed evokeds (subject_list corresponds to list of strings with subject codes)
>     fname = pathlib.Path(f"my_path{subject}-ave.fif")   # setting filename for each saved evoked file (where 'my_path' corresponds to a real path in my code obviously)
>     evoked = mne.read_evokeds(fname)    # reading the evoked file
>     list_evokeds.append(evoked)         # append it to a list
> combined_evoked = mne.combine_evoked(list_evokeds, weights='nave')   # Results in AttributeError: 'list' object has no attribute 'nave'
>
>
>
> The problem being the AttributeError that the list has no 'nave' attribute
> (same problem arises when setting 'weights' parameter to 'equal'. The
> problem traces back to the first line of the function's code:
>
> line 869, in combine_evoked
>
> naves = np.array([evk.nave for evk in all_evoked], float)
>
>
> Could anyone tell me whether computing the attribute this way is
> necessary, or how I should modify my input to the function, so it works? If
> further info is needed, please let me know!
>
> Thanks!
>
> Verzonden vanuit Outlook <http://aka.ms/weboutlook>
> _______________________________________________
> 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/20200220/c25ebcb1/attachment-0001.html 


More information about the Mne_analysis mailing list