-
Notifications
You must be signed in to change notification settings - Fork 190
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
SpikeInterface Enhancement Proposal: SortingAnalyzer
object
#2282
Comments
I love the idea! Maybe the Also another subject: Would it be possible to think of a way to handle multiple filterings? |
Yes it is the plan.
This is un interresting feature. This is particularlly relevant to have raw vs processed metrics. |
To expend on that, to me the Here are the suggestions from ChatGPT, maybe it can give us some ideas?
I hope you mean "an interesting feature" and not "un-interesting feature" 😅 |
@DradeAW says:
If by Sorting you mean BaseSorting then Yes, +1 on both points. This seems like a class that can be convenient for analysis and that is lighter (in expectation) than the waveform extractor. I don't think this should or need to be tied to the output of the sorters. From the point of view of neurconv, I would opose having the proposed class as an output of From the point of view of spikeinterface it would be good for me personally to understand what are the undesirable features of the WaveformExtractor as that seems to be the driving force of this: to have a class that is useful for analysis yet simpler in some sense than the current |
I believe that the main driving force is that to create a |
@DradeAW Thanks. |
@h-mayorquin:
The last is long term but would be a game changer:
|
As someone who often uses a WaveformExtractor for things that don't touch waveforms, this makes a lot of sense. Thinking of a good name is hard. SortingAnalyzer, SpikeAnalyzer, PostsortingExtractor, PostprocesssingExtractor? |
This sounds great! Here's my name suggestion RecordingSorting or SortingRecording
|
|
I think it would be a great feature, indeed. I think I would go for a name such as RecordingSorting, as proposed by @magland . A couple of ideas also:
|
I like the names |
Yes, SortedRecording works also for me, I think this is even better |
This looks really nice, I like |
@samuelgarcia Thanks for explaining the advantages point by point to me. I hope they are useful for someone else as well! I am +1 on @khl02007 suggestion of |
This all makes sense to me. The logic is pretty sound to make the base postprocessing feature not rely on waveform extraction. And I think it will be way less confusing for the plotting functions. A couple tiny comments:
Anyway like I said, seems super cool and I think it will be useful in the end (both from the user perspective and from the schema perspective for teaching new users). |
Makes sense to me as well. I hope for easy conversion or backward compatibility of analysis run with waveform extractors. Personnally this seems like more of a type of Sorting extension than a SortedRecording, particularly since the recording is optional (and will often not be available when loading the extractor) so I prefer SpikeSortingResult or PostProcessingExtractor or SortingExtension or the like, but all is fine |
+1 to Tom's comment about the name. Seems weird to name something SortedRecording when an essential feature is that it can be recordingless. Plus correlograms, ISI histograms etc do not need or touch a recording object. |
I understand the comment, but don't fully agree. |
Also (stop me if this is too complex, but I just wanted to express the idea), coming back to @yger idea to handle the new One interesting feature would be to compute the pre-processed templates from the raw templates, rather than pre-processing each individual waveforms (which is very slow when computing the mean from 10,000 spikes). I don't know about other users, but I find myself needing a filtered template a lot of time, but not caring about the individual filtered waveforms. |
@DradeAW Graham and I work with 48h neuropixels recording for which the recording is 3.5TB, and the sorting a few GBs. We can't keep the preprocessed recording so instantiating the recording requires re-extracting and re-processing the AP (computing whitening matrix, loading motion files etc). The raw AP files live on a different drive than the sorting that may be mounted at the time of running the sorting and postprocessing, but not necessarily later on when just loading (rather than computing) the waveforms, extensions etc. More generally, considering that raw files are orders of magnitude larger than the sorting (and an order of magnitude larger than the waveforms) , and most (all?) operations rely on the spike times + waveforms rather than on the actual underlying recording, I think it makes sense in terms of data sharing and lifespan that as many operations as possible post-sorting rely only only on what's available in the sorting and postprocessing directories. That's why we prefer PostprocessingExtractor or SortingExtension or the like. |
I understand your limitations, but I don't quite understand the purpose or recording-less mode (could you enlighten me?) Loading a That said I understand that if the recording isn't going to be used, you might as well pass |
the purpose of recordingless mode is not having to do all the following
before instantiating an object to do operations which don't rely explicitly on the recording, even less so since it can use previously extracted waveforms |
Ok I get it, thanks for the clarification! Concerning the name, this is obviously opinion-based, |
Yes I see your point but in the end even the waveforms are optional, you might want to create this object just to compute some quality metrics relying only on spike times, or the cross correlograms or whatnot! To me it feels like the only things ensured are that this object will be about the sorting and about some sort of postprocessing. But yes no big deal in the end! |
Taking a step back...
It makes sense to have an object that holds both a sorting and a recording. However perhaps it would be good to separate out any methods/functions, the object should just hold data - snippets and references to the sources in this case - as do the other Extractors. Would this not increase flexibility? On one extreme prostprocessing/metrics/widgets then could check the type and be object-aware. ISI violations would accept both a sorting or the new object, while PCA metrics would expect the new object (or make one, although this may not be great as users will be confused). On the other end the new object would do everything, but that's not feasible IMO. Somewhere between is tricky as it's unclear where to draw the line. Just some thoughts, but in any case I think sorting should return a |
Hi all. You can have a look here : #2398 |
SortingAnalyzer
object
Will we leave this open forever for posterity or are we okay with closing this now since it is implemented, tested, and living its best life : ) |
héhé. |
Rationale
Since SpikeInterface v0.90, the processing of a recording + a spike sorting output started from the creation of a
WaveformExtractor
and the subsequent addition of data from the postprocessing and qualitymetrics (QM) modules asWaveformExtension
(from v0.93).While some postprocessing and QM functions need waveforms, this is not the case for all (e.g., computing correlograms, spike amplitude, ISI histograms). In addition, the
WaveformExtractor
also ended up including a bunch of additional metadata handling for storing and retrieving metadata of the recording and sorting objects, so it doesn’t only handle waveforms.With this proposal, we therefore suggest to implement a new
SpikeSortingResult
object which will only combine a recording and sorting object, define sparsity, handle the respective metadata, and implement loading and saving to multiple backends (memory, binary folders, zarr)Features
ResultExtension
living in coressr.compute(“spike_amplitude”)
orspikeinterface.postprocessing.compute_spike_amplitudes(ssr)
ssr.compute([“spike_amplitude”, “unit_location”])
API changes
Old API
This new API will be
Refactor needed
Internal:
External:
Transition plan
For a transition phase, we will need to keep a DummyWaveformExtractor that mimics the behavior of the WaveformExtractor but internally use a SpikeSortingReult
Agenda
December 2023 : first public discussion draft
January 2024 : start dev in a separate branch
February 2024 : last release 0.100.0 with WaveformExtractor
Day after the release : main go in 100_bug_fix branch and dev become main
June 2024 : release 0.101.0 with SpikeSortingResult
Advanced users : we need your feeback!
@magland @colehurwitz @mhhennig @khl02007 @h-mayorquin @zm711 @DradeAW @yger @ferchaure @bendichter @CodyCBakerPhD @JoeZiminski @TomBugnon @grahamfindlay @cwindolf @julienboussard
Let's discuss here and then we will open a project for sub tasks.
The text was updated successfully, but these errors were encountered: