Working with ECoG from an EDF file

Hello all,

I’m trying to plot data from an EDF file for ECoG using the tutorial here: Working with ECoG data — MNE 1.6.1 documentation

I’m hoping to use the default MNE brain / MRI, and just plot my data on it as a first step.

I get an error at this command: print(montage.get_positions())

Here’s the message:

File ~/Desktop/ECOG edit.py:97
print(montage.get_positions())

AttributeError: ‘NoneType’ object has no attribute ‘get_positions’

I also get an error at the next command for fiducials: montage.add_mni_fiducials(subjects_dir)

Error as follows:

AttributeError: ‘NoneType’ object has no attribute ‘add_mni_fiducials’

If I take out these two lines, I can run the full code but obviously it shows a blank brain.

  • MNE version: 1.6
  • operating system: macoS 10.15

Your dataset doesn’t seem to have a montage included (EDF does not store channel location information). The example data comes as BIDS, which contains all kinds of metadata, including channel locations. Therefore, if you want to replicate the tutorial with your own data, you need to provide channel locations manually (maybe this is stored in a different file?).

See also Locating intracranial electrode contacts — MNE-GUI-Addons 0.2.0.dev15+g7e90930 documentation

1 Like

Thank you both for your input. It makes sense as you said that the channel locations are not defined. How can I define them manually?

This depends on the data you have. If the electrode locations are available, you can read them with mne.channels.read_custom_montage(). If the format is not supported, you can create a custom montage with mne.channels.make_dig_montage(). If you don’t have any channel location information, you will need to locate them manually using MR images (see the tutorial linked by @alexrockhill).

Once you have a montage, you can assign it to the data using raw.set_montage(montage).