Skip to content
Open
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
1 change: 0 additions & 1 deletion doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ Deprecated
:noindex:

.. autofunction:: apply_sortingview_curation
.. autofunction:: get_potential_auto_merge
.. autoclass:: CurationSorting
.. autoclass:: MergeUnitsSorting
.. autoclass:: SplitUnitSorting
Expand Down
14 changes: 0 additions & 14 deletions src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def get_traces(
end_frame: int | None = None,
channel_ids: list | np.ndarray | tuple | None = None,
order: Literal["C", "F"] | None = None,
return_scaled: bool | None = None,
return_in_uV: bool = False,
) -> np.ndarray:
"""Returns traces from recording.
Expand All @@ -253,10 +252,6 @@ def get_traces(
The channel ids. If None, all channels are used, default: None
order : "C" | "F" | None, default: None
The order of the traces ("C" | "F"). If None, traces are returned as they are
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
If True and the recording has scaling (gain_to_uV and offset_to_uV properties),
traces are scaled to uV
return_in_uV : bool, default: False
If True and the recording has scaling (gain_to_uV and offset_to_uV properties),
traces are scaled to uV
Expand All @@ -282,15 +277,6 @@ def get_traces(
assert order in ["C", "F"]
traces = np.asanyarray(traces, order=order)

# Handle deprecated return_scaled parameter
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled

if return_in_uV:
if not self.has_scaleable_traces():
if self._dtype.kind == "f":
Expand Down
28 changes: 0 additions & 28 deletions src/spikeinterface/core/basesnippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def get_snippets(
indices=None,
segment_index: int | None = None,
channel_ids: list | None = None,
return_scaled: bool | None = None,
return_in_uV: bool = False,
):
"""
Expand All @@ -107,10 +106,6 @@ def get_snippets(
The segment index to get snippets from. If snippets is multi-segment, it is required.
channel_ids : list | None, default: None
The channel ids. If None, all channels are used.
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
snippets are scaled to uV
return_in_uV : bool, default: False
If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
snippets are scaled to uV
Expand All @@ -125,15 +120,6 @@ def get_snippets(
channel_indices = self.ids_to_indices(channel_ids, prefer_slice=True)
wfs = spts.get_snippets(indices, channel_indices=channel_indices)

# Handle deprecated return_scaled parameter
if return_scaled is not None:
warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled

if return_in_uV:
if not self.has_scaleable_traces():
raise ValueError(
Expand All @@ -153,7 +139,6 @@ def get_snippets_from_frames(
start_frame: int | None = None,
end_frame: int | None = None,
channel_ids: list | None = None,
return_scaled: bool | None = None,
return_in_uV: bool = False,
):
"""
Expand All @@ -169,10 +154,6 @@ def get_snippets_from_frames(
The end frame. If None, the number of samples in the segment is used.
channel_ids : list | None, default: None
The channel ids. If None, all channels are used.
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
snippets are scaled to uV
return_in_uV : bool, default: False
If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
snippets are scaled to uV
Expand All @@ -186,15 +167,6 @@ def get_snippets_from_frames(
spts = self._snippets_segments[segment_index]
indices = spts.frames_to_indices(start_frame, end_frame)

# Handle deprecated return_scaled parameter
if return_scaled is not None:
warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled

return self.get_snippets(indices, channel_ids=channel_ids, return_in_uV=return_in_uV)

def select_channels(self, channel_ids: list | np.ndarray | tuple) -> "BaseSnippets":
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/core/basesorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def to_spike_vector(
warnings.warn(
"Sorting.to_spike_vector() with extremum_channel_inds is deprecated. "
"Use main_channel_indices instead"
"This will be removed in 0.016.0"
"This will be removed in 0.106.0"
)
main_channel_indices = np.array([extremum_channel_inds[unit_id] for unit_id in self.unit_ids])

Expand Down
36 changes: 23 additions & 13 deletions src/spikeinterface/core/channelsaggregationrecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@ class ChannelsAggregationRecording(BaseRecording):

Do not use this class directly but use `si.aggregate_channels(...)`

"""

def __init__(self, recording_list_or_dict=None, renamed_channel_ids=None, recording_list=None):
Parameters
----------
recording_list_or_dict : list or dict
The list or dictionary of recordings to aggregate.
renamed_channel_ids : list, optional
The new channel ids for the aggregated recording. If None, default unique consecutive ids are used.

if recording_list is not None:
warnings.warn(
"`recording_list` is deprecated and will be removed in 0.105.0. Please use `recording_list_or_dict` instead.",
category=FutureWarning,
stacklevel=2,
)
recording_list_or_dict = recording_list
"""

def __init__(self, recording_list_or_dict=None, renamed_channel_ids=None):
if isinstance(recording_list_or_dict, dict):
recording_list = list(recording_list_or_dict.values())
recording_ids = list(recording_list_or_dict.keys())
Expand Down Expand Up @@ -149,7 +147,20 @@ def __init__(self, recording_list_or_dict=None, renamed_channel_ids=None, record
sub_segment = ChannelsAggregationRecordingSegment(channel_map, parent_segments)
self.add_recording_segment(sub_segment)

self._kwargs = {"recording_list": recording_list, "renamed_channel_ids": renamed_channel_ids}
self._kwargs = {"recording_list_or_dict": recording_list, "renamed_channel_ids": renamed_channel_ids}

@classmethod
def _handle_kwargs_backward_compatibility(cls, old_kwargs, full_dict):
"""
Fix backward compatibility issues with `recording_list' argument,
which is renamed to `recording_list_or_dict'.
"""
if "recording_list" in old_kwargs:
new_kwargs = old_kwargs.copy()
new_kwargs["recording_list_or_dict"] = new_kwargs.pop("recording_list")
else:
new_kwargs = old_kwargs
return new_kwargs

@property
def recordings(self):
Expand Down Expand Up @@ -258,7 +269,6 @@ def get_traces(
def aggregate_channels(
recording_list_or_dict=None,
renamed_channel_ids=None,
recording_list=None,
):
"""
Aggregates channels of multiple recording into a single recording object
Expand All @@ -282,4 +292,4 @@ def aggregate_channels(
values, are dropped.
"""

return ChannelsAggregationRecording(recording_list_or_dict, renamed_channel_ids, recording_list)
return ChannelsAggregationRecording(recording_list_or_dict, renamed_channel_ids)
38 changes: 1 addition & 37 deletions src/spikeinterface/core/recording_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ def write_to_h5_dataset_format(
chunk_size=None,
chunk_memory="500M",
verbose=False,
return_scaled=None,
return_in_uV=False,
):
"""
Expand Down Expand Up @@ -297,8 +296,6 @@ def write_to_h5_dataset_format(
Chunk size in bytes must end with "k", "M" or "G"
verbose : bool, default: False
If True, output is verbose (when chunks are used)
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
return_in_uV : bool, default: False
If True and the recording has scaling (gain_to_uV and offset_to_uV properties),
traces are dumped to uV
Expand Down Expand Up @@ -340,14 +337,6 @@ def write_to_h5_dataset_format(
chunk_size = ensure_chunk_size(recording, chunk_size=chunk_size, chunk_memory=chunk_memory, n_jobs=1)

if chunk_size is None:
# Handle deprecated return_scaled parameter
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
)
return_in_uV = return_scaled

traces = recording.get_traces(return_in_uV=return_in_uV)
if dtype is not None:
traces = traces.astype(dtype_file, copy=False)
Expand Down Expand Up @@ -392,9 +381,7 @@ def write_to_h5_dataset_format(
return save_path


def get_random_data_chunks(
recording, return_scaled=None, return_in_uV=False, concatenated=True, **random_slices_kwargs
):
def get_random_data_chunks(recording, return_in_uV=False, concatenated=True, **random_slices_kwargs):
"""
Extract random chunks across segments.

Expand All @@ -408,8 +395,6 @@ def get_random_data_chunks(
----------
recording : BaseRecording
The recording to get random chunks from
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
return_in_uV : bool, default: False
If True and the recording has scaling (gain_to_uV and offset_to_uV properties),
traces are scaled to uV
Expand All @@ -426,15 +411,6 @@ def get_random_data_chunks(
chunk_list : np.ndarray | list of np.array
Array of concatenate chunks per segment
"""
# Handle deprecated return_scaled parameter
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled

return get_chunks(
recording,
concatenated=concatenated,
Expand Down Expand Up @@ -525,7 +501,6 @@ def _noise_level_chunk_init(recording, return_in_uV, method):

def get_noise_levels(
recording: "BaseRecording",
return_scaled: bool | None = None,
return_in_uV: bool = True,
method: Literal["mad", "std", "rms"] = "mad",
force_recompute: bool = False,
Expand All @@ -548,8 +523,6 @@ def get_noise_levels(

recording : BaseRecording
The recording extractor to get noise levels
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
return_in_uV : bool, default: True
If True, returned noise levels are scaled to uV
method : "mad" | "std" | "rms", default: "mad"
Expand All @@ -567,15 +540,6 @@ def get_noise_levels(
noise_levels : array
Noise levels for each channel
"""

# Handle deprecated return_scaled parameter
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
)
return_in_uV = return_scaled

if return_in_uV:
key = f"noise_level_{method}_scaled"
else:
Expand Down
29 changes: 1 addition & 28 deletions src/spikeinterface/core/sortinganalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def create_sorting_analyzer(
sparse: bool = True,
sparsity: ChannelSparsity | None = None,
set_sparsity_by_dict_key: bool = False,
return_scaled: bool | None = None,
return_in_uV: bool = True,
overwrite: bool = False,
backend_options: dict[str, Any] | None = None,
Expand Down Expand Up @@ -118,14 +117,9 @@ def create_sorting_analyzer(
set_sparsity_by_dict_key : bool, default: False
If True and passing recording and sorting dicts, will set the sparsity based on the dict keys,
and other `sparsity_kwargs` are overwritten. If False, use other sparsity settings.
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
All extensions that play with traces will use this global return_in_uV : "waveforms", "noise_levels", "templates".
This prevent return_in_uV being differents from different extensions and having wrong snr for instance.
return_in_uV : bool, default: None
return_in_uV : bool, default: True
If True, all extensions that play with traces will use this global return_in_uV : "waveforms", "noise_levels", "templates".
This prevent return_in_uV being differents from different extensions and having wrong snr for instance.
If None, use return_scaled value.
overwrite: bool, default: False
If True, overwrite the folder if it already exists.
backend_options : dict | None, default: None
Expand Down Expand Up @@ -269,7 +263,6 @@ def create_sorting_analyzer(
sparse=sparse,
sparsity=sparsity,
main_channel_indices=main_channel_indices,
return_scaled=return_scaled,
return_in_uV=return_in_uV,
overwrite=overwrite,
backend_options=backend_options,
Expand Down Expand Up @@ -329,15 +322,6 @@ def create_sorting_analyzer(
else:
sparsity = None

# Handle deprecated return_scaled parameter
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled if return_in_uV is None else return_in_uV

# Handle return_in_uV parameter for recordings without scaling
if return_in_uV and not recording.has_scaleable_traces() and recording.get_dtype().kind == "i":
warnings.warn("create_sorting_analyzer: recording does not have scaling to uV, forcing return_in_uV=False")
Expand Down Expand Up @@ -451,9 +435,6 @@ def __init__(
self.peak_sign = peak_sign
self.peak_mode = peak_mode
self._main_channel_indices = None

# For backward compatibility
self.return_scaled = return_in_uV
self.folder: str | Path | None = None

# this is used to store temporary recording
Expand Down Expand Up @@ -526,7 +507,6 @@ def create(
folder: str | Path | None = None,
lazy: bool = False,
sparsity: ChannelSparsity | None = None,
return_scaled: bool | None = None,
return_in_uV: bool = True,
peak_sign: PeakSignType = "both",
peak_mode: PeakModeType = "extremum",
Expand All @@ -536,13 +516,6 @@ def create(
assert (
main_channel_indices is not None
), "To create a SortingAnalyzer you need to specify the main_channel_indices"
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled if return_in_uV is None else return_in_uV

# some checks
if sorting.sampling_frequency != recording.sampling_frequency:
Expand Down
12 changes: 0 additions & 12 deletions src/spikeinterface/core/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def check_sorted_arrays_equal(a1, a2):
def check_recordings_equal(
RX1: BaseRecording,
RX2: BaseRecording,
return_scaled=None,
return_in_uV=True,
force_dtype=None,
check_annotations: bool = False,
Expand All @@ -29,9 +28,6 @@ def check_recordings_equal(
First recording
RX2 : BaseRecording
Second recording
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
If True, compare scaled traces
return_in_uV : bool, default: True
If True, compare scaled traces.
force_dtype : dtype, default: None
Expand All @@ -41,14 +37,6 @@ def check_recordings_equal(
check_properties : bool, default: False
If True, check properties
"""
# Handle deprecated return_scaled parameter
if return_scaled is not None:
warnings.warn(
"`return_scaled` is deprecated and will be removed in version 0.105.0. Use `return_in_uV` instead.",
category=FutureWarning,
stacklevel=2,
)
return_in_uV = return_scaled
assert RX1.get_num_segments() == RX2.get_num_segments()

for segment_idx in range(RX1.get_num_segments()):
Expand Down
Loading
Loading