diff --git a/src/spikeinterface/core/baserecordingsnippets.py b/src/spikeinterface/core/baserecordingsnippets.py index ac2a58fced..50118c78d7 100644 --- a/src/spikeinterface/core/baserecordingsnippets.py +++ b/src/spikeinterface/core/baserecordingsnippets.py @@ -101,12 +101,12 @@ def set_probe(self, probe, group_mode="by_probe", in_place=False): assert isinstance(probe, Probe), "must give Probe" probegroup = ProbeGroup() probegroup.add_probe(probe) - return self.set_probes(probegroup, group_mode=group_mode, in_place=in_place) + return self._set_probes(probegroup, group_mode=group_mode, in_place=in_place) def set_probegroup(self, probegroup, group_mode="by_probe", in_place=False): - return self.set_probes(probegroup, group_mode=group_mode, in_place=in_place) + return self._set_probes(probegroup, group_mode=group_mode, in_place=in_place) - def set_probes(self, probe_or_probegroup, group_mode="by_probe", in_place=False): + def _set_probes(self, probe_or_probegroup, group_mode="by_probe", in_place=False): """ Attach a list of Probe objects to a recording. For this Probe.device_channel_indices is used to link contacts to recording channels. @@ -233,6 +233,21 @@ def set_probes(self, probe_or_probegroup, group_mode="by_probe", in_place=False) return sub_recording + def set_probes(self, probe_or_probegroup, group_mode="by_probe", in_place=False): + + warning_msg = ( + "`set_probes` is now a private function and the public function will be " + "removed in 0.103.0. Please use `set_probe` or `set_probegroups` instead" + ) + + warn(warning_msg, category=DeprecationWarning, stacklevel=2) + + sub_recording = self._set_probes( + probe_or_probegroup=probe_or_probegroup, group_mode=group_mode, in_place=in_place + ) + + return sub_recording + def get_probe(self): probes = self.get_probes() assert len(probes) == 1, "there are several probe use .get_probes() or get_probegroup()" @@ -329,7 +344,7 @@ def set_dummy_probe_from_locations(self, locations, shape="circle", shape_params def set_channel_locations(self, locations, channel_ids=None): if self.get_property("contact_vector") is not None: - raise ValueError("set_channel_locations(..) destroy the probe description, prefer set_probes(..)") + raise ValueError("set_channel_locations(..) destroys the probe description, prefer _set_probes(..)") self.set_property("location", locations, ids=channel_ids) def get_channel_locations(self, channel_ids=None, axes: str = "xy"): diff --git a/src/spikeinterface/extractors/neoextractors/spikegadgets.py b/src/spikeinterface/extractors/neoextractors/spikegadgets.py index 6ce2ebe792..f326c49cd1 100644 --- a/src/spikeinterface/extractors/neoextractors/spikegadgets.py +++ b/src/spikeinterface/extractors/neoextractors/spikegadgets.py @@ -44,7 +44,7 @@ def __init__(self, file_path, stream_id=None, stream_name=None, block_index=None probegroup = probeinterface.read_spikegadgets(file_path, raise_error=False) if probegroup is not None: - self.set_probes(probegroup, in_place=True) + self.set_probegroup(probegroup, in_place=True) @classmethod def map_to_neo_kwargs(cls, file_path):