Skip to content
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

Patch with scipy for remove_artefacts when mode is linear/cubic #2072

Merged
merged 5 commits into from
Oct 5, 2023
Merged
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
6 changes: 2 additions & 4 deletions src/spikeinterface/preprocessing/remove_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def __init__(
time_jitter=0,
waveforms_kwargs={"allow_unfiltered": True, "mode": "memory"},
):
import scipy.interpolate

available_modes = ("zeros", "linear", "cubic", "average", "median")
num_seg = recording.get_num_segments()

Expand Down Expand Up @@ -236,8 +234,6 @@ def __init__(
time_pad,
sparsity,
):
import scipy.interpolate

BasePreprocessorSegment.__init__(self, parent_recording_segment)

self.triggers = np.asarray(triggers, dtype="int64")
Expand Down Expand Up @@ -285,6 +281,8 @@ def get_traces(self, start_frame, end_frame, channel_indices):
elif trig + pad[1] >= end_frame - start_frame:
traces[trig - pad[0] :, :] = 0
elif self.mode in ["linear", "cubic"]:
import scipy.interpolate

for trig in triggers:
if pad is None:
pre_data_end_idx = trig - 1
Expand Down