Skip to content

Use ProbeTable to generate NP probes information #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions .github/workflows/copy_probe_features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Sync probe_features from ProbeTable

on:
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
workflow_dispatch:

jobs:
copy-file:
runs-on: ubuntu-latest

steps:
- name: Checkout current repository
uses: actions/checkout@v4

- name: Copy file from external repo
run: |
# Download the file directly
curl -o src/probeinterface/resources/probe_features.json \
https://raw.githubusercontent.com/billkarsh/ProbeTable/refs/heads/main/Tables/probe_features.json

- name: Commit changes if any
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

git add src/probeinterface/resources/probe_features.json

# Only commit if there are changes
git diff --staged --quiet || git commit -m "Update probe_features from ProbeTable"
git push
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ tests/*.prb
tests/*.json
tests/*/*.prb

*.json
*.prb
tests/*/*.json
tests/*/*.tsv
Expand Down
21 changes: 10 additions & 11 deletions resources/generate_neuropixels_library.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import shutil
from pathlib import Path

import json

import numpy as np
import matplotlib.pyplot as plt

from probeinterface.neuropixels_tools import npx_descriptions, probe_part_number_to_probe_type, _make_npx_probe_from_description
from probeinterface.neuropixels_tools import make_npx_description, _make_npx_probe_from_description
from probeinterface.plotting import plot_probe
from probeinterface import write_probeinterface

Expand All @@ -18,24 +20,24 @@ def generate_all_npx():
# if not base_folder.exists():
base_folder.mkdir(exist_ok=True)

probe_features_filepath = Path(__file__).absolute().parent / Path("../src/probeinterface/resources/probe_features.json")
probe_features = json.load(open(probe_features_filepath, "r"))
probe_part_numbers = probe_features['neuropixels_probes'].keys()


for probe_number, probe_type in probe_part_number_to_probe_type.items():
for probe_number in probe_part_numbers:

if probe_number is None:
continue

if probe_number == "1110":
if probe_number == "NP1110":
# the formula by the imrow table is wrong and more complicated
continue

probe_folder = base_folder / probe_number
probe_folder.mkdir(exist_ok=True)

print(probe_number, probe_type)

probe_description = npx_descriptions[probe_type]


probe_description = make_npx_description(probe_number)

num_shank = probe_description["shank_number"]
contact_per_shank = probe_description["ncols_per_shank"] * probe_description["nrows_per_shank"]
Expand Down Expand Up @@ -99,8 +101,5 @@ def generate_all_npx():






if __name__ == "__main__":
generate_all_npx()
Loading