Skip to content
Merged
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
4 changes: 3 additions & 1 deletion doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Low-level
.. autoclass:: ChunkRecordingExecutor


Back-compatibility with ``WaveformExtractor`` (version < 0.101.0)
Back-compatibility with ``WaveformExtractor`` (version > 0.100.0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. automodule:: spikeinterface.core
Expand Down Expand Up @@ -179,6 +179,8 @@ spikeinterface.preprocessing
.. autofunction:: correct_motion
.. autofunction:: get_motion_presets
.. autofunction:: get_motion_parameters_preset
.. autofunction:: load_motion_info
.. autofunction:: save_motion_info
.. autofunction:: depth_order
.. autofunction:: detect_bad_channels
.. autofunction:: directional_derivative
Expand Down
2 changes: 0 additions & 2 deletions doc/how_to/handle_drift.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,6 @@ A preset is a nested dict that contains theses methods/parameters.
Run motion correction with one function!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Correcting for drift is easy! You just need to run a single function. We
will try this function with some presets.

Here we also save the motion correction results into a folder to be able
to load them later.
Expand Down
3 changes: 0 additions & 3 deletions examples/how_to/handle_drift.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ def preprocess_chain(rec):

# ### Run motion correction with one function!
#
# Correcting for drift is easy! You just need to run a single function.
# We will try this function with some presets.
#
# Here we also save the motion correction results into a folder to be able to load them later.

# lets try theses presets
Expand Down
27 changes: 27 additions & 0 deletions src/spikeinterface/preprocessing/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,19 @@ def correct_motion(


def save_motion_info(motion_info, folder, overwrite=False):
"""
Saves motion info

Parameters
----------
motion_info : dict
The returned motion_info from running `compute_motion`
folder : str | Path
The path for saving the `motion_info`
overwrite : bool, default: False
Whether to overwrite the folder location when saving motion info

"""
folder = Path(folder)
if folder.is_dir():
if not overwrite:
Expand All @@ -590,6 +603,20 @@ def save_motion_info(motion_info, folder, overwrite=False):


def load_motion_info(folder):
"""
Loads a motion info dict from folder

Parameters
----------
folder : str | Path
The folder containing the motion info to load

Notes
-----
Loads both current Motion implementation as well as the
legacy Motion format

"""
from spikeinterface.core.motion import Motion

folder = Path(folder)
Expand Down
Loading