Skip to content

Commit cd857bc

Browse files
committed
Kilosort4 image
1 parent 34a2509 commit cd857bc

4 files changed

Lines changed: 86 additions & 0 deletions

File tree

kilosort4/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM nvidia/cuda:12.0.0-base-ubuntu20.04
2+
3+
LABEL maintainer="Alessio Buccino <alessiop.buccino@gmail.com>"
4+
5+
# USER root
6+
# Ubuntu package installs
7+
RUN apt update && \
8+
apt install -y --no-install-recommends \
9+
libfftw3-dev \
10+
git \
11+
wget && \
12+
apt clean && \
13+
rm -rf /var/lib/apt/lists/*
14+
15+
# install miniconda
16+
ENV MINICONDA_VERSION 24.1.2-0
17+
ENV PY_VERSION py311
18+
ENV CONDA_DIR /home/miniconda3
19+
ENV LATEST_CONDA_SCRIPT "Miniconda3-${PY_VERSION}_${MINICONDA_VERSION}-Linux-x86_64.sh"
20+
21+
RUN wget --quiet https://repo.anaconda.com/miniconda/$LATEST_CONDA_SCRIPT -O ~/miniconda.sh && \
22+
bash ~/miniconda.sh -b -p $CONDA_DIR && \
23+
rm ~/miniconda.sh
24+
ENV PATH=$CONDA_DIR/bin:$PATH
25+
RUN conda update conda && \
26+
conda install conda-build
27+
28+
# make conda activate command available from /bin/bash --login shells
29+
RUN echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> /root/.profile
30+
# make conda activate command available from /bin/bash --interactive shells
31+
RUN conda init bash
32+
33+
# install torch
34+
# RUN conda install -y pytorch pytorch-cuda=11.8 -c pytorch -c nvidia
35+
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
36+
37+
# install kilosort4
38+
RUN git clone https://github.com/MouseLand/Kilosort.git && \
39+
cd Kilosort && \
40+
pip install . && \
41+
cd ..

kilosort4/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### Build this image
2+
Build default image:
3+
docker build -t pykilosort:latest -f dockerfiles/Dockerfile .
4+
5+
Build image with additional testing components:
6+
docker build -t pykilosort:test -f dockerfiles/Dockerfile.testing context
7+
8+
### Run container
9+
docker run --rm -it -v <host-data-folder>:<docker-data-folder> --gpus all pykilosort:latest
10+
flags:
11+
--rm: removes container once it's stopped
12+
-it: for interactive session
13+
-v: mounted volumes (directories)
14+
--gpus: enables GPU use within container
15+
16+
### Test
17+
Download Neuropixel 1.0 data to your data directory: https://catalystneuro.github.io/spike-sorting-hackathon/datasets/datasets.html#allen-institute-example
18+
(see also https://github.com/int-brain-lab/pykilosort/tree/ibl_prod/examples, although apparently not up to date)
19+
20+
$docker run --rm -it -v /my/dir/to/data:/data --gpus all pykilosort
21+
#conda activate pyks2
22+
#cd /data
23+
--- alternatively, get data from kachery (if installed and configured) ---
24+
```
25+
wget https://catalystneuro.github.io/spike-sorting-hackathon/datasets/examples/example_allen_NP1.py
26+
python example_allen_NP1.py
27+
```
28+
29+
The either run tests in ipython console, or run example from /home/test_file directory (if using `.testing` image), after editing directory paths
30+
#ipython
31+
```
32+
from pathlib import Path
33+
from pykilosort import run, add_default_handler, np1_probe, np2_probe
34+
35+
data_path = Path('/data/Allen_Institute_NP1/continuous_1min.bin')
36+
dir_path = Path('/data/Allen_Institute_NP1/output')
37+
add_default_handler(level='INFO') # print output as the algorithm runs
38+
run(data_path, dir_path=dir_path, probe=np1_probe(sync_channel=False))
39+
```

kilosort4/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker build -t spikeinterface/kilosort4-base:latest -t spikeinterface/kilosort4-base:0.1.0 .

kilosort4/push.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker push --all-tags spikeinterface/kilosort4-base

0 commit comments

Comments
 (0)