reading eeg part of eeg-fMRI data

Hi all,

I'm trying to read in some EEG data collected from an eeg-fMRI task and
having a couple of problems.

Firstly, we're acquiring data using Curry 8. I've converted the native .cdt
data into .cnt using their software, and it outputs a file_path.cnt and
file_path.cnt.dpa file together. Events are contained in the .cnt file
though as you can read this data into EEGlab without a problem and it
detects triggers.

I'm trying to read it into MNE and I get the following error:

File "/home/sammirc/mne-python/mne/io/cnt/cnt.py", line 231 in _get_cnt_info
fid.seet(event_offset)

IOError: [Errno 22] Invalid Argument

not sure what this means? Is it not detecting events in the data, so
getting an error? The events are definitely there as two other people also
checking this data have been able to read it into matlab.

I wondered if it could be because of the montage in use (easycap-M1) when
it could be inaccurate. I got the montage file (both .mnt and .xml) and
tried to create a montage ( mne.channels.read_montage ) but this also
doesnt work as neither format is supported...

Any help on this would be pretty great as we're trying to check data
quality of a new system.

Cheers,
Sammi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170829/a1811351/attachment-0001.html

Hi Sammi,

which version of MNE are you using? Looks like your code has a weird typo
that doesn't exist in the code base (
https://github.com/mne-tools/mne-python/blob/maint/0.14/mne/io/cnt/cnt.py#L231
).

Maybe updating the version will fix it.

-Jaakko

hey,

thanks for the reply. I'm using the dev, but I haven't pulled in a while.
I'll give this a go and see whats going on

Cheers,
Sammi

oops, sorry, that was actually a typo on my part (emailing from laptop,
code on a workstation). It's actually fid.seek, not seet... sorry about that

The problem is probably that the event_offset becomes negative, which means
that the number of channels or the event offset is not read correctly from
the header. The cnt reader of MNE-python uses specs defined here
http://paulbourke.net/dataformats/eeg/. I've also come across cnt files
that don't really conform to those. Can you share the file? I could take a
look at some point.

It's probably that the montage it's reading is wrong - there are some
different names in this eeg-fMRI setup (e.g. electrodes called CB1). That
said, wrote some code to convert the cdt file into .set in eeglab, then
read that into mne - I don't have any problems reading the data that way
now, so not sure what's going on

Is there any way of creating a montage given a set of coordinates? After a
fair amount of searching I cant seem to find a way of making any kind of
readable montage file that's useful. With electrode coordinates in a .txt
file, and reading with mne.channels.read_montage(), it gives a super
distorted layout (see pic)

It's probably that the montage it's reading is wrong - there are some
different names in this eeg-fMRI setup (e.g. electrodes called CB1). That
said, wrote some code to convert the cdt file into .set in eeglab, then
read that into mne - I don't have any problems reading the data that way
now, so not sure what's going on

The problem is probably that the event_offset becomes negative, which
means that the number of channels or the event offset is not read correctly
from the header. The cnt reader of MNE-python uses specs defined here
http://paulbourke.net/dataformats/eeg/. I've also come across cnt files
that don't really conform to those. Can you share the file? I could take a
look at some point.

oops, sorry, that was actually a typo on my part (emailing from laptop,
code on a workstation). It's actually fid.seek, not seet... sorry about that

hey,

thanks for the reply. I'm using the dev, but I haven't pulled in a
while. I'll give this a go and see whats going on

Cheers,
Sammi

Hi Sammi,

which version of MNE are you using? Looks like your code has a weird
typo that doesn't exist in the code base (
https://github.com/mne-tools/mne-python/blob/maint/0.14/mne
/io/cnt/cnt.py#L231).

Maybe updating the version will fix it.

-Jaakko

Hi all,

I'm trying to read in some EEG data collected from an eeg-fMRI task
and having a couple of problems.

Firstly, we're acquiring data using Curry 8. I've converted the
native .cdt data into .cnt using their software, and it outputs a
file_path.cnt and file_path.cnt.dpa file together. Events are contained in
the .cnt file though as you can read this data into EEGlab without a
problem and it detects triggers.

I'm trying to read it into MNE and I get the following error:

File "/home/sammirc/mne-python/mne/io/cnt/cnt.py", line 231 in
_get_cnt_info
fid.seet(event_offset)

IOError: [Errno 22] Invalid Argument

not sure what this means? Is it not detecting events in the data, so
getting an error? The events are definitely there as two other people also
checking this data have been able to read it into matlab.

I wondered if it could be because of the montage in use (easycap-M1)
when it could be inaccurate. I got the montage file (both .mnt and .xml)
and tried to create a montage ( mne.channels.read_montage ) but this also
doesnt work as neither format is supported...

Any help on this would be pretty great as we're trying to check data
quality of a new system.

Cheers,
Sammi

_______________________________________________
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.

_______________________________________________
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/20170829/f8504e52/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure_1.png
Type: image/png
Size: 71778 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170829/f8504e52/attachment-0001.png

you can make one directly using the constructor of the Montage class if you
have everything in numpy arrays

let me know if you need more guidance

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170829/090f47c0/attachment.html

here is an example:

import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

import mne
from mne.channels import Montage

fname = os.path.join(os.path.dirname(mne.__file__),
                     'channels/data/montages/10-5_EGI129.csd')

data = np.genfromtxt(fname, dtype='str', skip_header=2)
ch_names = data[:, 0].tolist()
pos = data[:, 4:7].astype(float)
selection = np.arange(len(pos))

montage = Montage(pos=pos, ch_names=ch_names, kind="10-5_EGI129",
                  selection=selection)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170829/8aac9b36/attachment-0001.html

Fix at https://github.com/mne-tools/mne-python/pull/4520.