Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/check_for_changes_in_NP_jsons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,22 @@ jobs:
with:
python-version: '3.10'

# we just probeinterface to get the version number
- name: Install probeinterface and matplotlib
run: |
pip install probeinterface matplotlib
PROBEINTERFACE_VERSION=$(pip show pip | grep Version | awk '{print $2}')
pip uninstall probeinterface


# Clone dev version of probeinterface
- name: Clone external repository
run: |
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
git fetch
git checkout tags/$PROBEINTERFACE_VERSION
pip install ./probeinterface

- name: Install probeinterface and matplotlib
run: pip install ./probeinterface matplotlib

- name: Generate full NP library
run: |
Expand All @@ -40,8 +49,11 @@ jobs:
# Check for any new probes
- name: Run local script
run: |
rsync -av --include='*/' --include='*.json' --exclude='*' scripts/neuropixels_library_generated/ imec/
rm -r scripts/neuropixels_library_generated/
cd scripts/
python check_for_json_changes_in_NP_probes.py
rm -r neuropixels_library_generated/
cd ..

rm -r ./probeinterface

- name: Commit changes if any
Expand Down
28 changes: 28 additions & 0 deletions scripts/check_for_json_changes_in_NP_probes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from pathlib import Path
import shutil

old_dir = Path('../imec')
new_dir = Path('./neuropixels_library_generated')

new_dir = Path("/Users/christopherhalcrow/Work/fromgit/probeinterface/neuropixels_library_generated")

for temp_probe_directory in new_dir.iterdir():

probe_name = str(temp_probe_directory.name)

temp_probe_json_path = temp_probe_directory / (probe_name + '.json')
old_probe_json_path = old_dir / probe_name / (probe_name + '.json')

if old_probe_json_path.is_file():
with open(temp_probe_json_path, 'r') as f1, open(old_probe_json_path, 'r') as f2:
# Read in json files
lines1 = f1.readlines()
lines2 = f2.readlines()

# We don't want to update the probes just because of a probeinterface version update.
# The probeinterface version is stored on the 3rd line of the json file, so we only
# compare the json files from line 3 and down.
if lines1[3:] == lines2[3:]:
continue
else:
shutil.copy(f"{temp_probe_json_path}", f"../imec/{probe_name}")
Loading