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

creating a spike view within the analog signal view #74

Open
pplenck opened this issue Aug 8, 2019 · 4 comments
Open

creating a spike view within the analog signal view #74

pplenck opened this issue Aug 8, 2019 · 4 comments

Comments

@pplenck
Copy link

pplenck commented Aug 8, 2019

Hello
following a suggestion from Jeffrey Gill, I post the following request for anew feature in ephyviewer

the idea is to use ephyviewer to check my spikes after clustercutting, and compare results using different algorhythms available. TO do so I can just plot the filtered analog signal from the probe and overlay the spikes waveforms at the exact times they got detected.

this would look like what is seen on the peeler window in tridesclous
(https://tridesclous.readthedocs.io/en/latest/step_by_step.html, step 5)

or the phy gui trace view
(https://phy.readthedocs.io/en/latest/visualization/)

Pierre-Pascal

@jpgill86
Copy link
Collaborator

jpgill86 commented Aug 8, 2019

Thanks for posting, @pplenck. I see what you mean now. I think I misunderstood what you were looking for in #72.

You'd like to be able to plot something like this:

Capture

This is a screenshot from tridesclous's PeelerWindow. The green trace is the original signal; the pink trace is a flat line with spike waveforms pasted into it at the times when spikes were detected. Overlaying them like this is useful for determining whether or not your spike sorting is working well.

ephyviewer doesn't provide an easy way to do this automatically, but I think you could accomplish this using the tools in their current form. The way I would approach it is to manually construct a new neo.AnalogSignal from a numpy array containing the spike waveforms inserted at the correct times. Obviously this requires more proficiency with Neo and Python in general than we'd ideally like to require of users, so I can see a case for adding at least some helper functions to ephyviewer for this sort of thing.

I noticed in NeuralEnsemble/python-neo#731 that you use KlustaKwik files. I admit I don't have any experience with KlustaKwik or Neo's reader for KlustaKwik files, so I'm not sure how it imports waveforms or spike trains. If you aren't sure how to manually construct a neo.AnalogSignal, I might be able to help, but I don't have any sample KlustaKwik files to hack with. Do you have something you're willing to share? It can be small, just something for me to play around with.

@jpgill86
Copy link
Collaborator

jpgill86 commented Aug 8, 2019

P.S.: I found some Kwik files here and am playing with them now.

@jpgill86
Copy link
Collaborator

jpgill86 commented Aug 8, 2019

Hi @pplenck, here's a Jupyter notebook demonstrating the approach I might take to accomplish what you desire.

https://gist.github.com/jpgill86/c4a7bec999096771476b43f449d55c62

Since the example Kwik files I worked with were probably of fake data, the end result isn't terribly impressive, but it seems like this technique could be applied to real datasets.

It is by no stretch of the imagination as easy as I'd like for a beginner to get their spike-sorted waveforms into ephyviewer, but perhaps if you follow my example you'll have some success.

@samuelgarcia
Copy link
Collaborator

Hi @pplenck.
Having this viewer on ephyviewer is possible.
You must have 2 channel one with the signal and one with the "prediction" (flat zero+waveform).
And one one this channel could also have scatter see example/trace_viewer_with_marker.py.
But this need computing the prediction offline before the view wich could be "heavy"

A complicated solution could be to create a source that construct the prediction on the fly from spiketimes+spikewaveforms but this is more work.

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

No branches or pull requests

3 participants