Skip to content

Commit eaf09ba

Browse files
committed
Auto-cast recording to float prior to interpolation
1 parent b4dceac commit eaf09ba

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/spikeinterface/preprocessing/motion.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from spikeinterface.core.core_tools import SIJsonEncoder
1414
from spikeinterface.core.job_tools import _shared_job_kwargs_doc
1515

16+
1617
motion_options_preset = {
1718
# dredge
1819
"dredge": {
@@ -277,10 +278,11 @@ def correct_motion(
277278
278279
This function depends on several modular components of :py:mod:`spikeinterface.sortingcomponents`.
279280
280-
If select_kwargs is None then all peak are used for localized.
281+
If `select_kwargs` is None then all peak are used for localized.
281282
282283
The recording must be preprocessed (filter and denoised at least), and we recommend to not use whithening before motion
283284
estimation.
285+
Since the motion interpolation requires a "float" recording, the recording is casted to float32 if necessary.
284286
285287
Parameters for each step are handled as separate dictionaries.
286288
For more information please check the documentation of the following functions:
@@ -435,6 +437,8 @@ def correct_motion(
435437
t1 = time.perf_counter()
436438
run_times["estimate_motion"] = t1 - t0
437439

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

440444
motion_info = dict(

0 commit comments

Comments
 (0)