cortex-lab / cortex-lab/phy

Best channel does not have the largest amplitude for its waveform template?

Open
#1,187 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: data type: bug
Dominant language
Python
Stars
430
Forks
187
Avg merge
2h 31m
Merged PRs (30d)
2

Description

Hi, I am using phy to curate Kilosort's output. I noticed that the best channel in cluster_info.tsv doesn't always match the channel that has the largest amplitude for its template.

In this example data, the templates.npy has a shape of (214, 82, 955). To my understanding, it is (cluster_id, sample_points, channel_id). When I read out all of the 32 templates for cluster 211 from this numpy file, and find the channel that has the largest amplitude, the result is 434. But, in the cluster_info.tsv, the best channel for cluster 211 is 279.

My way of finding the best channel is using np.argmax(np.ptp(templates[cid], axis=0)) to get the channel index that has the max peak to peak value in the templates (cid is the cluster id. I found the amplitudes are 0.26653442 for channel 434 and 0.22730131 for channel 279. Channel 434 has a larger amplitude. Also, the amplitude that has been written into the tsv for channel 279 is 0.23039028. No split or merge to this cluster.

I am doing anything wrong or is this a bug in phy? I need a correct channel location for my experiment data. I've attached screenshots of cluster_info.tsv (figure 1) and the 32 templates in cluster 211 (figure 2). Also attached a csv of the templates. Please let me know if you have any questions or comments.

Thank you!

Screenshot from 2022-12-12 18-12-48
Screenshot from 2022-12-12 18-09-29
cluster211_templates.csv

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the comparison between cluster_info.tsv and templates.npy for cluster 211, using the reported NumPy peak-to-peak calculation and attached CSV. Trace how the best channel and amplitude are produced, then establish whether the discrepancy is expected or a bug and verify the result against the example data.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.