Skip to content

ENH: make mne python for CTF data preprocessing more friendly #7077

Closed

Description

@AdoNunes

@NataKozh and I have been doing some data preprocessing with CTF data and we found that mne-python needs a few PR upgrades to integrate common preprocessing steps done when maxfilter is not used.

Namely:

  • Muscle artifacts detection detect_artifact_muscle
    Detect data segments with muscle artifacts by bandpassing the data between 110-140 Hz, taking the envelope, z-scoreing and low pass filtering to smooth it. Then annotate the segments above a given threshold. This was written by @bloyl and is very similar to how fieldtrip detects muscle artifacts.

  • Head movement detection and head position correction, detect_artifact_movement & correct_head_pos
    Detect segments where the head position is further away from a given threshold distance from the median head position during the recording. It iterates twice to find the median position during the segments with an acceptable head position. @bloyl was our source of inspiration and we are looking forward to his comments ;)

Another function that I would like to add:

  • Detect_bad_channels
    It depends on the threshold used and it is useful to highlight the channels that might be bad, rather than an automatic step that does not require data visualization and inspection. It z-scores the data to find channel outliers based on power and/or does local correlation to find channels that do not capture similar magnetic fields as it's neighbour peers.

I would like to add these functions and make an example tutorial. Let me know what do you think and if you have any suggestions. @jasmainak

If you want to have a look at the functions we have them on: https://github.com/AdoNunes/ASD_MNE_pipe/blob/master/MNEprepro.py

Activity

  1. agramfort commented on Nov 18, 2019

    @agramfort
    SponsorMember
  2. AdoNunes commented on Nov 18, 2019

    @AdoNunes
    ContributorAuthor

    What about the brainstorm auditory dataset? There are bad channels and maybe the subject moved at least a bit...

    I will call the find_outliers func from bads.

  3. jasmainak commented on Nov 18, 2019

    @jasmainak
    Member

    what about making a separate repository for these issues as we did with pyprep in #7049?

  4. agramfort commented on Nov 18, 2019

    @agramfort
    SponsorMember
  5. AdoNunes commented on Nov 21, 2019

    @AdoNunes
    ContributorAuthor

    I think that at least the muscle artifact and movement annotation would be good to have it in MNE.

    I have added a script example and the functions script on gist: https://gist.github.com/AdoNunes/b8edec72916543acdde716b6b23e926f

    After computing the head position the head pos time series can be plotted (the horizontal line is the threshold, each line is the distance of one of the three cHPI to the median head position):
    image

    In this case, the participant moved slightly only during the brake

    After computing muscle artifacts, the z-scores can be plotted:
    image

    and the annotations inspected:
    image

  6. agramfort commented on Nov 21, 2019

    @agramfort
    SponsorMember
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