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

Auto-cast recording to float prior to interpolation #3415

Merged
merged 1 commit into from
Sep 16, 2024
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: 5 additions & 1 deletion src/spikeinterface/preprocessing/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from spikeinterface.core.core_tools import SIJsonEncoder
from spikeinterface.core.job_tools import _shared_job_kwargs_doc


motion_options_preset = {
# dredge
"dredge": {
Expand Down Expand Up @@ -277,10 +278,11 @@ def correct_motion(

This function depends on several modular components of :py:mod:`spikeinterface.sortingcomponents`.

If select_kwargs is None then all peak are used for localized.
If `select_kwargs` is None then all peak are used for localized.

The recording must be preprocessed (filter and denoised at least), and we recommend to not use whithening before motion
estimation.
Since the motion interpolation requires a "float" recording, the recording is casted to float32 if necessary.

Parameters for each step are handled as separate dictionaries.
For more information please check the documentation of the following functions:
Expand Down Expand Up @@ -435,6 +437,8 @@ def correct_motion(
t1 = time.perf_counter()
run_times["estimate_motion"] = t1 - t0

if recording.get_dtype().kind != "f":
recording = recording.astype("float32")
recording_corrected = InterpolateMotionRecording(recording, motion, **interpolate_motion_kwargs)

motion_info = dict(
Expand Down
Loading