diff --git a/doc/changes/devel/13107.newfeature.rst b/doc/changes/devel/13107.newfeature.rst new file mode 100644 index 00000000000..a19381fbdb2 --- /dev/null +++ b/doc/changes/devel/13107.newfeature.rst @@ -0,0 +1 @@ +The :meth:`mne.Info.save` method now has an ``overwrite`` and a ``verbose`` parameter, by `Stefan Appelhoff`_. diff --git a/mne/_fiff/meas_info.py b/mne/_fiff/meas_info.py index 51612824a6a..28f0629c323 100644 --- a/mne/_fiff/meas_info.py +++ b/mne/_fiff/meas_info.py @@ -1935,15 +1935,24 @@ def _repr_html_(self): info_template = _get_html_template("repr", "info.html.jinja") return info_template.render(info=self) - def save(self, fname): + @verbose + def save(self, fname, *, overwrite=False, verbose=None): """Write measurement info in fif file. Parameters ---------- fname : path-like The name of the file. Should end by ``'-info.fif'``. + %(overwrite)s + + .. versionadded:: 1.10 + %(verbose)s + + See Also + -------- + mne.io.write_info """ - write_info(fname, self) + write_info(fname, self, overwrite=overwrite) def _simplify_info(info, *, keep=()): diff --git a/mne/_fiff/tests/test_meas_info.py b/mne/_fiff/tests/test_meas_info.py index a38ecaade50..9c0639a830c 100644 --- a/mne/_fiff/tests/test_meas_info.py +++ b/mne/_fiff/tests/test_meas_info.py @@ -975,7 +975,7 @@ def test_field_round_trip(tmp_path): meas_date=_stamp_to_dt((1, 2)), ) fname = tmp_path / "temp-info.fif" - write_info(fname, info) + info.save(fname) info_read = read_info(fname) assert_object_equal(info, info_read) with pytest.raises(TypeError, match="datetime"):