Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra keyword arguments to find_bad_channels_maxwell, notch_filter, and filter_data; bugfix compute_rank channel types #1061

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

harrisonritz
Copy link
Contributor

@harrisonritz harrisonritz commented Feb 26, 2025

Sorry there are so many commits, I had copied this branch from the branch I did the other PR on (lessons learned).

  • new config options that let you provide a dictionary of keyword argument to find_bad_channels_maxwell, notch_filter, and filter_data.
  • now allow for notch_filter to have a frequency of None, since this is allow for method="spectrum_fit"
  • bugfix for compute_rank that allows for mag sensors, rather than meg sensors (sorry this is tangential). This was breaking for OPM, which only has mag.
  • new test for custom keyword arguments

I haven't added any checking for whether these keyword arguments overlap with existing arguments, because the MNE functions already will throw an error if you try to give them multiple values.

Before merging …

  • Changelog has been updated (docs/source/dev.md.inc)

Copy link
Member

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

Great work, I left a few comments

Copy link
Member

@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 but I haven't actually looked at the test cases

@@ -0,0 +1,40 @@
"""MNE Sample Data: M/EEG combined processing."""
Copy link
Member

Choose a reason for hiding this comment

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

A couple of things here:

  1. ds000248 is not our fastest dataset to run tests for. For this and other similar extensions, it's best if possible to change some existing config if possible. If not possible (which should be fairly rare), then we should add one that executes as quickly as possible.

  2. In the future, when we do want to add a new test config (since I don't think we need to here), changes need to be made to .circleci/config.yml to get it to actually run. You can see that the new config here wasn't run:

    image

With this in mind, I think in a previous PR you also added another config, is there a dataset that runs quicker that you could add a config for instead of ds000248? You can see the timings here

https://app.circleci.com/pipelines/github/mne-tools/mne-bids-pipeline/4974/workflows/c3e97eed-cc21-4945-b826-c6650ad8f9b8

and you can cross-ref with the ones listed as being MEG but not using maxfilter here:

https://mne.tools/mne-bids-pipeline/stable/examples/examples.html#demonstrated-features

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is super helpful, thanks. makes sense the that goal is coverage not isolating issues. revising this now, but running into weird issues in my local install (below).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put the tests on ds004229

@harrisonritz
Copy link
Contributor Author

@larsoner when I run my tests locally, this line doesn't work:

bids_path = BIDSPath(
subject=subject,
session=session,
suffix="meg",
datatype="meg",
root=config.bids_root,
).match()

For ds004229, the path I get is: ~/mne_data/ds004229/sub-102/meg/sub-102_meg, which doesn't match anything.
The correct path is ~/mne_data/ds004229/sub-102/meg/sub-102_acq-crosstalk_meg.fif.

The older method works fine:

BIDSPath(subject=subject,
            session=session,
            suffix="meg",
            datatype="meg",
            root=config.bids_root,
        ).meg_calibration_fpath

But -- this should mean that more of the tests should be failing, because the default for failing to find this path is to raise an error.
So I must have something weird about my install, eh? I should have the latest mne_bids (0.17.0.dev28+g7b046947e).

@harrisonritz
Copy link
Contributor Author

It must just be something funny in my install; I'll reinstall my environment. Maybe worth having an environment/requirement spec.

- move tests from `ds000248_extra_kws` and `ds000248_mf` to `ds000248`
- remove `ds000248_extra_kws` and `ds000248_mf`
@hoechenberger
Copy link
Member

Maybe worth having an environment/requirement spec.

Once we switch to uv, we will provide a lock file.

@harrisonritz
Copy link
Contributor Author

uv looks cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants