Skip to content

More deprecation updates for version 0.103.0 #4033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions src/spikeinterface/benchmark/benchmark_plot_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,55 +374,6 @@ def plot_agreement_matrix(study, ordered=True, case_keys=None, axs=None):
return fig


def plot_performances(study, mode="ordered", performance_names=("accuracy", "precision", "recall"), case_keys=None):
"""
Plot performances over case for a study.

Parameters
----------
study : BenchmarkStudy
A study object.
mode : "ordered" | "snr" | "swarm", default: "ordered"
Which plot mode to use:

* "ordered": plot performance metrics vs unit indices ordered by decreasing accuracy
* "snr": plot performance metrics vs snr
* "swarm": plot performance metrics as a swarm plot (see seaborn.swarmplot for details)
performance_names : list or tuple, default: ("accuracy", "precision", "recall")
Which performances to plot ("accuracy", "precision", "recall")
case_keys : list or None
A selection of cases to plot, if None, then all.

Returns
-------
fig : matplotlib.figure.Figure
The resulting figure containing the plots
"""
if mode == "snr":
warnings.warn(
"Use study.plot_performances_vs_snr() instead",
DeprecationWarning,
stacklevel=2,
)
return plot_performances_vs_snr(study, case_keys=case_keys, performance_names=performance_names)
elif mode == "ordered":
warnings.warn(
"Use study.plot_performances_ordered() instead",
DeprecationWarning,
stacklevel=2,
)
return plot_performances_ordered(study, case_keys=case_keys, performance_names=performance_names)
elif mode == "swarm":
warnings.warn(
"Use study.plot_performances_swarm() instead",
DeprecationWarning,
stacklevel=2,
)
return plot_performances_swarm(study, case_keys=case_keys, performance_names=performance_names)
else:
raise ValueError("plot_performances() : wrong mode ")


def plot_performances_vs_snr(
study,
case_keys=None,
Expand Down
57 changes: 0 additions & 57 deletions src/spikeinterface/comparison/multicomparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,63 +190,6 @@ def get_agreement_sorting(self, minimum_agreement_count=1, minimum_agreement_cou
)
return sorting

def save_to_folder(self, save_folder):
warnings.warn(
"save_to_folder() is deprecated. "
"You should save and load the multi sorting comparison object using pickle."
"\n>>> pickle.dump(mcmp, open('mcmp.pkl', 'wb'))\n>>> mcmp_loaded = pickle.load(open('mcmp.pkl', 'rb'))",
DeprecationWarning,
stacklevel=2,
)
for sorting in self.object_list:
assert sorting.check_serializability(
"json"
), "MultiSortingComparison.save_to_folder() needs json serializable sortings"

save_folder = Path(save_folder)
save_folder.mkdir(parents=True, exist_ok=True)
filename = str(save_folder / "multicomparison.gpickle")
with open(filename, "wb") as f:
pickle.dump(self.graph, f, pickle.HIGHEST_PROTOCOL)
kwargs = {
"delta_time": float(self.delta_time),
"match_score": float(self.match_score),
"chance_score": float(self.chance_score),
}
with (save_folder / "kwargs.json").open("w") as f:
json.dump(kwargs, f)
sortings = {}
for name, sorting in zip(self.name_list, self.object_list):
sortings[name] = sorting.to_dict(recursive=True, relative_to=save_folder)
with (save_folder / "sortings.json").open("w") as f:
json.dump(sortings, f)

@staticmethod
def load_from_folder(folder_path):
warnings.warn(
"load_from_folder() is deprecated. "
"You should save and load the multi sorting comparison object using pickle."
"\n>>> pickle.dump(mcmp, open('mcmp.pkl', 'wb'))\n>>> mcmp_loaded = pickle.load(open('mcmp.pkl', 'rb'))",
DeprecationWarning,
stacklevel=2,
)
folder_path = Path(folder_path)
with (folder_path / "kwargs.json").open() as f:
kwargs = json.load(f)
with (folder_path / "sortings.json").open() as f:
dict_sortings = json.load(f)
name_list = list(dict_sortings.keys())
sorting_list = [load(v, base_folder=folder_path) for v in dict_sortings.values()]
mcmp = MultiSortingComparison(sorting_list=sorting_list, name_list=list(name_list), do_matching=False, **kwargs)
filename = str(folder_path / "multicomparison.gpickle")
with open(filename, "rb") as f:
mcmp.graph = pickle.load(f)
# do step 3 and 4
mcmp._clean_graph()
mcmp._do_agreement()
mcmp._populate_spiketrains()
return mcmp


class AgreementSortingExtractor(BaseSorting):
def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ def test_compare_multiple_sorters(setup_module):
agreement_2 = msc.get_agreement_sorting(minimum_agreement_count=2, minimum_agreement_count_only=True)
assert np.all([agreement_2.get_unit_property(u, "agreement_number")] == 2 for u in agreement_2.get_unit_ids())

msc.save_to_folder(multicomparison_folder)

msc = MultiSortingComparison.load_from_folder(multicomparison_folder)


def test_compare_multi_segment():
num_segments = 3
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/core/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def load(

def load_extractor(file_or_folder_or_dict, base_folder=None) -> "BaseExtractor":
warnings.warn(
"load_extractor() is deprecated and will be removed in the future. Please use load() instead.",
"load_extractor() is deprecated and will be removed in version 0.104.0. Please use load() instead.",
DeprecationWarning,
stacklevel=2,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# extract_waveforms() and WaveformExtractor() have been replaced by the `SortingAnalyzer` since version 0.101.0.
# You should use `spikeinterface.create_sorting_analyzer()` instead.
# `spikeinterface.extract_waveforms()` is now mocking the old behavior for backwards compatibility only,
# and will be removed with version 0.103.0
# and may potentially be removed in a future version.
####"""


Expand Down
3 changes: 2 additions & 1 deletion src/spikeinterface/curation/auto_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,9 @@ def get_potential_auto_merge(
done by Aurelien Wyngaard and Victor Llobet.
https://github.com/BarbourLab/lussac/blob/v1.0.0/postprocessing/merge_units.py
"""
# deprecation moved to 0.105.0 for @zm711
warnings.warn(
"get_potential_auto_merge() is deprecated. Use compute_merge_unit_groups() instead",
"get_potential_auto_merge() is deprecated and will be removed in version 0.105.0. Use compute_merge_unit_groups() instead",
DeprecationWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/extractors/cbin_ibl.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(
raise ImportError(self.installation_mesg)
if cbin_file is not None:
warnings.warn(
"The `cbin_file` argument is deprecated, please use `cbin_file_path` instead",
"The `cbin_file` argument is deprecated and will be removed in version 0.104.0, please use `cbin_file_path` instead",
DeprecationWarning,
stacklevel=2,
)
Expand Down
7 changes: 4 additions & 3 deletions src/spikeinterface/extractors/neoextractors/openephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ def __init__(
ignore_timestamps_errors: bool = None,
):
if ignore_timestamps_errors is not None:
dep_msg = "OpenEphysLegacyRecordingExtractor: `ignore_timestamps_errors` is deprecated. It will be removed in version 0.104.0 and is currently ignored"
warnings.warn(
"OpenEphysLegacyRecordingExtractor: ignore_timestamps_errors is deprecated and is ignored",
dep_msg,
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -161,8 +162,8 @@ def __init__(

if load_sync_channel:
warning_message = (
"OpenEphysBinaryRecordingExtractor: load_sync_channel is deprecated and will"
"be removed in version 0.104, use the stream_name or stream_id to load the sync stream if needed"
"OpenEphysBinaryRecordingExtractor: `load_sync_channel` is deprecated and will"
"be removed in version 0.104, use the `stream_name` or `stream_id` to load the sync stream if needed"
)
warnings.warn(warning_message, DeprecationWarning, stacklevel=2)

Expand Down
15 changes: 0 additions & 15 deletions src/spikeinterface/extractors/nwbextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ class NwbRecordingExtractor(BaseRecording, _BaseNWBExtractor):
file_path : str, Path, or None
Path to the NWB file or an s3 URL. Use this parameter to specify the file location
if not using the `file` parameter.
electrical_series_name : str or None, default: None
Deprecated, use `electrical_series_path` instead.
electrical_series_path : str or None, default: None
The name of the ElectricalSeries object within the NWB file. This parameter is crucial
when the NWB file contains multiple ElectricalSeries objects. It helps in identifying
Expand Down Expand Up @@ -511,7 +509,6 @@ class NwbRecordingExtractor(BaseRecording, _BaseNWBExtractor):
def __init__(
self,
file_path: str | Path | None = None, # provide either this or file
electrical_series_name: str | None = None, # deprecated
load_time_vector: bool = False,
samples_for_rate_estimation: int = 1_000,
stream_mode: Optional[Literal["fsspec", "remfile", "zarr"]] = None,
Expand All @@ -530,18 +527,6 @@ def __init__(
if file_path is None and file is None:
raise ValueError("Provide either file_path or file")

if electrical_series_name is not None:
warning_msg = (
"The `electrical_series_name` parameter is deprecated and will be removed in version 0.101.0.\n"
"Use `electrical_series_path` instead."
)
if electrical_series_path is None:
warning_msg += f"\nSetting `electrical_series_path` to 'acquisition/{electrical_series_name}'."
electrical_series_path = f"acquisition/{electrical_series_name}"
else:
warning_msg += f"\nIgnoring `electrical_series_name` and using the provided `electrical_series_path`."
warnings.warn(warning_msg, DeprecationWarning, stacklevel=2)

self.file_path = file_path
self.stream_mode = stream_mode
self.stream_cache_path = stream_cache_path
Expand Down
18 changes: 0 additions & 18 deletions src/spikeinterface/extractors/tests/test_nwbextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,6 @@ def test_nwb_extractor_channel_ids_retrieval(generate_nwbfile, use_pynwb):
assert np.array_equal(extracted_channel_ids, expected_channel_ids)


@pytest.mark.parametrize("use_pynwb", [True, False])
def test_electrical_series_name_backcompatibility(generate_nwbfile, use_pynwb):
"""
Test that the channel_ids are retrieved from the electrodes table ONLY from the corresponding
region of the electrical series
"""
path_to_nwbfile, nwbfile_with_ecephys_content = generate_nwbfile
electrical_series_name_list = ["ElectricalSeries1", "ElectricalSeries2"]
for electrical_series_name in electrical_series_name_list:
with pytest.deprecated_call():
recording_extractor = NwbRecordingExtractor(
path_to_nwbfile,
electrical_series_name=electrical_series_name,
use_pynwb=use_pynwb,
)
assert recording_extractor.electrical_series_path == f"acquisition/{electrical_series_name}"


@pytest.mark.parametrize("use_pynwb", [True, False])
def test_nwb_extractor_property_retrieval(generate_nwbfile, use_pynwb):
"""
Expand Down
11 changes: 0 additions & 11 deletions src/spikeinterface/sorters/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ def run_sorter_by_property(
recording,
grouping_property,
folder,
mode_if_folder_exists=None,
engine="loop",
engine_kwargs=None,
verbose=False,
Expand All @@ -260,10 +259,6 @@ def run_sorter_by_property(
Property to split by before sorting
folder : str | Path
The working directory.
mode_if_folder_exists : bool or None, default: None
Must be None. This is deprecated.
If not None then a warning is raise.
Will be removed in next release.
engine : "loop" | "joblib" | "dask" | "slurm", default: "loop"
Which engine to use to run sorter.
engine_kwargs : dict
Expand Down Expand Up @@ -293,12 +288,6 @@ def run_sorter_by_property(
engine_kwargs={"n_jobs": 4})

"""
if mode_if_folder_exists is not None:
warnings.warn(
"run_sorter_by_property(): mode_if_folder_exists is not used anymore and will be removed in 0.102.0",
DeprecationWarning,
stacklevel=2,
)

working_folder = Path(folder).absolute()

Expand Down
45 changes: 0 additions & 45 deletions src/spikeinterface/sortingcomponents/peak_pipeline.py

This file was deleted.

Loading
Loading