Skip to content

Commit c0351eb

Browse files
committed
Unify check_for_new_probes and add to generate CN action
1 parent c6624cc commit c0351eb

4 files changed

Lines changed: 35 additions & 18 deletions

File tree

.github/workflows/check_for_new_NP_probes.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ jobs:
3232
- name: Install probeinterface and matplotlib
3333
run: pip install ./probeinterface matplotlib
3434

35-
- name: Generate full NP library
35+
- name: Generate full NP library and check for new probes
3636
run: |
3737
cd scripts/
3838
python ../probeinterface/resources/generate_neuropixels_library.py
39+
# check for new probes
40+
python check_for_new_probes.py ../imec/ ./neuropixels_library_generated/
3941
40-
# Check for any new probes
41-
- name: Run local script
42-
run: |
43-
cd scripts/
44-
python check_for_new_NP_probes.py
42+
# clean up
4543
rm -r neuropixels_library_generated/
4644
cd ..
4745
rm -r ./probeinterface

.github/workflows/generate_cambridge_neurotech_library.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ jobs:
4141
cd scripts/
4242
python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ --output-folder ./cambridge_library_generated/
4343
44+
# check for new probes
45+
python check_for_new_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/
46+
4447
# check for json changes (except probeinterface version)
4548
python check_for_json_changes_in_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ --copy-figures
4649
# clean up
@@ -70,6 +73,6 @@ jobs:
7073
uses: peter-evans/create-pull-request@v7
7174
with:
7275
title: "Update Cambridge Neurotech json files"
73-
body: "This PR updates the Neuropixel probes in probeinterace library, based on new data from the ProbeTable repository or because of a new ProbeInterface release."
76+
body: "This PR updates the Cambridge Neurotech probes in probeinterace library, based on new data from the cambridge-neurotech/probe_maps repository or because of a new ProbeInterface release."
7477
branch-suffix: short-commit-hash
7578
base: "main"

scripts/check_for_new_NP_probes.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

scripts/check_for_new_probes.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from argparse import ArgumentParser
2+
from pathlib import Path
3+
import shutil
4+
5+
6+
parser = ArgumentParser(description="Check for new probes from manufacturer")
7+
parser.add_argument(
8+
"old-dir",
9+
type=str,
10+
help="Path to the old probes directory",
11+
)
12+
parser.add_argument(
13+
"new-dir",
14+
type=str,
15+
help="Path to the new probes directory",
16+
)
17+
18+
if __name__ == "__main__":
19+
args = parser.parse_args()
20+
old_dir = Path(args.old_dir)
21+
new_dir = Path(args.new_dir)
22+
23+
existing_probes = list(probe_path.name for probe_path in old_dir.iterdir())
24+
25+
for temp_probe_path in new_dir.iterdir():
26+
if temp_probe_path.name not in existing_probes:
27+
shutil.copytree(temp_probe_path, old_dir / temp_probe_path.name)

0 commit comments

Comments
 (0)