Skip to content

Fix kwarg handling in legacy .plot_psd() method#11778

Merged
drammock merged 5 commits intomne-tools:mainfrom
drammock:plot-psd-axes
Jul 11, 2023
Merged

Fix kwarg handling in legacy .plot_psd() method#11778
drammock merged 5 commits intomne-tools:mainfrom
drammock:plot-psd-axes

Conversation

@drammock
Copy link
Copy Markdown
Member

@drammock drammock commented Jul 5, 2023

closes #11772

new behavior is

  • any kwargs passed to legacy raw.plot_psd() that are not recognized params of that method but happen to be params of Spectrum.plot() now raise a warning.
  • those kwargs will be respected though, instead of overwritten with the fallback values drawn from the defaults of plot_raw_psd().

@larsoner @mscheltienne LMK if you think this is a good approach... normally unrecognized kwargs will raise a TypeError (and we could do that here) but my feeling was that since this is a legacy method whose kwargs are getting split up and translated to be passed into a chain of two new methods, it might be nice/smart/OK to be more forgiving.

Once we agree on an implementation I can add test/changelog

@drammock drammock changed the title Plot psd axes Fix kwarg handling in legacy .plot_psd() method Jul 5, 2023
@larsoner
Copy link
Copy Markdown
Member

larsoner commented Jul 5, 2023

normally unrecognized kwargs will raise a TypeError (and we could do that here) but my feeling was that since this is a legacy method whose kwargs are getting split up and translated to be passed into a chain of two new methods, it might be nice/smart/OK to be more forgiving.

Okay by me / no strong feeling either way 👍

@mscheltienne
Copy link
Copy Markdown
Member

As long as the warning incite people to use the new API, sounds good to me!

@drammock drammock merged commit a3e98ce into mne-tools:main Jul 11, 2023
@drammock drammock deleted the plot-psd-axes branch July 11, 2023 21:16
snwnde pushed a commit to snwnde/mne-python that referenced this pull request Mar 20, 2024
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.

BUG: raw.plot_psd(ax=ax) does not plot into ax

4 participants