Skip to content

Commit 64ed255

Browse files
sappelhofflarsoner
andauthored
add overwrite and verbose params to info.save (mne-tools#13107)
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
1 parent 8eaa521 commit 64ed255

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The :meth:`mne.Info.save` method now has an ``overwrite`` and a ``verbose`` parameter, by `Stefan Appelhoff`_.

mne/_fiff/meas_info.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,15 +1935,24 @@ def _repr_html_(self):
19351935
info_template = _get_html_template("repr", "info.html.jinja")
19361936
return info_template.render(info=self)
19371937

1938-
def save(self, fname):
1938+
@verbose
1939+
def save(self, fname, *, overwrite=False, verbose=None):
19391940
"""Write measurement info in fif file.
19401941
19411942
Parameters
19421943
----------
19431944
fname : path-like
19441945
The name of the file. Should end by ``'-info.fif'``.
1946+
%(overwrite)s
1947+
1948+
.. versionadded:: 1.10
1949+
%(verbose)s
1950+
1951+
See Also
1952+
--------
1953+
mne.io.write_info
19451954
"""
1946-
write_info(fname, self)
1955+
write_info(fname, self, overwrite=overwrite)
19471956

19481957

19491958
def _simplify_info(info, *, keep=()):

mne/_fiff/tests/test_meas_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ def test_field_round_trip(tmp_path):
975975
meas_date=_stamp_to_dt((1, 2)),
976976
)
977977
fname = tmp_path / "temp-info.fif"
978-
write_info(fname, info)
978+
info.save(fname)
979979
info_read = read_info(fname)
980980
assert_object_equal(info, info_read)
981981
with pytest.raises(TypeError, match="datetime"):

0 commit comments

Comments
 (0)