Open pplenck opened 5 years ago
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:
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.
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.
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.
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