Skip to content

Converting channel types on the fly? #1909

Closed

Description

@choldgraf

I'm reading in an EDF file where the analog channels are labeled as EEG. I'm trying to figure out how to set these to misc, but haven't found an easy way to do this. I've learned that it's usually not a good idea to directly change fields in the "info" attribute, so I wonder if there's a good way to do this that I'm not thinking of?

Activity

  1. dengemann commented on Mar 29, 2015

    @dengemann
    Member

    @choldgraf take a look at mne.rename_channels. Maybe it can do the job for you.

  2. choldgraf commented on Mar 29, 2015

    @choldgraf
    ContributorAuthor

    ah perfect. out of curiosity why can't you change the type to eeg?

  3. dengemann commented on Mar 29, 2015

    @dengemann
    Member

    why can't you change the type to eeg?

    Hum?

  4. choldgraf commented on Mar 29, 2015

    @choldgraf
    ContributorAuthor

    from the docstring (I also tried it and it returned an error)

    """Rename channels and optionally change the sensor type.
    Note: This only changes between the following sensor types: eeg, eog,
    emg, ecg, and misc. It also cannot change to eeg.
    Parameters
    ----------
    info : dict
    Measurement info.
    mapping : dict
    a dictionary mapping the old channel to a new channel name {'EEG061' :
    'EEG161'}. If changing the sensor type, make the new name a tuple with
    the name (str) and the new channel type (str)
    {'EEG061':('EOG061','eog')}.

  5. dengemann commented on Mar 29, 2015

    @dengemann
    Member
  6. agramfort commented on Mar 29, 2015

    @agramfort
    SponsorMember

    this is crazy. It should not be the case.

    alos eeg should be in human2fiff dict in function.

    PR more than welcome !!!

  7. teonbrooks commented on Mar 29, 2015

    @teonbrooks
    Member

    @choldgraf there's a parameter, misc in all the eeg readers when you first load the data.

  8. choldgraf commented on Mar 29, 2015

    @choldgraf
    ContributorAuthor

    Ah that's useful as well, thanks :)

    On Sun, Mar 29, 2015 at 7:50 AM, Teon [email protected] wrote:

    @choldgraf https://github.com/choldgraf there's a parameter, misc in
    all the eeg readers when you first load the data.

    —
    Reply to this email directly or view it on GitHub
    #1909 (comment)
    .

  9. dgwakeman commented on Mar 30, 2015

    @dgwakeman
    Contributor

    Yeah, that is a typo. It is meant to say MEG. I'll fix it later this week. Unless someone else wants to tackle this easy PR.

  10. agramfort commented on Mar 30, 2015

    @agramfort
    SponsorMember
  11. dgwakeman commented on Mar 30, 2015

    @dgwakeman
    Contributor

    I'm busy (and not paid to work on MNE). Also, I just realized it's not a typo. There is a good reason:
    To define an EEG sensor you need to adjust dig and define a new sensor. That is more complex. It should IMO go in a new function e.g. mne.channels.define_sensor

    This is a much bigger PR

  12. dengemann commented on Mar 30, 2015

    @dengemann
    Member

    mne.channels.define_sensor

    sounds like a useful API. We could then leave it to the user to provide as much of the information as needed. If nothing additional is provided we would just use defaults and change the sensor type.

  13. teonbrooks commented on Mar 31, 2015

    @teonbrooks
    Member

    wait, @dgwakeman why should dig be adjusted? dig is usually reserved for digitized head points and hpi points, not for sensors.

  14. larsoner commented on Mar 31, 2015

    @larsoner
    Member

    I think eeg channels end up in our info['dig'] when we do M/EEG recordings

  15. dgwakeman commented on Mar 31, 2015

    @dgwakeman
    Contributor

    @teonlamont: yes what @Eric89GXL said, plus you need to modify channels, which gets complex fast when you are really changing channel type. The channel type changes mentioned here are really more about name than type (the difference between eog, emg, ecg, and misc is not really important for anything except as a name: same units, attributes etc.). Hence, why I think changing the type should be a different API, this was just a weird exception due to hardware vendors.

    IMO, it is a mistake to incorporate SEEG in this function, as these should be done properly as sensor types, and should be added to dig etc. Perhaps, this discussion will spark some inspiration in people.

  16. choldgraf commented on Mar 31, 2015

    @choldgraf
    ContributorAuthor

    Do you think that you could implement the ability to rename channel types to "eeg" in C++, with pen and paper?

  17. agramfort commented on Mar 31, 2015

    @agramfort
    SponsorMember
  18. teonbrooks commented on Apr 6, 2015

    @teonbrooks
    Member

    there's now pr #1932 to tackle this issue. currently it doesn't deal eeg channels in the info['dig'].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions