Skip to content
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

Cross-shaped spike localizations #86

Open
b-grimaud opened this issue Nov 28, 2024 · 10 comments
Open

Cross-shaped spike localizations #86

b-grimaud opened this issue Nov 28, 2024 · 10 comments

Comments

@b-grimaud
Copy link
Contributor

When looking into the coordinates of individual spikes for a given cluster, I noticed that when plotted the coordinates all fit into a cross pattern. That is, a lot of spikes have the same x value, oddly rounded with no trailing decimals, for different y values and vice versa.

Here it is displayed for an individual cluster :

output

With the matching table, notice the x values at exactly 2640.0 and the y values at exactly 960.0.

times cluster_id x y
14 885 0 2640.000000 957.088501
23 1362 0 2635.247314 960.000000
24 1433 0 2642.525146 960.000000
89 5678 0 2640.000000 966.294067
164 7457 0 2639.830811 960.000000
... ... ... ... ...
887389 11838406 0 2640.000000 952.806824
887501 11843033 0 2638.202393 960.000000
887570 11847925 0 2631.216797 960.000000
887571 11848357 0 2631.220703 960.000000
887636 11849502 0 2640.000000 955.113098

5411 rows × 4 columns

With PlotAll in Lightning :

PlotAll

With PlotNeighbourhood :

PlotNeigh

I checked in both the saved HDF5 and directly in the spikes DataFrame, so I don't think this is an issue with saving/storing data.

I took a look into SpikeLocalizer, I'm not too familiar with C but I couldn't see anything obvious.

@b-grimaud
Copy link
Contributor Author

Small update : localizations are just fine using simulated data as specified in the demo notebook.

Here it is with SpikeInterface simulation, with the probe enlarged to 64 columns :

output_si

Here it is with data from MEArec from the ephys test data repository :

output_mearec

However, the issue shows up again when I run it on data simulated with SpikeInterface, but with the probe object loaded from an actual 3Brain recording :

output_si_accura

So this might be 3Brain-specific.

@mhhennig
Copy link
Owner

What is the channel pitch on your system (60um?)? This happens when it is larger than the radius around which the COM algorithm looks to estimate location. You can increase neighbor_radius and inner_radius. inner_radius is the important parameter, this determines how far channels can be away from the peak channel. neighbor_radius matters for removing duplicates. Does this help?

@mhhennig
Copy link
Owner

Aside, on an array with 60um or larger pitch the spatial information isn't great - it is still enough to differentiate between neurons that sit on or between channels, but the spatial signal is quite noisy.

@b-grimaud
Copy link
Contributor Author

Ran a few tests and it was indeed an issue of pitch. I looked back on older files and the localizations were OK using the legacy detection algorithm and the built-in reader.

Turns out the SpikeInterface extractor for BioCam data doesn't properly infer electrode pitch, unlike the old reader. Specifying proper pitch and size (in my case 42 and 21 µm respectively) solves the issue.

Thanks a lot !

@mhhennig
Copy link
Owner

Hmm, the extractor should work. Could you create an issue about this? What's your system? It works fine for us for a recent BioCam X.

@b-grimaud
Copy link
Contributor Author

I'll look into a bit further, we're using a BioCam Duplex with 3rd generation Accura chips.

@b-grimaud
Copy link
Contributor Author

Nevermind, looks like 3Brain updated their chip nomenclature. The chips we knew as Accura do have a pitch of 60 µm, and it is correctly listed in the probeinterface defaults. The Arena chips are the ones with a pitch of 42 µm. I'll try increasing inner_radius a bit !

@b-grimaud
Copy link
Contributor Author

So I tried a few things, and increasing inner_radius did not change anything even when raised to abnormally high values (up to 500 µm). Interestingly, arbitrarily changing the pitch to anything below 50 µm works, but as soon as it is equal or above to 50 the crosses appear again.

@mhhennig mhhennig reopened this Dec 2, 2024
@mhhennig
Copy link
Owner

mhhennig commented Dec 2, 2024

Hmm - have you also increased neighbor_radius? If this does not help I'll need to take a look!

@b-grimaud
Copy link
Contributor Author

I had tried it once but not as thoroughly. It seems to work properly when the values are both scaled appropriately, e.g. a 60 µm pitch with an inner_radius of 90 µm and a neighbor_radius of 120 µm. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants