Skip to content

Conversation

hoechenberger
Copy link
Member

Fixes #10533

This is a first quick draft, I'm looking for feedback.

cc @agramfort

@hoechenberger hoechenberger marked this pull request as ready for review April 17, 2022 08:43
@hoechenberger
Copy link
Member Author

This is ready for review.

@agramfort
Copy link
Member

agramfort commented Apr 17, 2022 via email

@hoechenberger hoechenberger changed the title Add convenience function to "prepare" emptyroom raw file for maxwell_filter MRG: Add convenience function to "prepare" emptyroom raw file for maxwell_filter Apr 17, 2022
@hoechenberger
Copy link
Member Author

Qt test failure is unrelated. This is good to merge from my end.

@hoechenberger
Copy link
Member Author

hoechenberger commented Apr 19, 2022

I just added parameters to allow the user to decide whether or not to copy over meas_date and annotations, even though a single param (just allowing for a transfer of annots, which would implicitly alter the meas_date) might be sufficient?

I wasn't sure what to do about _cropped_samp – do we only need to adjust it if we change meas_date?

Tests are still missing.

WDYT?

@larsoner
Copy link
Member

I wasn't sure what to do about _cropped_samp – do we only need to adjust it if we change meas_date?

Changing this changes raw.first_samp.

You need this to match 1) if you're doing movement compensation, or 2) if you're going to raw_er.set_annotations(...) afterward with annotations that match raw's timing (e.g., from annotate_movement).

If you want to raw_er.set_annotations with annotations that match raw_er's original timing, you need the meas_date and first_samp not to change.

@hoechenberger
Copy link
Member Author

You need this to match 1) if you're doing movement compensation, or 2) if you're going to raw_er.set_annotations(...) afterward with annotations that match raw's timing (e.g., from annotate_movement).

If you want to raw_er.set_annotations with annotations that match raw_er's original timing, you need the meas_date and first_samp not to change.

So this is a problem with my current proposal, then?

Because we couldn't allow for keeping the ER annotations and ensuring movement compensation would work as expected at the same time? 🤔

@larsoner
Copy link
Member

Because we couldn't allow for keeping the ER annotations and ensuring movement compensation would work as expected at the same time?

I think we can. For example if there are known really bad sections of ER data you don't want to keep them (e.g., for cov calc), using annotations='union' (new option) could make sense in this case. This is what I would use if I had such data, and I think it's a sensible default -- it creates some mismatch between which head positions (and regularization/virtual sensor processing) effectively get captured by compute_covariance down the line, but should be a less bad choice than including a segment of very bad empty room data, or than excluding usable segments of raw data. It's all about tradeoffs at this point (just like picking info['bads'] versus setting segments BAD_ using annotations!) so I think we need to give people options here.

@hoechenberger
Copy link
Member Author

@larsoner Could you please take a look at my latest commit 971a519?
My idea was to allow for a transfer of annotations without forcing the measurement date to be adjusted.

Some tests are failing and I don't have the time to look into this right now, but I wanted to ask what you think about this approach in general?

@hoechenberger
Copy link
Member Author

hoechenberger commented Apr 20, 2022

Note to self (I don't want to push changes while @larsoner is potentially working on something):

  • Remove the ability to pass a list of bads. If a user wants to have a specific list of bads, they can set them before calling this function, and then pass bads='keep'. This keeps this function smaller and requires less testing

@larsoner
Copy link
Member

Feel free to push, I don't have any in-progress changes currently

hoechenberger and others added 5 commits April 21, 2022 11:53
…10533

* upstream/main:
  MAINT: Extra test for coreg (mne-tools#10549)
  BUG: Fix annot meas_date / crop (mne-tools#10491)
  Update latest.inc
…10533

* upstream/main:
  MAINT: Respect activation (mne-tools#10546)
  [ENH, MRG] Add Automatic Muscle Artifact ICA Component Detection  (mne-tools#10534)
@larsoner
Copy link
Member

@hoechenberger I simplified the logic a bit, split the test for speed purposes, and added a new param. Can you look and see what you think?

@hoechenberger
Copy link
Member Author

Will do! We can talk tomorrow during the dev meeting

@larsoner
Copy link
Member

We can talk tomorrow during the dev meeting

From my end this is feature complete and ready to go, hopefully you agree and can just merge. But yes if you think there is something wrong or more to change then we can discuss

Copy link
Member Author

@hoechenberger hoechenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hoechenberger hoechenberger merged commit b6ce4f8 into mne-tools:main Apr 21, 2022
@hoechenberger
Copy link
Member Author

Thanks @larsoner!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add convenient function to "prepare" emptyroom raw file for maxwell_filter

3 participants