From 676911a1db3053848bcf968ffa30fa3d02242beb Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 10:56:42 +0100 Subject: [PATCH 1/7] debug --- .github/workflows/generate_cambridge_neurotech_library.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index 2089d57..bed1297 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -29,6 +29,7 @@ jobs: run: | # probeinterface git clone https://github.com/spikeinterface/probeinterface ./probeinterface + ls probeinterface/resources # cambridge neurotech probe maps git clone https://github.com/cambridge-neurotech/probe_maps.git ./probe_maps @@ -38,7 +39,11 @@ jobs: - name: Generate full cambridge library and check for changes run: | + pwd + ls cd scripts/ + pwd + ls python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ ./cambridge_library_generated/ # check for json changes (except probeinterface version) From 1e7fb1d100bfd9374f99a71753a6f03fbc5dc4ed Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 11:20:06 +0100 Subject: [PATCH 2/7] Add dependencies --- .../workflows/generate_cambridge_neurotech_library.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index bed1297..e03faca 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -34,16 +34,12 @@ jobs: # cambridge neurotech probe maps git clone https://github.com/cambridge-neurotech/probe_maps.git ./probe_maps - - name: Install probeinterface and matplotlib - run: pip install ./probeinterface matplotlib + - name: Install probeinterface and dependencies + run: pip install ./probeinterface matplotlib pandas shapely openpyxl - name: Generate full cambridge library and check for changes run: | - pwd - ls cd scripts/ - pwd - ls python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ ./cambridge_library_generated/ # check for json changes (except probeinterface version) From 1d7ce2c4aa08a4fe436ee08b8038ff9caeaf19cd Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 11:21:03 +0100 Subject: [PATCH 3/7] Add dependencies 2 --- .github/workflows/generate_cambridge_neurotech_library.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index e03faca..91676e2 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -35,7 +35,7 @@ jobs: git clone https://github.com/cambridge-neurotech/probe_maps.git ./probe_maps - name: Install probeinterface and dependencies - run: pip install ./probeinterface matplotlib pandas shapely openpyxl + run: pip install ./probeinterface matplotlib pandas shapely openpyxl tqdm - name: Generate full cambridge library and check for changes run: | From 0b7bf22f6d886b227f84a86ef4d8128c2c14cc06 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 11:22:23 +0100 Subject: [PATCH 4/7] Fix args --- .github/workflows/generate_cambridge_neurotech_library.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index 91676e2..066ee5a 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -40,7 +40,7 @@ jobs: - name: Generate full cambridge library and check for changes run: | cd scripts/ - python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ ./cambridge_library_generated/ + python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ --output-folder ./cambridge_library_generated/ # check for json changes (except probeinterface version) python check_for_json_changes_in_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ From c6624cc81d1f89e3b280f28dfb0833137587d530 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 11:54:11 +0100 Subject: [PATCH 5/7] Fix script --- .../generate_cambridge_neurotech_library.yml | 5 ++--- scripts/check_for_json_changes_in_probes.py | 14 +++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index 066ee5a..fa29e4f 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -29,7 +29,6 @@ jobs: run: | # probeinterface git clone https://github.com/spikeinterface/probeinterface ./probeinterface - ls probeinterface/resources # cambridge neurotech probe maps git clone https://github.com/cambridge-neurotech/probe_maps.git ./probe_maps @@ -43,7 +42,7 @@ jobs: python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ --output-folder ./cambridge_library_generated/ # check for json changes (except probeinterface version) - python check_for_json_changes_in_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ + python check_for_json_changes_in_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ --copy-figures # clean up rm -r cambridge_library_generated/ cd .. @@ -62,7 +61,7 @@ jobs: echo "No changes to commit" echo "changes=false" >> $GITHUB_OUTPUT else - git commit -m "Update json files for NP probes" + git commit -m "Update json files for cambridge neurotech probes" echo "changes=true" >> $GITHUB_OUTPUT fi diff --git a/scripts/check_for_json_changes_in_probes.py b/scripts/check_for_json_changes_in_probes.py index e0eb4b0..dee4c1c 100644 --- a/scripts/check_for_json_changes_in_probes.py +++ b/scripts/check_for_json_changes_in_probes.py @@ -17,6 +17,12 @@ help="Path to the new probes directory", ) +parser.add_argument( + "--copy-figures", + action="store_true", + help="If set, copies figures as well when JSON files are different.", +) + if __name__ == "__main__": args = parser.parse_args() @@ -40,5 +46,11 @@ if lines1[3:] == lines2[3:]: continue else: - shutil.copy(f"{temp_probe_json_path}", f"../imec/{probe_name}") + shutil.copy(f"{temp_probe_json_path}", old_dir / probe_name) + if args.copy_figures: + temp_figure_path = temp_probe_directory / (probe_name + '.png') + shutil.copy(f"{temp_figure_path}", old_dir / probe_name) + + + \ No newline at end of file From c0351eb18b6bfa539c0c2f862d1b1149699e5fbc Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 12:17:07 +0100 Subject: [PATCH 6/7] Unify check_for_new_probes and add to generate CN action --- .github/workflows/check_for_new_NP_probes.yml | 10 +++---- .../generate_cambridge_neurotech_library.yml | 5 +++- scripts/check_for_new_NP_probes.py | 11 -------- scripts/check_for_new_probes.py | 27 +++++++++++++++++++ 4 files changed, 35 insertions(+), 18 deletions(-) delete mode 100644 scripts/check_for_new_NP_probes.py create mode 100644 scripts/check_for_new_probes.py diff --git a/.github/workflows/check_for_new_NP_probes.yml b/.github/workflows/check_for_new_NP_probes.yml index 77f3440..ddd8a75 100644 --- a/.github/workflows/check_for_new_NP_probes.yml +++ b/.github/workflows/check_for_new_NP_probes.yml @@ -32,16 +32,14 @@ jobs: - name: Install probeinterface and matplotlib run: pip install ./probeinterface matplotlib - - name: Generate full NP library + - name: Generate full NP library and check for new probes run: | cd scripts/ python ../probeinterface/resources/generate_neuropixels_library.py + # check for new probes + python check_for_new_probes.py ../imec/ ./neuropixels_library_generated/ - # Check for any new probes - - name: Run local script - run: | - cd scripts/ - python check_for_new_NP_probes.py + # clean up rm -r neuropixels_library_generated/ cd .. rm -r ./probeinterface diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index fa29e4f..882c590 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -41,6 +41,9 @@ jobs: cd scripts/ python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ --output-folder ./cambridge_library_generated/ + # check for new probes + python check_for_new_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ + # check for json changes (except probeinterface version) python check_for_json_changes_in_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ --copy-figures # clean up @@ -70,6 +73,6 @@ jobs: uses: peter-evans/create-pull-request@v7 with: title: "Update Cambridge Neurotech json files" - 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." + 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." branch-suffix: short-commit-hash base: "main" diff --git a/scripts/check_for_new_NP_probes.py b/scripts/check_for_new_NP_probes.py deleted file mode 100644 index 11c2cb2..0000000 --- a/scripts/check_for_new_NP_probes.py +++ /dev/null @@ -1,11 +0,0 @@ -from pathlib import Path -import shutil - -old_dir = Path('../imec') -new_dir = Path('./neuropixels_library_generated') - -existing_probes = list(probe_path.name for probe_path in old_dir.iterdir()) - -for temp_probe_path in new_dir.iterdir(): - if temp_probe_path.name not in existing_probes: - shutil.copytree(f"{temp_probe_path}", f"../imec/{temp_probe_path.name}") \ No newline at end of file diff --git a/scripts/check_for_new_probes.py b/scripts/check_for_new_probes.py new file mode 100644 index 0000000..490f6af --- /dev/null +++ b/scripts/check_for_new_probes.py @@ -0,0 +1,27 @@ +from argparse import ArgumentParser +from pathlib import Path +import shutil + + +parser = ArgumentParser(description="Check for new probes from manufacturer") +parser.add_argument( + "old-dir", + type=str, + help="Path to the old probes directory", +) +parser.add_argument( + "new-dir", + type=str, + help="Path to the new probes directory", +) + +if __name__ == "__main__": + args = parser.parse_args() + old_dir = Path(args.old_dir) + new_dir = Path(args.new_dir) + + existing_probes = list(probe_path.name for probe_path in old_dir.iterdir()) + + for temp_probe_path in new_dir.iterdir(): + if temp_probe_path.name not in existing_probes: + shutil.copytree(temp_probe_path, old_dir / temp_probe_path.name) \ No newline at end of file From 55aaa4fa629d9fc2b7919ec5f27db15448ddfdb8 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 18 Dec 2025 16:14:52 +0100 Subject: [PATCH 7/7] Fix check new probes script --- scripts/check_for_new_probes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_for_new_probes.py b/scripts/check_for_new_probes.py index 490f6af..44830af 100644 --- a/scripts/check_for_new_probes.py +++ b/scripts/check_for_new_probes.py @@ -5,12 +5,12 @@ parser = ArgumentParser(description="Check for new probes from manufacturer") parser.add_argument( - "old-dir", + "old_dir", type=str, help="Path to the old probes directory", ) parser.add_argument( - "new-dir", + "new_dir", type=str, help="Path to the new probes directory", )