[Mne_analysis] Assistance regarding montage

Dan McCloy dan at mccloy.info
Thu May 21 17:30:23 EDT 2020
Search archives:

        External Email - Use Caution        

Hi Paul,
Try adding:

import numpy as np
channel_coords = [np.array(x) for x in channel_coords]

This makes each entry in your channel coords list into a numpy array instead of a tuple.  That format is specified in the docstring make_dig_montage function, but apparently doesn't raise an error until you try to plot it.

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

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, May 21, 2020 1:47 PM, Paul Fishback <fishbacp at mail.gvsu.edu> wrote:

>         External Email - Use Caution
>
> Hello,
>
> I'm not sure whether this is the appropriate forum, but I think some of my MNE questions are a bit too specialized for stackoverflow.
>
> I have an EEG file I've read in and I wish to create and plot a montage, whose coordinates I've created manually. Everything works fine until the last line, where I try to plot the montage, and I'm not sure of the source of my problem:
>
> import mne as mn
> #channel coordinates expressed as list of points in R^3 with z=0.
> channel_coords=[(-.25,.7,0),(.25,.7,0),(-.27,.35,0),(.27,.35,0),(-.32,0,0),(.32,0,0),(-.3,-.35,0),(.3,-.35,0),(-.22,-.7,0),(.22,-.7,0),
>                 (-.6,.43,0),(.6,.43,0),(-.73,0,0),(.73,0,0),(-.6,-.43,0),(.6,-.43,0),
>                 (0,.32,0),(0,0,0),(0,-.32,0),(-.9,0,0),(.9,0,0),(-.5,0,0),(.5,0,0)]
> directory='/Users/fishbacp/Jupyter December 2019/Phase 1 EEG Data/11.edf'
> raw = mn.io.read_raw_edf(directory, preload=True)
> channels=raw.info["ch_names"]
> #I know which particular channels I wish to drop.
> bad_channels=['E', 'LIO', 'RIO', 'X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8', 'X9', 'X10', 'X11', 'O2%', 'HR', 'DC03', 'DC04', 'EEG Mark1', 'EEG Mark2', 'BP1', 'BP2','Events/Markers']
> raw_temp=raw.copy()
> raw_temp.drop_channels(bad_channels)
> channels=raw_temp.info["ch_names"]
> print(len(channels))
> print(len(channel_coords))
> ch={channels[i]:channel_coords[i] for i in range(len(channels))}
> montage=mn.channels.make_dig_montage(ch)
> mn.viz.plot_montage(montage)
>
> The last line of my error message reads AttributeError: 'tuple' object has no attribute 'copy'
>
> Thanks for any help spotting my error.
>
> Paul F.
> --
> Professor of Mathematics, Grand Valley State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200521/8eab83b8/attachment-0001.html 


More information about the Mne_analysis mailing list