### Install spikeinterface from source Source: https://github.com/spikeinterface/spikeinterface/blob/main/README.md Installs spikeinterface from source to get the latest updates. Clones the repository, changes into the directory, performs an editable install, and returns to the original directory. ```bash git clone https://github.com/SpikeInterface/spikeinterface.git cd spikeinterface pip install -e . cd .. ``` -------------------------------- ### Install neo and probeinterface from source Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/installation.rst Installs neo and probeinterface from source, recommended when installing spikeinterface from source because spikeinterface strongly relies on these packages for format interfacing and probe handling. ```bash pip install git+https://github.com/NeuralEnsemble/python-neo.git pip install git+https://github.com/SpikeInterface/probeinterface.git ``` -------------------------------- ### Install Yass (legacy) Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Installation instructions for the legacy Yass sorter, provided via a link to its official installation guide. ```text https://github.com/paninski-lab/yass/wiki/Installation-Local ``` -------------------------------- ### Example auto-release-notes command Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Example invocation of the auto-release-notes script with specific dates. ```bash bash auto-release-notes.sh 2025-02-19 2025-03-24 ``` -------------------------------- ### Example output of installed_sorters() Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/sorters.rst Example output of installed_sorters() showing a list of sorter names. ```python ['herdingspikes', 'klusta', 'mountainsort4', 'mountainsort5', 'spykingcircus', 'tridesclous'] ``` -------------------------------- ### Install sortingview backend Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/widgets.rst Installs the sortingview backend for web-based, shareable plots. ```bash pip install sortingview ``` -------------------------------- ### Install spikeinterface with widgets Source: https://github.com/spikeinterface/spikeinterface/blob/main/README.md Installs spikeinterface with all extra dependencies and all interactive widget backends. ```bash pip install "spikeinterface[full,widgets]" ``` -------------------------------- ### Install ephyviewer backend (pip) Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/widgets.rst Installs the ephyviewer backend with PySide6 for pip-based installations. ```bash pip install PySide6 ephyviewer ``` -------------------------------- ### Install SpikeInterface requirements with uv pip Source: https://github.com/spikeinterface/spikeinterface/blob/main/installation_tips/README.md Installs the packages listed in the 'beginner_requirements_stable.txt' file into the active virtual environment. ```bash uv pip install -r Documents/beginner_requirements_stable.txt ``` -------------------------------- ### Install uv on Windows (PowerShell) Source: https://github.com/spikeinterface/spikeinterface/blob/main/installation_tips/README.md Run this command in PowerShell to install uv on Windows. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install ephyviewer backend (conda) Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/widgets.rst Installs the ephyviewer backend for Anaconda users, using PyQt5. ```bash conda install pyqt=5 pip install ephyviewer ``` -------------------------------- ### Install Klusta (legacy) Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install the legacy Klusta sorter and its dependencies using pip. ```bash pip install cython h5py tqdm pip install click klusta klustakwik2 ``` -------------------------------- ### Install pykilosort Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Clone and install pykilosort. The recommended branch is ibl_prod from the IBL fork, or the develop branch from MouseLand. ```bash pip install phylib, pypandoc # recommended git clone --branch ibl_prod https://github.com/int-brain-lab/pykilosort # or git clone --branch develop https://github.com/MouseLand/pykilosort cd pykilosort pip install -r requirements.txt python setup.py install ``` -------------------------------- ### Install all widget backends Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/widgets.rst Installs all dependencies for all widget backends (matplotlib, ipywidgets, sortingview, ephyviewer). ```bash pip install spikeinterface[widgets] ``` -------------------------------- ### Install Black with pip Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Install the Black Python formatter into the current Python environment using pip. ```bash pip install black ``` -------------------------------- ### Install spikeinterface with full extras Source: https://github.com/spikeinterface/spikeinterface/blob/main/README.md Installs the latest version of spikeinterface with all extra dependencies for all sub-modules. The quotes ensure pip install works in all terminals/shells. ```bash pip install "spikeinterface[full]" ``` -------------------------------- ### Install matplotlib backend Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/widgets.rst Installs the matplotlib backend, which is the default backend for static figures. ```bash pip install matplotlib ``` -------------------------------- ### Setup and define paths for Neuropixels analysis Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/how_to/analyze_neuropixels.rst Set up the environment and define the paths to the Neuropixels SpikeGLX data folder. ```ipython3 %matplotlib inline ``` ```ipython3 import spikeinterface.full as si import numpy as np import matplotlib.pyplot as plt from pathlib import Path ``` ```ipython3 base_folder = Path('/mnt/data/sam/DataSpikeSorting/howto_si/neuropixel_example/') spikeglx_folder = base_folder / 'Rec_1_10_11_2021_g0' ``` -------------------------------- ### Install WaveClus Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Clone the WaveClus repository and set the WAVECLUS_PATH environment variable or use WaveClusSorter.set_waveclus_path() to provide the installation path. Requires Matlab. ```bash git clone https://github.com/csn-le/wave_clus/ # provide installation path by setting the WAVECLUS_PATH environment variable # or using WaveClusSorter.set_waveclus_path() ``` -------------------------------- ### Install pre-commit with pip Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Install pre-commit, which manages code formatting tools like Black before each commit. ```bash pip install pre-commit ``` -------------------------------- ### Install Mountainsort5 Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install Mountainsort5 via pip. ```bash pip install mountainsort5 ``` -------------------------------- ### List available and installed sorters Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/quickstart.rst Lists all sorters implemented by SpikeInterface and those installed on the machine. The output shows 21 available sorters and 5 installed ones. ```python print("Available sorters", ss.available_sorters()) print("Installed sorters", ss.installed_sorters()) ``` ```text Available sorters ['combinato', 'hdsort', 'herdingspikes', 'ironclust', 'kilosort', 'kilosort2', 'kilosort2_5', 'kilosort3', 'kilosort4', 'klusta', 'mountainsort4', 'mountainsort5', 'pykilosort', 'simple', 'spykingcircus', 'spykingcircus2', 'tridesclous', 'tridesclous2', 'waveclus', 'waveclus_snippets', 'yass'] Installed sorters ['mountainsort4', 'simple', 'spykingcircus2', 'tridesclous', 'tridesclous2'] ``` -------------------------------- ### Install uv on macOS and Linux Source: https://github.com/spikeinterface/spikeinterface/blob/main/installation_tips/README.md Run this command in a terminal to install uv on macOS and Linux. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install pre-commit hooks Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Set up pre-commit hooks for the local repository. After this, pre-commit runs Black and other configured hooks before each commit. ```bash pre-commit install ``` -------------------------------- ### Download Spike2 and MEArec example datasets Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/how_to/read_various_formats.rst Downloads example datasets from the ephy_testing_data repository: a Spike2 file (recording only) and a MEArec file (contains both recording and sorting). The paths are printed after download. ```ipython3 spike2_file_path = si.download_dataset(remote_path="spike2/130322-1LY.smr") print(spike2_file_path) mearec_folder_path = si.download_dataset(remote_path="mearec/mearec_test_10s.h5") print(mearec_folder_path) ``` -------------------------------- ### Install Mountainsort4 Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install Mountainsort4 via pip. ```bash pip install mountainsort4 ``` -------------------------------- ### Install Tridesclous Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install Tridesclous via pip. OpenCL is optional but recommended for faster performance. ```bash pip install tridesclous ``` -------------------------------- ### Install OpenCL and pyopencl for Tridesclous Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Optional installation of OpenCL ICD and pyopencl for hardware acceleration with Tridesclous. ```bash sudo apt-get install beignet (optional if Intel GPU) sudo apt-get install nvidia-opencl-XXX (optional if NVIDIA GPU) sudo apt-get install pocl-opencl-icd (optional for multi core CPU) sudo apt-get install opencl-headers ocl-icd-opencl-dev libclc-dev ocl-icd-libopencl1 pip install pyopencl ``` -------------------------------- ### Install spikeinterface core only Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/installation.rst Installs only the core module of spikeinterface without optional dependencies. ```bash pip install spikeinterface ``` -------------------------------- ### Install ipywidgets backend Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/widgets.rst Installs the ipywidgets backend and its dependencies for interactive plotting in Jupyter notebooks. ```bash pip install matplotlib ipympl ipywidgets ``` -------------------------------- ### Install spikeinterface with pip for testing Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Install spikeinterface in editable mode with the extractors and full extras and the test-all dependency group. The extras and groups are defined in pyproject.toml; --group requires pip 25.1+ or uv. ```bash pip install -e .[extractors,full] --group test-all ``` -------------------------------- ### Example docstring with parameter defaults Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Full example of a docstring following the SpikeInterface conventions: numpy docstring standard, double quotes for strings, and listing possible string values instead of using 'str'. ```python def a_function(param_a, param_b=5, param_c="mean"): """ A function for analyzing data Parameters ---------- param_a : dict A dictionary containing the data param_b : int, default: 5 A scaling factor to be applied to the data param_c : "mean" | "median", default: "mean" What to calculate on the data Returns ------- great_data : dict A dictionary of the processed data """ ``` -------------------------------- ### Import libraries Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/how_to/auto_label_units.rst Imports required libraries for the automatic labeling example. ```ipython3 import numpy as np import spikeinterface as si import spikeinterface.curation as sc import spikeinterface.widgets as sw from pprint import pprint ``` -------------------------------- ### Install Combinato Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Clone the Combinato repository, run setup_options.py inside the folder, and set the COMBINATO_PATH environment variable or use CombinatoSorter.set_combinato_path(). ```bash git clone https://github.com/jniediek/combinato # Then inside that folder, run: python setup_options.py # provide installation path by setting the COMBINATO_PATH environment variable # or using CombinatoSorter.set_combinato_path() ``` -------------------------------- ### Run node pipeline to get peaks and peak locations Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/sortingcomponents.rst Runs a node pipeline on a recording to obtain peaks and peak locations. The example shows how to call run_node_pipeline with job_kwargs and gather_mode='memory'. ```python # only 2 nodes give outputs from spikeinterface.core.node_pipeline import run_node_pipeline peaks, peak_locations = run_node_pipeline(recording, nodes, job_kwargs, job_name="my pipeline", gather_mode="memory") ``` -------------------------------- ### Run kilosort2 sorter using Docker container Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/quickstart.rst Runs the kilosort2 sorter using a Docker container (docker_image=True) with verbose output. Requires Docker to be installed. The output shows container setup steps and 19 units found. ```ipython3 sorting_KS2 = ss.run_sorter(sorter_name="kilosort2", recording=recording_preprocessed, docker_image=True, verbose=True) print(sorting_KS2) ``` ```text installation_mode='auto' switching to installation_mode: 'dev' Starting container Installing spikeinterface with folder in container Installing neo with pypi in container Installing mearec with pypi in container Running kilosort2 sorter inside spikeinterface/kilosort2-compiled-base Stopping container KiloSortSortingExtractor: 19 units - 1 segments - 32.0kHz ``` -------------------------------- ### Customize unit locations plot with matplotlib axis methods Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/how_to/customize_a_plot.rst Customizes the unit locations plot by modifying the widget's matplotlib axis: sets a title, axis labels, custom ticks, axis limits, and adds text. The example uses unit_locations data from the earlier setup. The final fig_units displays the widget. ```python # Get the widget fig_units = si.plot_unit_locations(sorting_analyzer) # Modify the widget's `axis`` to set the title and axes labels fig_units.ax.set_title("My favorite units", fontname = "Comic Sans MS") fig_units.ax.set_xlabel("x probe location (um)") fig_units.ax.set_ylabel("y probe location (um)") # You can also set custom ticks fig_units.ax.set_xticks([-60,-30,unit_locations[0,0],30,60]) fig_units.ax.set_xticklabels([-60,-30,"unit_0_x",30,60]) fig_units.ax.set_yticks([-40,-20,0,unit_locations[0,1],40]) fig_units.ax.set_yticklabels([-40,-20,0,"unit_0_y",40]) # Change the limits of the plot fig_units.ax.set_xlim((-30,50)) fig_units.ax.set_ylim((-50,50)) # And add extra information on the plot fig_units.ax.text(unit_locations[6,0], unit_locations[6,1]+5, s="UNIT 6!!!", fontname="Courier") fig_units ``` -------------------------------- ### Implement a custom spike sorter class Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Template for implementing a custom spike sorter class in SpikeInterface. It includes the required __init__ method and class methods for version, installation check, setup, parameter validation, filter check, running, and result extraction. The _run_from_folder method can execute CLI commands, Python code, or MATLAB code. ```python def __init__(self, **kargs): BaseSorter.__init__(self, **kargs) # optional @classmethod def get_sorter_version(cls): return myspikesorter.__version__ @classmethod def is_installed(cls): # Fill code to check sorter installation. It returns a boolean return HAVE_MYSORTER @classmethod def _setup_recording(cls, recording, output_folder, params, verbose): # Fill code to set up the recording: convert to required file, parse config files, etc. # The files should be placed in the 'output_folder' @classmethod def _check_params(cls, recording, output_folder, params): # optional # can be implemented in subclass for custom checks return params @classmethod def _check_apply_filter_in_params(cls, params): return False # optional # can be implemented in subclass to check if the filter will be applied @classmethod def _run_from_folder(cls, output_folder, params, verbose): # Fill code to run your spike sorter based on the files created in the _setup_recording() # You can run CLI commands (e.g. klusta, spykingcircus, tridesclous), pure Python code (e.g. Mountainsort5, # Herding Spikes), or even MATLAB code (e.g. Kilosort, Kilosort2, Ironclust) @classmethod def _get_result_from_folder(cls, output_folder): # If your spike sorter has a specific file format, you should implement a SortingExtractor in spikeextractors. # Let's assume you have done so, and the extractor is called MySpikeSorterSortingExtractor sorting = se.MySpikeSorterSortingExtractor(output_folder) return sorting ``` -------------------------------- ### Install SpykingCircus2 dependencies Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install SpykingCircus2 dependencies: HDBSCAN, SpikeInterface, and Numba. Numba can be installed via conda as recommended. ```bash pip install hdbscan pip install spikeinterface pip install numba (or conda install numba as recommended by conda authors) ``` -------------------------------- ### Install Tridesclous2 Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install Tridesclous2 and its required dependency Numba using pip. ```bash pip install spikeinterface pip install numba ``` -------------------------------- ### Build documentation with sphinx-build Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/development/development.rst Build the documentation locally using Sphinx. The output is placed in the doc/_build/html folder, and you can open index.html in your browser. ```bash sphinx-build -b html doc ./doc/_build/ ``` -------------------------------- ### Install extractors dependencies Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/extractors.rst Install all extractors' dependencies using pip with the 'extractors' extra. ```bash pip install spikeinterface[extractors] ``` -------------------------------- ### List all computable extensions with get_computable_extensions Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/postprocessing.rst Shows all extensions that can be computed for the current SortingAnalyzer. The example output lists all available extension names. ```python all_computable_extensions = sorting_analyzer.get_computable_extensions() print(all_computable_extensions) ``` ```bash >>> ['random_spikes', 'waveforms', 'templates', 'noise_levels', 'amplitude_scalings', 'correlograms', 'isi_histograms', 'principal_components', 'spike_amplitudes', 'spike_locations', 'template_metrics', 'template_similarity', 'unit_locations', 'quality_metrics'] ``` -------------------------------- ### Check installed sorters with installed_sorters() Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/sorters.rst Prints the list of sorters installed in the current Python environment. ```python from spikeinterface.sorters import installed_sorters installed_sorters() ``` -------------------------------- ### Set up IPython environment for LFP drift estimation Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/how_to/drift_with_lfp.rst Enables inline plotting and automatic reloading of modules in an IPython environment, useful for interactive exploration of the LFP-based drift estimation workflow. ```ipython3 %matplotlib inline %load_ext autoreload %autoreload 2 ``` -------------------------------- ### Create SortingAnalyzer in binary folder format Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/quickstart.rst Creates a SortingAnalyzer object in binary folder format, pairing the sorting and recording objects. The output shows a progress bar for sparsity estimation. ```ipython3 analyzer_TDC = si.create_sorting_analyzer(sorting=sorting_TDC, recording=recording_preprocessed, format='binary_folder', folder='analyzer_TDC_binary') ``` ```text estimate_sparsity: 0%| | 0/10 [00:00>> git clone https://github.com/jamesjun/ironclust and provide the installation path by setting the IRONCLUST_PATH environment variables or using IronClustSorter.set_ironclust_path(). ``` -------------------------------- ### Run uninstalled sorter with run_sorter() Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/sorters.rst Attempts to run a sorter that is not installed, triggering an installation error message. ```python recording = run_sorter(sorter_name='ironclust', recording=recording) ``` -------------------------------- ### Generate toy recording, sorting, and snippets with spikeinterface.core Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/core.rst Use generate_recording, generate_sorting, and generate_snippets to create simulated data for examples, tests, and demos. The recording has 2 segments and 4 channels, the sorting has 2 segments and 5 units, and the snippets have 60 samples on 2 channels from 5 units. ```python from spikeinterface.core import generate_recording, generate_sorting, generate_snippets # recording with 2 segments and 4 channels recording = generate_recording(num_channels=4, sampling_frequency=30000., durations=[10.325, 3.5], set_probe=True) # sorting with 2 segments and 5 units sorting = generate_sorting(num_units=5, sampling_frequency=30000., durations=[10.325, 3.5], firing_rates=15, refractory_period_ms=1.5) # snippets of 60 samples on 2 channels from 5 units snippets = generate_snippets(nbefore=20, nafter=40, num_channels=2, sampling_frequency=30000., durations=[10.325, 3.5], set_probe=True, num_units=5) ``` -------------------------------- ### Attach probe and retrieve probe information Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/core.rst Download a probe from the probeinterface library, wire it to a device, set it on a recording (optionally with group mode by shank), create a new recording with the probe, handle multi-probe recordings with probegroups, and retrieve probe and channel locations. ```python import probeinterface as pi # download probe probe = pi.get_probe(manufacturer='cambridgeneurotech', probe_name='ASSY-156-P-1') # add wiring probe.wiring_to_device('ASSY-156>RHD2164') # set probe (modifies the recording in place) recording.set_probe(probe) # set probe with group info derived from shank ids (in place) recording.set_probe(probe, group_mode="by_shank") # to get a *new* recording without modifying the original, use select_channels_with_probe recording_w_probe = recording.select_channels_with_probe(probe) recording_w_probe = recording.select_channels_with_probe(probe, group_mode="by_shank") # multi-probe recordings use set_probegroup / select_channels_with_probegroup recording.set_probegroup(probegroup) recording_w_probegroup = recording.select_channels_with_probegroup(probegroup) # retrieve probe probe_from_recording = recording.get_probe() # retrieve channel locations locations = recording.get_channel_locations() # equivalent to recording.get_property("location") ``` -------------------------------- ### Install Kilosort4 Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install Kilosort4 with pip, then reinstall torch with CUDA 11.8 support. Requires CUDA for GPU acceleration. ```bash pip install kilosort pip uninstall torch pip install torch --index-url https://download.pytorch.org/whl/cu118 ``` -------------------------------- ### Install SpyKING CIRCUS Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install SpyKING CIRCUS, which requires MPICH. The --no-binary=mpi4py flag is used to build mpi4py from source. ```bash sudo apt install libmpich-dev pip install mpi4py pip install spyking-circus --no-binary=mpi4py ``` -------------------------------- ### List available preprocessing steps with pp_names_to_functions Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/how_to/build_pipeline_with_dicts.rst Import the preprocessing pipeline dictionary and print its keys to see available preprocessing steps. This helps discover available options when using the dictionary-based pipeline approach. ```python from spikeinterface.preprocessing.pipeline import pp_names_to_functions print(pp_names_to_functions.keys()) ``` -------------------------------- ### Install Herdingspikes2 via pip Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install Herdingspikes2, a Python and C++ based sorter, using pip. Requires cython and numpy. ```bash pip install cython numpy pip install herdingspikes ``` -------------------------------- ### Create notebook from .py file with jupytext Source: https://github.com/spikeinterface/spikeinterface/blob/main/examples/how_to/README.md Converts a .py file to a notebook and sets the formats to sync both. Used as the first step in the documentation build workflow. ```bash >>> jupytext --to notebook get_started.py >>> jupytext --set-formats ipynb,py get_started.ipynb ``` -------------------------------- ### Install Python CUDA toolkit via conda Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install the Python CUDA toolkit via conda, which may be less painful than pip. ```bash conda install cupy ``` -------------------------------- ### Install Python CUDA toolkit via pip Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/get_started/install_sorters.rst Install the Python CUDA toolkit via pip. Replace cupy-cudaXXX with the appropriate version for your CUDA. ```bash pip install cupy (or pip install cupy-cudaXXX) ``` -------------------------------- ### Save SortingAnalyzer to zarr and binary_folder backends with save_as Source: https://github.com/spikeinterface/spikeinterface/blob/main/doc/modules/core.rst Saves an existing in-memory SortingAnalyzer to disk using the save_as function, creating both zarr and binary_folder backends. Also shows how to create a zarr-backed SortingAnalyzer directly upon instantiation. ```python from pathlib import Path # create a "processed" folder processed_folder = Path("processed") sorting_analyzer_zarr = sorting_analyzer.save_as( folder=processed_folder / "sorting_analyzer.zarr", format="zarr" ) sorting_analyzer_binary = sorting_analyzer.save_as( folder=processed_folder / "sorting_analyzer_bin", format="binary_folder" ) # sorting_analyzer_zarr and sorting_analyzer_binary are valid SortingAnalyzers, # now associated to a Zarr storage / binary folder backend # We can also create directly a SortingAnalyzer associated to a backend upon instantiation # for instance, this create "zarr" SortingAnalyzer object sorting_analyzer_with_backend = create_sorting_analyzer( sorting=sorting, recording=recording, sparse=True, format="zarr", folder="my-sorting-analyzer.zarr" ) ```