Skip to content

Commit 9634536

Browse files
authored
Mark legacy (#11121)
* mark several funcs/methods as legacy * update comment * nicer info message
1 parent 9555588 commit 9634536

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

mne/time_frequency/spectrum.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ..utils import (GetEpochsMixin, _build_data_frame,
2222
_check_pandas_index_arguments, _check_pandas_installed,
2323
_check_sphere, _time_mask, _validate_type, fill_doc,
24-
logger, object_diff, verbose, warn)
24+
legacy, logger, object_diff, verbose, warn)
2525
from ..utils.check import (_check_fname, _check_option, _import_h5io_funcs,
2626
_is_numeric, check_fname)
2727
from ..utils.misc import _pl
@@ -40,6 +40,7 @@ def _identity_function(x):
4040
class SpectrumMixin():
4141
"""Mixin providing spectral plotting methods to sensor-space containers."""
4242

43+
@legacy(alt='.compute_psd().plot()')
4344
@verbose
4445
def plot_psd(self, fmin=0, fmax=np.inf, tmin=None, tmax=None, picks=None,
4546
proj=False, reject_by_annotation=True, *, method='auto',
@@ -116,6 +117,7 @@ def plot_psd(self, fmin=0, fmax=np.inf, tmin=None, tmax=None, picks=None,
116117
exclude=exclude, axes=ax, show=show)
117118
return fig
118119

120+
@legacy(alt='.compute_psd().plot_topo()')
119121
@verbose
120122
def plot_psd_topo(self, tmin=None, tmax=None, fmin=0, fmax=100, proj=False,
121123
*, method='auto', dB=True, layout=None, color='w',
@@ -157,6 +159,7 @@ def plot_psd_topo(self, tmin=None, tmax=None, fmin=0, fmax=100, proj=False,
157159
dB=dB, layout=layout, color=color, fig_facecolor=fig_facecolor,
158160
axis_facecolor=axis_facecolor, axes=axes, block=block, show=show)
159161

162+
@legacy(alt='.compute_psd().plot_topomap()')
160163
@verbose
161164
def plot_psd_topomap(self, bands=None, tmin=None, tmax=None, proj=False,
162165
method='auto', ch_type=None, *, normalize=False,

mne/utils/docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4168,7 +4168,7 @@ class _decorator:
41684168
def __init__(self, extra): # noqa: D102
41694169
self.kind = self.__class__.__name__
41704170
self.extra = extra
4171-
self.msg = f'{{}} is a {self.kind} {{}}. {self.extra}.'
4171+
self.msg = f'NOTE: {{}}() is a {self.kind} {{}}. {self.extra}.'
41724172

41734173
def __call__(self, obj): # noqa: D105
41744174
"""Call.

mne/viz/epochs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .raw import _setup_channel_selections
2121
from ..fixes import _sharex
2222
from ..defaults import _handle_default
23-
from ..utils import verbose, logger, warn, fill_doc, _check_option
23+
from ..utils import legacy, verbose, logger, warn, fill_doc, _check_option
2424
from ..io.meas_info import create_info, _validate_type
2525

2626
from ..io.pick import (_get_channel_types, _picks_to_idx, _DATA_CH_TYPES_SPLIT,
@@ -922,6 +922,7 @@ def plot_epochs(epochs, picks=None, scalings=None, n_epochs=20, n_channels=20,
922922
return fig
923923

924924

925+
@legacy(alt='Epochs.compute_psd().plot()')
925926
@verbose
926927
def plot_epochs_psd(epochs, fmin=0, fmax=np.inf, tmin=None, tmax=None,
927928
proj=False, bandwidth=None, adaptive=False, low_bias=True,

mne/viz/raw.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ..annotations import _annotations_starts_stops
1414
from ..filter import create_filter
1515
from ..io.pick import pick_types, pick_channels
16-
from ..utils import verbose, _validate_type, _check_option
16+
from ..utils import legacy, verbose, _validate_type, _check_option
1717
from ..defaults import _handle_default
1818
from .utils import (_compute_scalings, _handle_decim, _check_cov,
1919
_shorten_path_from_middle, _handle_precompute,
@@ -357,6 +357,7 @@ def plot_raw(raw, events=None, duration=10.0, start=0.0, n_channels=20,
357357
return fig
358358

359359

360+
@legacy(alt='Raw.compute_psd().plot()')
360361
@verbose
361362
def plot_raw_psd(raw, fmin=0, fmax=np.inf, tmin=None, tmax=None, proj=False,
362363
n_fft=None, n_overlap=0, reject_by_annotation=True,
@@ -426,6 +427,7 @@ def plot_raw_psd(raw, fmin=0, fmax=np.inf, tmin=None, tmax=None, proj=False,
426427
return fig
427428

428429

430+
@legacy(alt='Raw.compute_psd().plot_topo()')
429431
@verbose
430432
def plot_raw_psd_topo(raw, tmin=0., tmax=None, fmin=0., fmax=100., proj=False,
431433
*, n_fft=2048, n_overlap=0, dB=True, layout=None,

mne/viz/topomap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
_MEG_CH_TYPES_SPLIT)
2929
from ..utils import (_clean_names, _time_mask, verbose, logger, fill_doc,
3030
_validate_type, _check_sphere, _check_option, _is_numeric,
31-
warn)
31+
warn, legacy)
3232
from .utils import (tight_layout, _setup_vmin_vmax, _prepare_trellis,
3333
_check_delayed_ssp, _draw_proj_checkbox, figure_nobar,
3434
plt_show, _process_times, DraggableColorbar, _get_cmap,
@@ -1940,6 +1940,7 @@ def _plot_topomap_multi_cbar(data, pos, ax, title=None, unit=None, vmin=None,
19401940
cbar.ax.tick_params(labelsize=8)
19411941

19421942

1943+
@legacy(alt='Epochs.compute_psd().plot_topomap()')
19431944
@verbose
19441945
def plot_epochs_psd_topomap(epochs, bands=None, tmin=None, tmax=None,
19451946
proj=False, *, bandwidth=None, adaptive=False,

mne/viz/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,7 @@ def _plot_psd(inst, fig, freqs, psd_list, picks_list, titles_list,
22122212
units_list, scalings_list, ax_list, make_label, color, area_mode,
22132213
area_alpha, dB, estimate, average, spatial_colors, xscale,
22142214
line_alpha, sphere, xlabels_list):
2215-
# helper function for plot_raw_psd and plot_epochs_psd
2215+
# helper function for Spectrum.plot()
22162216
from matplotlib.ticker import ScalarFormatter
22172217
from .evoked import _plot_lines
22182218
from ..stats import _ci

0 commit comments

Comments
 (0)