Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4947
Spike-level quality metrics used to build full-size caches of the whole spike vector (
to_reordered_spike_vector,get_spike_vector_to_indices, plus a copy fromselect_periodswhen periods are used). So peak RAM grew with the number of spikes. This PR reads spikes and extension data in time batches (max_spikes_per_batch, default 1e6) and accumulates each metric across batches. Peak RAM is now roughly flat with recording length.amplitude_cutoff,amplitude_medianandnoise_cutofftake a newmax_spikes_per_unit(default 100_000;Noneuses all spikes). It subsamples each unit evenly in time.Behavior changes
amplitude_cutoff,amplitude_medianandnoise_cutoffchange for units above 100k spikes.noise_cutoffchanges the most: about 0.04 on values between −0.5 and −0.2.synchronynow works on lazily loaded zarr analyzers. Main returned NaN there.KeyErrorin that case.compute_drift_metrics(..., return_positions=True)now returns the per-unit bin medians.Benchmark vs main
Lazy zarr analyzer, 500 units, all non-PCA metrics, best of 3:
Metrics computed one at a time go from 2–8.7 GiB to 0.2–0.5 GiB at 6 h. Small count and window metrics get slower in absolute terms: 1.5–6 s on main, 3–17 s here.
PCA metrics are not changed. Their memory does not depend on the number of spikes, and I'll address them separately.