Skip to content

Commit 414ff20

Browse files
authored
Merge pull request #4057 from zm711/api-docs
Add motion functions to api docs
2 parents 315ea70 + 549c8dc commit 414ff20

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

doc/api.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Low-level
7676
.. autoclass:: ChunkRecordingExecutor
7777

7878

79-
Back-compatibility with ``WaveformExtractor`` (version < 0.101.0)
79+
Back-compatibility with ``WaveformExtractor`` (version > 0.100.0)
8080
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8181

8282
.. automodule:: spikeinterface.core
@@ -179,6 +179,8 @@ spikeinterface.preprocessing
179179
.. autofunction:: correct_motion
180180
.. autofunction:: get_motion_presets
181181
.. autofunction:: get_motion_parameters_preset
182+
.. autofunction:: load_motion_info
183+
.. autofunction:: save_motion_info
182184
.. autofunction:: depth_order
183185
.. autofunction:: detect_bad_channels
184186
.. autofunction:: directional_derivative

doc/how_to/handle_drift.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,6 @@ A preset is a nested dict that contains theses methods/parameters.
13221322
Run motion correction with one function!
13231323
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13241324

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

13281326
Here we also save the motion correction results into a folder to be able
13291327
to load them later.

examples/how_to/handle_drift.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ def preprocess_chain(rec):
109109

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

117114
# lets try theses presets

src/spikeinterface/preprocessing/motion.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,19 @@ def correct_motion(
568568

569569

570570
def save_motion_info(motion_info, folder, overwrite=False):
571+
"""
572+
Saves motion info
573+
574+
Parameters
575+
----------
576+
motion_info : dict
577+
The returned motion_info from running `compute_motion`
578+
folder : str | Path
579+
The path for saving the `motion_info`
580+
overwrite : bool, default: False
581+
Whether to overwrite the folder location when saving motion info
582+
583+
"""
571584
folder = Path(folder)
572585
if folder.is_dir():
573586
if not overwrite:
@@ -590,6 +603,20 @@ def save_motion_info(motion_info, folder, overwrite=False):
590603

591604

592605
def load_motion_info(folder):
606+
"""
607+
Loads a motion info dict from folder
608+
609+
Parameters
610+
----------
611+
folder : str | Path
612+
The folder containing the motion info to load
613+
614+
Notes
615+
-----
616+
Loads both current Motion implementation as well as the
617+
legacy Motion format
618+
619+
"""
593620
from spikeinterface.core.motion import Motion
594621

595622
folder = Path(folder)

0 commit comments

Comments
 (0)