Skip to content

Commit b224593

Browse files
committed
Added kilosort-compiled for versions 1, 2 and 2_5
1 parent c14ab00 commit b224593

12 files changed

Lines changed: 197 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ks-matlab-base
2+
3+
RUN chmod 755 /usr/bin/mlrtapp/ks_compiled
4+
ENV PATH="/usr/bin/mlrtapp:${PATH}"
5+
6+
RUN apt-get update -y
7+
RUN apt-get install software-properties-common -y
8+
RUN add-apt-repository ppa:deadsnakes/ppa -y
9+
RUN apt-get install git python3.8 python3.8-dev -y
10+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
11+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
12+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
13+
RUN apt-get install python3-pip -y
14+
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
15+
RUN pip install -U pip
16+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker build -t spikeinterface/kilosort-compiled-base:0.1.0 .
4+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
function ks_master(fpath)
2+
try
3+
set(groot,'defaultFigureVisible', 'off');
4+
5+
% Load channel map file
6+
load(fullfile(fpath, 'chanMap.mat'));
7+
8+
% Load the configuration file, it builds the structure of options (ops)
9+
load(fullfile(fpath, 'ops.mat'));
10+
11+
useGPU = ops.GPU;
12+
13+
% load predefined principal components (visualization only (Phy): used for features)
14+
dd = load('PCspikes2.mat'); % you might want to recompute this from your own data
15+
ops.wPCA = dd.Wi(:,1:7); % PCs
16+
17+
% This part runs the normal Kilosort processing on the simulated data
18+
[rez, DATA, uproj] = preprocessData(ops); % preprocess data and extract spikes for initialization
19+
rez = fitTemplates(rez, DATA, uproj); % fit templates iteratively
20+
rez = fullMPMU(rez, DATA);% extract final spike times (overlapping extraction)
21+
22+
rez = merge_posthoc2(rez);
23+
fprintf('merge_posthoc2 error. Reporting pre-merge result\n');
24+
25+
% save python results file for Phy
26+
rezToPhy(rez, fullfile(fpath));
27+
catch
28+
fprintf('----------------------------------------');
29+
fprintf(lasterr());
30+
quit(1);
31+
end
32+
quit(0);
33+
end
34+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker push spikeinterface/kilosort-compiled-base:0.1.0
4+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ks2-matlab-base
2+
3+
RUN chmod 755 /usr/bin/mlrtapp/ks2_compiled
4+
ENV PATH="/usr/bin/mlrtapp:${PATH}"
5+
6+
RUN apt-get update -y
7+
RUN apt-get install software-properties-common -y
8+
RUN add-apt-repository ppa:deadsnakes/ppa -y
9+
RUN apt-get install git python3.8 python3.8-dev -y
10+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
11+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
12+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
13+
RUN apt-get install python3-pip -y
14+
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
15+
RUN pip install -U pip
16+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker build -t spikeinterface/kilosort2-compiled-base:0.1.0 .
4+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
function ks2_compiled(fpath)
2+
try
3+
set(groot,'defaultFigureVisible', 'off');
4+
5+
% Load channel map file
6+
load(fullfile(fpath, 'chanMap.mat'));
7+
8+
% Load the configuration file, it builds the structure of options (ops)
9+
load(fullfile(fpath, 'ops.mat'));
10+
11+
% preprocess data to create temp_wh.dat
12+
rez = preprocessDataSub(ops);
13+
14+
% time-reordering as a function of drift
15+
rez = clusterSingleBatches(rez);
16+
17+
% main tracking and template matching algorithm
18+
rez = learnAndSolve8b(rez);
19+
20+
% final merges
21+
rez = find_merges(rez, 1);
22+
23+
% final splits by SVD
24+
rez = splitAllClusters(rez, 1);
25+
26+
% final splits by amplitudes
27+
rez = splitAllClusters(rez, 0);
28+
29+
% decide on cutoff
30+
rez = set_cutoff(rez);
31+
32+
fprintf('found %d good units \n', sum(rez.good>0))
33+
34+
fprintf('Saving results to Phy \n')
35+
rezToPhy(rez, fullfile(fpath));
36+
catch
37+
fprintf('----------------------------------------');
38+
fprintf(lasterr());
39+
quit(1);
40+
end
41+
quit(0);
42+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker push spikeinterface/kilosort-compiled-base:0.1.0
4+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ks2_5-matlab-base
2+
3+
RUN chmod 755 /usr/bin/mlrtapp/ks2_5_compiled
4+
ENV PATH="/usr/bin/mlrtapp:${PATH}"
5+
6+
RUN apt-get update -y
7+
RUN apt-get install software-properties-common -y
8+
RUN add-apt-repository ppa:deadsnakes/ppa -y
9+
RUN apt-get install git python3.8 python3.8-dev -y
10+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
11+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
12+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
13+
RUN apt-get install python3-pip -y
14+
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
15+
RUN pip install -U pip
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker build -t spikeinterface/kilosort2_5-compiled-base:0.1.0 .
4+

0 commit comments

Comments
 (0)