Skip to content

Commit f976de0

Browse files
authored
Merge pull request #54 from SpikeInterface/ibl-pykilosort
IBL pykilosort
2 parents 664db73 + cce6eb7 commit f976de0

5 files changed

Lines changed: 61 additions & 26 deletions

File tree

pykilosort/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ RUN echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> /root/.profile
2929
# make conda activate command available from /bin/bash --interactive shells
3030
RUN conda init bash
3131

32-
# Install python port of pykilosort
33-
RUN git clone -b drift_test_stable https://github.com/kushbanga/pykilosort.git /src/pykilosort
32+
# Install IBL python port of pykilosort
33+
RUN git clone https://github.com/int-brain-lab/pykilosort.git /src/pykilosort
3434
WORKDIR /src/pykilosort
35-
# Switch to MouseLand/develop branch - may revert to kushbanga/drift_test_stable in the future
36-
RUN git remote add MouseLand https://github.com/MouseLand/pykilosort.git && \
37-
git fetch MouseLand && git checkout MouseLand/develop && git checkout -b develop
3835

3936
# modify env file so that env extends on base
4037
RUN sed -i "s/pyks2/base/" pyks2.yml
38+
RUN sed -i "s/- spikeinterface//" pyks2.yml
39+
RUN cat pyks2.yml
4140

4241
# Create environment
4342
RUN conda env update --name base --file pyks2.yml --prune

pykilosort/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
docker build -t spikeinterface/pykilosort-base:latest -t spikeinterface/pykilosort-base:0.1.0 .
3+
docker build -t spikeinterface/pykilosort-base:latest -t spikeinterface/pykilosort-base:ibl-1.3 .

pykilosort/push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
docker push --all-tags spikeinterface/pykilosort-base
3+
docker push --all-tags spikeinterface/pykilosort-base

tests/test_containers_gpu.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@
88

99
os.environ['SINGULARITY_DISABLE_CACHE'] = 'true'
1010

11+
# test docker or singularity
12+
DOCKER_SINGULARITY = "singularity" # "docker"
13+
14+
15+
def generate_run_kwargs():
16+
test_recording, _ = se.toy_example(
17+
duration=30,
18+
seed=0,
19+
num_channels=64,
20+
num_segments=1
21+
)
22+
test_recording = test_recording.save(name='toy')
23+
test_recording.set_channel_gains(1)
24+
test_recording.set_channel_offsets(1)
25+
run_kwargs = dict(recording=test_recording, verbose=True)
26+
if DOCKER_SINGULARITY == "singularity":
27+
run_kwargs["singularity_image"] = True
28+
elif DOCKER_SINGULARITY == "docker":
29+
run_kwargs["docker_image"] = True
30+
else:
31+
raise Exception("DOCKER_SINGULARITY can be 'docker' or 'singularity'")
32+
return run_kwargs
1133

1234
@pytest.fixture(autouse=True)
1335
def work_dir(request, tmp_path):
@@ -27,14 +49,7 @@ def work_dir(request, tmp_path):
2749

2850
@pytest.fixture
2951
def run_kwargs(work_dir):
30-
test_recording, _ = se.toy_example(
31-
duration=30,
32-
seed=0,
33-
num_channels=64,
34-
num_segments=1
35-
)
36-
test_recording = test_recording.save(name='toy')
37-
return dict(recording=test_recording, verbose=True, singularity_image=True)
52+
return generate_run_kwargs()
3853

3954

4055
def test_kilosort2(run_kwargs):
@@ -60,3 +75,7 @@ def test_yass(run_kwargs):
6075
def test_pykilosort(run_kwargs):
6176
sorting = ss.run_pykilosort(output_folder="pykilosort", **run_kwargs)
6277
print(sorting)
78+
79+
if __name__ == "__main__":
80+
kwargs = generate_run_kwargs()
81+
test_pykilosort(kwargs)

tests/test_singularity_containers.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@
88

99
os.environ['SINGULARITY_DISABLE_CACHE'] = 'true'
1010

11+
# test docker or singularity
12+
DOCKER_SINGULARITY = "singularity" # "docker"
13+
14+
15+
def generate_run_kwargs():
16+
test_recording, _ = se.toy_example(
17+
duration=30,
18+
seed=0,
19+
num_channels=64,
20+
num_segments=1
21+
)
22+
test_recording = test_recording.save(name='toy')
23+
test_recording.set_channel_gains(1)
24+
test_recording.set_channel_offsets(1)
25+
run_kwargs = dict(recording=test_recording, verbose=True)
26+
if DOCKER_SINGULARITY == "singularity":
27+
run_kwargs["singularity_image"] = True
28+
elif DOCKER_SINGULARITY == "docker":
29+
run_kwargs["docker_image"] = True
30+
else:
31+
raise Exception("DOCKER_SINGULARITY can be 'docker' or 'singularity'")
32+
return run_kwargs
33+
1134

1235
@pytest.fixture(autouse=True)
1336
def work_dir(request, tmp_path):
@@ -27,16 +50,7 @@ def work_dir(request, tmp_path):
2750

2851
@pytest.fixture
2952
def run_kwargs(work_dir):
30-
test_recording, _ = se.toy_example(
31-
duration=30,
32-
seed=0,
33-
num_channels=64,
34-
num_segments=1
35-
)
36-
test_recording.set_channel_gains(1)
37-
test_recording.set_channel_offsets(1)
38-
test_recording = test_recording.save(name='toy')
39-
return dict(recording=test_recording, verbose=True, singularity_image=True)
53+
return generate_run_kwargs()
4054

4155

4256
def test_spykingcircus(run_kwargs):
@@ -78,11 +92,14 @@ def test_kilosort1(run_kwargs):
7892
sorting = ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs)
7993
print(sorting)
8094

81-
8295
def test_combinato(run_kwargs):
8396
rec = run_kwargs['recording']
8497
channels = rec.get_channel_ids()[0:1]
8598
rec_one_channel = rec.channel_slice(channels)
8699
run_kwargs['recording'] = rec_one_channel
87100
sorting = ss.run_combinato(output_folder='combinato', **run_kwargs)
88101
print(sorting)
102+
103+
if __name__ == "__main__":
104+
kwargs = generate_run_kwargs()
105+
test_ironclust(kwargs)

0 commit comments

Comments
 (0)