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

add image_kwargs to report #859

Merged
merged 20 commits into from
Feb 29, 2024
Merged

Conversation

SophieHerbst
Copy link
Collaborator

Responds to issue #848

Now that mne has been updated, we can pass image_kwargs to report.add_epochs.
It works when I set the limits to the rejection limits in the config, but I cannot get it right when setting image_kwargs to None as per default.

 File "/home/sh254795/Documents/REPOS/mne-study-template/mne_bids_pipeline/_config_import.py", line 340, in _default_factory
    idx = allowlist.index(val)
ValueError: {'image_kwargs': None} is not in list

    assert val == typ(), (key, val)
AssertionError: ('report_add_epochs_kwargs', {'image_kwargs': None})

@SophieHerbst
Copy link
Collaborator Author

Not sure what to do about the tests. The doc consistency I don't understand and the ubuntu-latest seems to be using the latest stable mne where the changes in report.add_epochs are not yet included?
Also, there might be further changes necessary with the reworking you did on the ICA?

@SophieHerbst
Copy link
Collaborator Author

SophieHerbst commented Feb 28, 2024

Also, it turns out that in order to use the rejection criteria from my config, I had to deal with the different scaling between rejection and plotting commands:

# add image kwargs for report
report_add_epochs_image_kwargs = {
"grad": {"vmin": 0, "vmax": reject["grad"]*1e15},
"mag": {"vmin": 0, "vmax": reject["mag"]*1e15},
  }

@larsoner
Copy link
Member

For the consistency we should merge #863 first probably, it should fix things for you I think

We should maintain compat with latest MNE stable, so you'll need to inspect.getfullargspec(report.add_epochs) to determine whether or not to set image_kwargs I think

@SophieHerbst
Copy link
Collaborator Author

I think I need some help here

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

@SophieHerbst pushed a few commits to DRY (don't repeat yourself) the code a bit, and also test that the option works -- locally the report seems to reflect reject:

image

Can you look and make sure you're still happy?

@SophieHerbst
Copy link
Collaborator Author

Thank you @larsoner I ran it again on my data and I am very happy with it now.

@hoechenberger hoechenberger merged commit 4c73c2c into mne-tools:main Feb 29, 2024
52 checks passed
@hoechenberger
Copy link
Member

Thanks @SophieHerbst and @larsoner!!!

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.

None yet

3 participants