Repository: mne-tools/mne-python

Issue:
Remove deprecations
It seems like some deprecated functions were not removed in 0.19, e.g. https://github.com/mne-tools/mne-python/blob/b3f46657fad1599262b6290b0c97a14d264ffc78/mne/io/edf/edf.py#L30-L32 and https://github.com/mne-tools/mne-python/blob/76ee63ff92b0424a304a12532d0cb53c0833a0ec/mne/simulation/evoked.py#L84-L86 Does anyone already have a script to automate this? Otherwise, I can remove these things manually.


Discussion:
We're removing them in 0.20 then.

too late to fix after the release.

Resolving patch:
diff --git a/mne/io/__init__.py b/mne/io/__init__.py
--- a/mne/io/__init__.py
+++ b/mne/io/__init__.py
@@ -35,7 +35,7 @@
 from .cnt import read_raw_cnt
 from .ctf import read_raw_ctf
 from .curry import read_raw_curry
-from .edf import read_raw_edf, read_raw_bdf, read_raw_gdf, find_edf_events
+from .edf import read_raw_edf, read_raw_bdf, read_raw_gdf
 from .egi import read_raw_egi
 from .kit import read_raw_kit, read_epochs_kit
 from .fiff import read_raw_fif
@@ -58,7 +58,7 @@
     _loc_to_coil_trans, _loc_to_eeg_loc, _merge_info, _stamp_to_dt,
     BaseRaw, Info, Projection, Raw, RawArray, RawFIF, add_reference_channels,
     anonymize_info, array, base, brainvision, bti, cnt, concatenate_raws,
-    constants, ctf, edf, eeglab, egi, fiff, fiff_open, find_edf_events, kit,
+    constants, ctf, edf, eeglab, egi, fiff, fiff_open, kit,
     make_eeg_average_ref_proj, nicolet, pick, read_epochs_eeglab,
     read_epochs_fieldtrip, read_epochs_kit, read_evoked_fieldtrip,
     read_fiducials, read_info, read_raw_artemis123, read_raw_bdf,
diff --git a/mne/io/edf/__init__.py b/mne/io/edf/__init__.py
--- a/mne/io/edf/__init__.py
+++ b/mne/io/edf/__init__.py
@@ -4,4 +4,4 @@
 #
 # License: BSD (3-clause)
 
-from .edf import read_raw_edf, read_raw_bdf, read_raw_gdf, find_edf_events
+from .edf import read_raw_edf, read_raw_bdf, read_raw_gdf
diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py
--- a/mne/io/edf/edf.py
+++ b/mne/io/edf/edf.py
@@ -23,52 +23,8 @@
 from ..meas_info import _empty_info, _unique_channel_names, DATE_NONE
 from ..constants import FIFF
 from ...filter import resample
-from ...utils import copy_function_doc_to_method_doc, deprecated, fill_doc
-from ...annotations import Annotations, events_from_annotations
-
-
-@deprecated('find_edf_events is deprecated in 0.18, and will be removed'
-            ' in 0.19. Please use `mne.events_from_annotations` instead')
-def find_edf_events(raw):
-    """Get original EDF events as read from the header.
-
-    For GDF, the values are returned in form
-    [n_events, pos, typ, chn, dur]
-    where:
-
-    ========  ===================================  =======
-    name      description                          type
-    ========  ===================================  =======
-    n_events  The number of all events             integer
-    pos       Beginning of the events in samples   array
-    typ       The event identifiers                array
-    chn       The associated channels (0 for all)  array
-    dur       The durations of the events          array
-    ========  ===================================  =======
-
-    For EDF+, the values are returned in form
-    n_events * [onset, dur, desc]
-    where:
-
-    ========  ===================================  =======
-    name      description                          type
-    ========  ===================================  =======
-    onset     Onset of the event in seconds        float
-    dur       Duration of the event in seconds     float
-    desc      Description of the event             str
-    ========  ===================================  =======
-
-    Parameters
-    ----------
-    raw : instance of RawEDF
-        The raw object for finding the events.
-
-    Returns
-    -------
-    events : ndarray
-        The events as they are in the file header.
-    """
-    return events_from_annotations(raw)
+from ...utils import fill_doc
+from ...annotations import Annotations
 
 
 @fill_doc
@@ -188,12 +144,6 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
                                   self._raw_extras[fi], self.info['chs'],
                                   self._filenames[fi])
 
-    @copy_function_doc_to_method_doc(find_edf_events)
-    @deprecated('find_edf_events is deprecated in 0.18, and will be removed'
-                ' in 0.19. Please use `mne.events_from_annotations` instead')
-    def find_edf_events(self):
-        return events_from_annotations(self)
-
 
 @fill_doc
 class RawGDF(BaseRaw):
@@ -268,12 +218,6 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
                                   self._raw_extras[fi], self.info['chs'],
                                   self._filenames[fi])
 
-    @copy_function_doc_to_method_doc(find_edf_events)
-    @deprecated('find_edf_events is deprecated in 0.18, and will be removed'
-                ' in 0.19. Please use `mne.events_from_annotations` instead')
-    def find_edf_events(self):
-        return events_from_annotations(self)
-
 
 def _read_ch(fid, subtype, samp, dtype_byte, dtype=None):
     """Read a number of samples for a single channel."""


Test patch:
diff --git a/mne/io/edf/tests/test_edf.py b/mne/io/edf/tests/test_edf.py
--- a/mne/io/edf/tests/test_edf.py
+++ b/mne/io/edf/tests/test_edf.py
@@ -26,7 +26,6 @@
 from mne.io.edf.edf import _get_edf_default_event_id
 from mne.io.edf.edf import _read_annotations_edf
 from mne.io.edf.edf import _read_ch
-from mne.io.edf.edf import find_edf_events
 from mne.io.pick import channel_indices_by_type
 from mne.annotations import events_from_annotations, read_annotations
 from mne.io.meas_info import _kind_dict as _KIND_DICT
@@ -210,16 +209,6 @@ def test_to_data_frame(fname):
     assert_array_equal(df.values[:, 0], raw._data[0] * 1e13)
 
 
-def test_find_edf_events_deprecation():
-    """Test find_edf_events deprecation."""
-    raw = read_raw_edf(edf_path)
-    with pytest.deprecated_call(match="find_edf_events"):
-        raw.find_edf_events()
-
-    with pytest.deprecated_call(match="find_edf_events"):
-        find_edf_events(raw)
-
-
 def test_read_raw_edf_stim_channel_input_parameters():
     """Test edf raw reader deprecation."""
     _MSG = "`read_raw_edf` is not supposed to trigger a deprecation warning"