pykilosort


Namepykilosort JSON
Version 1.4.6 PyPI version JSON
download
home_pagehttps://github.com/rossant/pykilosort
SummaryPython port of KiloSort 2
upload_time2023-09-28 13:14:00
maintainer
docs_urlNone
authorCyrille Rossant
requires_python
licenseBSD
keywords kilosort spike sorting electrophysiology neuroscience
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python port of KiloSort2

This is a Python port of the original MATLAB version of [Kilosort 2.5](https://github.com/MouseLand/Kilosort), written by Marius Pachitariu, with Neuropixel specific improvements and software engineering enhancements.
The modifications are described in [this white paper](https://doi.org/10.6084/m9.figshare.19705522.v3).

## Installation 

### System Requirements

The code makes extensive use of the GPU via the CUDA framework. A high-end NVIDIA GPU with at least 8GB of memory is required.


### Doing the install using Anaconda (Linux)

Only on Linux, first install fftw by running the following 
    
    sudo apt-get install -y libfftw3-dev

Navigate to the desired location for the repository and clone it

    git clone https://github.com/int-brain-lab/pykilosort.git
    cd pykilosort

Create a conda environment

    conda env create -f pyks2.yml
    conda activate pyks2
    pip install -e .

## Usage

### Example

We provide a few datasets to explore parametrization and test on several brain regions.
The smallest dataset is a 100 seconds excerpt to test the installation. Here is the minimal working example:

```python
import shutil
from pathlib import Path

from pykilosort.ibl import run_spike_sorting_ibl, ibl_pykilosort_params, download_test_data

data_path = Path("/mnt/s0/spike_sorting/integration_tests")  # path on which the raw data will be downloaded
scratch_dir = Path.home().joinpath("scratch", 'pykilosort')  # temporary path on which intermediate raw data will be written, we highly recommend a SSD drive
ks_output_dir = Path("/mnt/s0/spike_sorting/outputs")  # path containing the kilosort output unprocessed
alf_path = ks_output_dir.joinpath('alf')  # this is the output standardized as per IBL standards (SI units, ALF convention)

# download the integration test data from amazon s3 bucket
bin_file, meta_file = download_test_data(data_path)

# prepare and mop up folder architecture for consecutive runs
DELETE = True  # delete the intermediate run products, if False they'll be copied over to the output directory for debugging
shutil.rmtree(scratch_dir, ignore_errors=True)
scratch_dir.mkdir(exist_ok=True)
ks_output_dir.mkdir(parents=True, exist_ok=True)

# loads parameters and run
params = ibl_pykilosort_params(bin_file)
params['Th'] = [6, 3]
run_spike_sorting_ibl(bin_file, delete=DELETE, scratch_dir=scratch_dir,
                      ks_output_dir=ks_output_dir, alf_path=alf_path, log_level='INFO', params=params)
```

## Troubleshooting
### Managing CUDA Errors

Errors with the CUDA installation can sometimes be fixed by downgrading
the version of cudatoolkit installed. Currently tested versions are 9.2,
10.0, 10.2, 11.0 and 11.5

To check the current version run the following:

    conda activate pyks2
    conda list cudatoolkit

To install version 10.0 for example run the following

    conda activate pyks2
    conda remove cupy, cudatoolkit
    conda install -c conda-forge cupy cudatoolkit=10.0

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rossant/pykilosort",
    "name": "pykilosort",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "kilosort,spike sorting,electrophysiology,neuroscience",
    "author": "Cyrille Rossant",
    "author_email": "cyrille.rossant@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/81/1b/f05b7f849f0476082f0054464e3d5f81f929227a1d8eb38d1309321d2427/pykilosort-1.4.6.tar.gz",
    "platform": null,
    "description": "# Python port of KiloSort2\n\nThis is a Python port of the original MATLAB version of [Kilosort 2.5](https://github.com/MouseLand/Kilosort), written by Marius Pachitariu, with Neuropixel specific improvements and software engineering enhancements.\nThe modifications are described in [this white paper](https://doi.org/10.6084/m9.figshare.19705522.v3).\n\n## Installation \n\n### System Requirements\n\nThe code makes extensive use of the GPU via the CUDA framework. A high-end NVIDIA GPU with at least 8GB of memory is required.\n\n\n### Doing the install using Anaconda (Linux)\n\nOnly on Linux, first install fftw by running the following \n    \n    sudo apt-get install -y libfftw3-dev\n\nNavigate to the desired location for the repository and clone it\n\n    git clone https://github.com/int-brain-lab/pykilosort.git\n    cd pykilosort\n\nCreate a conda environment\n\n    conda env create -f pyks2.yml\n    conda activate pyks2\n    pip install -e .\n\n## Usage\n\n### Example\n\nWe provide a few datasets to explore parametrization and test on several brain regions.\nThe smallest dataset is a 100 seconds excerpt to test the installation. Here is the minimal working example:\n\n```python\nimport shutil\nfrom pathlib import Path\n\nfrom pykilosort.ibl import run_spike_sorting_ibl, ibl_pykilosort_params, download_test_data\n\ndata_path = Path(\"/mnt/s0/spike_sorting/integration_tests\")  # path on which the raw data will be downloaded\nscratch_dir = Path.home().joinpath(\"scratch\", 'pykilosort')  # temporary path on which intermediate raw data will be written, we highly recommend a SSD drive\nks_output_dir = Path(\"/mnt/s0/spike_sorting/outputs\")  # path containing the kilosort output unprocessed\nalf_path = ks_output_dir.joinpath('alf')  # this is the output standardized as per IBL standards (SI units, ALF convention)\n\n# download the integration test data from amazon s3 bucket\nbin_file, meta_file = download_test_data(data_path)\n\n# prepare and mop up folder architecture for consecutive runs\nDELETE = True  # delete the intermediate run products, if False they'll be copied over to the output directory for debugging\nshutil.rmtree(scratch_dir, ignore_errors=True)\nscratch_dir.mkdir(exist_ok=True)\nks_output_dir.mkdir(parents=True, exist_ok=True)\n\n# loads parameters and run\nparams = ibl_pykilosort_params(bin_file)\nparams['Th'] = [6, 3]\nrun_spike_sorting_ibl(bin_file, delete=DELETE, scratch_dir=scratch_dir,\n                      ks_output_dir=ks_output_dir, alf_path=alf_path, log_level='INFO', params=params)\n```\n\n## Troubleshooting\n### Managing CUDA Errors\n\nErrors with the CUDA installation can sometimes be fixed by downgrading\nthe version of cudatoolkit installed. Currently tested versions are 9.2,\n10.0, 10.2, 11.0 and 11.5\n\nTo check the current version run the following:\n\n    conda activate pyks2\n    conda list cudatoolkit\n\nTo install version 10.0 for example run the following\n\n    conda activate pyks2\n    conda remove cupy, cudatoolkit\n    conda install -c conda-forge cupy cudatoolkit=10.0\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Python port of KiloSort 2",
    "version": "1.4.6",
    "project_urls": {
        "Homepage": "https://github.com/rossant/pykilosort"
    },
    "split_keywords": [
        "kilosort",
        "spike sorting",
        "electrophysiology",
        "neuroscience"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "04463fe2e2920786ff8e705c536df3359a014db7e2b69cb86e766e5194a24221",
                "md5": "db4593b29764c67ef954365c85eab3aa",
                "sha256": "94bac3fb359d76ddc48ea05f4f698b027a75ec3a01cb19600553ef3fb2d10e2f"
            },
            "downloads": -1,
            "filename": "pykilosort-1.4.6-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db4593b29764c67ef954365c85eab3aa",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 87553,
            "upload_time": "2023-09-28T13:13:57",
            "upload_time_iso_8601": "2023-09-28T13:13:57.868388Z",
            "url": "https://files.pythonhosted.org/packages/04/46/3fe2e2920786ff8e705c536df3359a014db7e2b69cb86e766e5194a24221/pykilosort-1.4.6-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "811bf05b7f849f0476082f0054464e3d5f81f929227a1d8eb38d1309321d2427",
                "md5": "4a0111b55900b83fdb3a35cc5dd28d40",
                "sha256": "9da7357658fd15726fefbd5fdb0812fe0e901213cc9a8f591736803c3ba44bb5"
            },
            "downloads": -1,
            "filename": "pykilosort-1.4.6.tar.gz",
            "has_sig": false,
            "md5_digest": "4a0111b55900b83fdb3a35cc5dd28d40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 88677,
            "upload_time": "2023-09-28T13:14:00",
            "upload_time_iso_8601": "2023-09-28T13:14:00.535467Z",
            "url": "https://files.pythonhosted.org/packages/81/1b/f05b7f849f0476082f0054464e3d5f81f929227a1d8eb38d1309321d2427/pykilosort-1.4.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-28 13:14:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rossant",
    "github_project": "pykilosort",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [],
    "test_requirements": [],
    "lcname": "pykilosort"
}
        
Elapsed time: 0.11865s