Repository: mne-tools/mne-python

Issue:
MAINT: deprecate mne maxfilter command line tool
I'm actually inclined to deprecate this instead and remove it after 1.6. We have had `mne.preprocessing.maxwell_filter` for some time which should be more fully featured and it's what we want to support going forward. If people want to use the command-line `maxfilter` from MEGIN I think it's okay nowadays to have them do it from the command line directly -- `mne maxwell_filter` does not actually do much for people, so the workaround for deprecation is actually pretty straightforward -- use `maxfilter` directly with nearly identical args. The only extra thing it does is write out an `origin` and this can be done pretty easily with minimal MNE code already I think.

_Originally posted by @larsoner in https://github.com/mne-tools/mne-python/pull/11937#pullrequestreview-1603222289_
            

Discussion:

Patch:
diff --git a/doc/changes/devel.rst b/doc/changes/devel.rst
index 191e057a4..424f32a2a 100644
--- a/doc/changes/devel.rst
+++ b/doc/changes/devel.rst
@@ -41,4 +41,4 @@ Bugs
 
 API changes
 ~~~~~~~~~~~
-- None yet
+- ``mne.preprocessing.apply_maxfilter`` and ``mne maxfilter`` have been deprecated and will be removed in 1.7. Use :func:`mne.preprocessing.maxwell_filter` (see :ref:`this tutorial <tut-artifact-sss>`) in Python or the command-line utility from MEGIN ``maxfilter`` and :func:`mne.bem.fit_sphere_to_headshape` instead (:gh:`11938` by `Eric Larson`_)
diff --git a/mne/preprocessing/maxfilter.py b/mne/preprocessing/maxfilter.py
index 034fcaa1d..a1de20920 100644
--- a/mne/preprocessing/maxfilter.py
+++ b/mne/preprocessing/maxfilter.py
@@ -8,7 +8,7 @@ import os
 
 from ..bem import fit_sphere_to_headshape
 from ..io import read_raw_fif
-from ..utils import logger, verbose, warn
+from ..utils import logger, verbose, warn, deprecated
 
 
 def _mxwarn(msg):
@@ -19,6 +19,11 @@ def _mxwarn(msg):
     )
 
 
+@deprecated(
+    "apply_maxfilter will be removed in 1.7, use mne.preprocessing.maxwell_filter or "
+    "the MEGIN command-line utility maxfilter and mne.bem.fit_sphere_to_headshape "
+    "instead."
+)
 @verbose
 def apply_maxfilter(
     in_fname,


Test patch:
diff --git a/mne/tests/test_docstring_parameters.py b/mne/tests/test_docstring_parameters.py
index 4745ee4ab..d18d9672c 100644
--- a/mne/tests/test_docstring_parameters.py
+++ b/mne/tests/test_docstring_parameters.py
@@ -242,7 +242,6 @@ TransformerMixin
 UpdateChannelsMixin
 activate_proj
 adjust_axes
-apply_maxfilter
 apply_trans
 channel_type
 combine_kit_markers