Skip to content

Bug in ctf readers #3071

Closed
Closed

Description

@jaeilepp

Ref mailing list.

Reading CTF data seems to have a bug in defining some of the coil types. I've isolated the issue to https://github.com/mne-tools/mne-python/blob/master/mne/io/ctf/info.py#L209.
For some reason some extra bits are added to the coil_type if 'grad_order_no' is non-zero. This causes the coil types to become something outrageous (our spm faces dataset has coil_types of 201609). This seems to happen with both, the c conversion tool and python. What is this grad_order_no?
cc @mshamalainen @Eric89GXL

Activity

  1. jaeilepp commented on Mar 25, 2016

    @jaeilepp
    ContributorAuthor

    And 201609 = 5001 | 3 << 16
    5001 is defined as FIFF.FIFFV_COIL_CTF_GRAD

  2. larsoner commented on Mar 25, 2016

    @larsoner
    Member

    I don't think this is a bug in Matti's code but in how we are using coil_type (wherever that is in the original report). See how it's handled in forward:

    https://github.com/mne-tools/mne-python/blob/master/mne/forward/_make_forward.py#L126

    Which led me to do the same thing a couple of days back in my PR:

    https://github.com/mne-tools/mne-python/blob/master/mne/viz/_3d.py#L472

    My assumption when I saw this code was that the higher order bits were being used to store some form of additional information. Hopefully @mshamalainen can share some insight but in the meantime we can probably work on fixing wherever coil_type is used instead of changing this (likely correct) behavior.

  3. jaeilepp commented on Mar 25, 2016

    @jaeilepp
    ContributorAuthor

    So this use of higher order bits is only for ctf data? Sounds like something very error prone to me. Any idea where the grad_order_no is used or what does it mean?

  4. larsoner commented on Mar 25, 2016

    @larsoner
    Member

    Looking a bit deeper into the CTF code (mne_ctf_comp.c), the higher order bits indicate the compensation grade. Other systems don't have compensation, so they effectively have/use these bits but they are naturally always zero. I haven't looked into grad_order_no, but it could be related to the compensation grade.

    There is possibly a CTF-related bug here in the sense that, when we apply compensation, we don't change these higher order bits -- it's possible we're supposed to do that, but I'm not sure.

  5. added this to the 0.13 milestone on May 11, 2016
  6. larsoner commented on May 11, 2016

    @larsoner
    Member

    @mshamalainen it looks like mne_process_raw with a non-zero --grad option does not modify the coil_type, but I suspect it should. Any ideas?

  7. larsoner commented on Jul 19, 2016

    @larsoner
    Member

    From a quick conversation with Matti, it looks like if we do write out data that has been compensated, we should set the higher order bits to the compensation grade.

  8. larsoner commented on Jul 19, 2016

    @larsoner
    Member

    @jaeilepp do you remember where you actually saw coil_type being mis-used due to the compensation grade being present?

  9. jaeilepp commented on Jul 20, 2016

    @jaeilepp
    ContributorAuthor

    No idea. I cannot find the mailing list post that had this issue. I think we can close this.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions