diff --git a/doc/api.rst b/doc/api.rst index bc685eee2a..b97df80ec1 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -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 @@ -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 diff --git a/doc/how_to/handle_drift.rst b/doc/how_to/handle_drift.rst index 86c146fd02..f1d4dc0a0e 100755 --- a/doc/how_to/handle_drift.rst +++ b/doc/how_to/handle_drift.rst @@ -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. diff --git a/examples/how_to/handle_drift.py b/examples/how_to/handle_drift.py index 02dd12f8a0..a38734991a 100755 --- a/examples/how_to/handle_drift.py +++ b/examples/how_to/handle_drift.py @@ -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 diff --git a/src/spikeinterface/preprocessing/motion.py b/src/spikeinterface/preprocessing/motion.py index 9fcb8fdbf3..2243412663 100644 --- a/src/spikeinterface/preprocessing/motion.py +++ b/src/spikeinterface/preprocessing/motion.py @@ -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: @@ -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)