Skip to content

Commit ce1f836

Browse files
authored
Merge pull request #12 from chrishalcrow/dont-update-probes-just-for-version
Dont update probes just for version
2 parents 4196ff9 + 260203a commit ce1f836

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

.github/workflows/check_for_changes_in_NP_jsons.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,22 @@ jobs:
2424
with:
2525
python-version: '3.10'
2626

27+
# we just probeinterface to get the version number
28+
- name: Install probeinterface and matplotlib
29+
run: |
30+
pip install probeinterface matplotlib
31+
PROBEINTERFACE_VERSION=$(pip show pip | grep Version | awk '{print $2}')
32+
pip uninstall probeinterface
33+
34+
2735
# Clone dev version of probeinterface
2836
- name: Clone external repository
2937
run: |
3038
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
39+
git fetch
40+
git checkout tags/$PROBEINTERFACE_VERSION
41+
pip install ./probeinterface
3142
32-
- name: Install probeinterface and matplotlib
33-
run: pip install ./probeinterface matplotlib
3443
3544
- name: Generate full NP library
3645
run: |
@@ -40,8 +49,11 @@ jobs:
4049
# Check for any new probes
4150
- name: Run local script
4251
run: |
43-
rsync -av --include='*/' --include='*.json' --exclude='*' scripts/neuropixels_library_generated/ imec/
44-
rm -r scripts/neuropixels_library_generated/
52+
cd scripts/
53+
python check_for_json_changes_in_NP_probes.py
54+
rm -r neuropixels_library_generated/
55+
cd ..
56+
4557
rm -r ./probeinterface
4658
4759
- name: Commit changes if any
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from pathlib import Path
2+
import shutil
3+
4+
old_dir = Path('../imec')
5+
new_dir = Path('./neuropixels_library_generated')
6+
7+
new_dir = Path("/Users/christopherhalcrow/Work/fromgit/probeinterface/neuropixels_library_generated")
8+
9+
for temp_probe_directory in new_dir.iterdir():
10+
11+
probe_name = str(temp_probe_directory.name)
12+
13+
temp_probe_json_path = temp_probe_directory / (probe_name + '.json')
14+
old_probe_json_path = old_dir / probe_name / (probe_name + '.json')
15+
16+
if old_probe_json_path.is_file():
17+
with open(temp_probe_json_path, 'r') as f1, open(old_probe_json_path, 'r') as f2:
18+
# Read in json files
19+
lines1 = f1.readlines()
20+
lines2 = f2.readlines()
21+
22+
# We don't want to update the probes just because of a probeinterface version update.
23+
# The probeinterface version is stored on the 3rd line of the json file, so we only
24+
# compare the json files from line 3 and down.
25+
if lines1[3:] == lines2[3:]:
26+
continue
27+
else:
28+
shutil.copy(f"{temp_probe_json_path}", f"../imec/{probe_name}")

0 commit comments

Comments
 (0)