Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3385cf2
wip: lazy load (analyzer + extensions)
alejoe91 Jun 15, 2026
121a055
todo
alejoe91 Jun 19, 2026
6fdd194
feat: move lazy logic to load only
alejoe91 Jun 24, 2026
1b82c87
Merge branch 'main' into lazy-extensions
alejoe91 Jun 24, 2026
10dfd9f
test: add tests for lazy mode
alejoe91 Jun 24, 2026
1a1e197
Merge branch 'lazy-extensions' of github.com:alejoe91/spikeinterface …
alejoe91 Jun 24, 2026
21a6a59
feat: implement ZarrSpikeVector - a memmap like lazy spike vector fo…
alejoe91 Jun 24, 2026
e1a1e75
fix: add lazy spike vector as kwarg
alejoe91 Jun 24, 2026
6187b31
Merge branch 'main' into lazy-extensions
chrishalcrow Jun 29, 2026
8e1bcf7
Merge branch 'main' into lazy-extensions
alejoe91 Jul 2, 2026
e44a9bd
fix: conflicts
alejoe91 Jul 17, 2026
66cd624
Merge branch 'lazy-extensions' of github.com:alejoe91/spikeinterface …
alejoe91 Jul 17, 2026
b710917
fix: don't copy extension data if sorting_analyzer is lazy
alejoe91 Jul 21, 2026
6fa122a
fix: save=False in compute if analyzer is lazy
alejoe91 Jul 21, 2026
09ae857
feat: add gather to zarr in node pipeline
alejoe91 Jul 21, 2026
080b17e
fix: only delete extension folders if not lazy
alejoe91 Jul 21, 2026
1b6a82c
feat: GatherToZarr and save extension data in chunks to disk
alejoe91 Jul 21, 2026
ae1b5e4
fix: solve conflicts
alejoe91 Jul 21, 2026
d7e025b
fix: conflicts
alejoe91 Jul 21, 2026
60769a5
fix: AnalyzerExtension __del__ closes all memmaps refs
alejoe91 Jul 23, 2026
84ea3ab
fix: conflicts
alejoe91 Jul 23, 2026
4ad9dab
Merge branch 'main' of github.com:SpikeInterface/spikeinterface into …
alejoe91 Jul 23, 2026
8ddf404
fix: delete extensions
alejoe91 Jul 23, 2026
8d76262
Merge branch 'main' into gather-to-zarr
alejoe91 Jul 24, 2026
619911c
fix: conflicts and simplify target bytes in gather to zarr
alejoe91 Sep 11, 2026
ac7a075
Merge branch 'main' of github.com:SpikeInterface/spikeinterface into …
alejoe91 Sep 11, 2026
46efb7d
Apply suggestion from @samuelgarcia
alejoe91 Sep 11, 2026
6511363
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2026
efeacdd
oups
alejoe91 Sep 11, 2026
e7e723a
Merge branch 'gather-to-zarr' of github.com:alejoe91/spikeinterface i…
alejoe91 Sep 11, 2026
fd294cc
refactor: folder->dest in gather functions and ensure .zarr suffix
alejoe91 Sep 16, 2026
1987324
oups
alejoe91 Sep 16, 2026
9fdc034
Merge branch 'main' of github.com:SpikeInterface/spikeinterface into …
alejoe91 Sep 16, 2026
af46c69
fix: relax decimate tests to 1e-5 tolerance (instead of 1-e6)
alejoe91 Sep 16, 2026
46eca41
Merge branch 'main' into gather-to-zarr
alejoe91 Sep 17, 2026
afc238e
fix: relax fast auto-correlogram test
alejoe91 Sep 17, 2026
ac958e0
fix: solve conflicts
alejoe91 Sep 17, 2026
5228e66
fix: delete memmap objects in tests
alejoe91 Sep 17, 2026
b225071
fix: merge _close_memmaps and self._release_data_file_handles and fix…
alejoe91 Sep 17, 2026
507f2be
fix: don't reload extension when deleting
alejoe91 Sep 17, 2026
fbd616b
fix: release memmaps for non-lazy objects
alejoe91 Sep 17, 2026
632ce6b
fix: extension data not materialized only in lazy mode
alejoe91 Sep 17, 2026
35db49f
fix: memmap/zarr Array materialization in lazy mode
alejoe91 Sep 17, 2026
b79c280
fix: declare _save_to_disk in AnalyzerExtension.__init__
alejoe91 Sep 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions src/spikeinterface/core/analyzer_extension_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1552,13 +1552,23 @@ def _set_params(self, **kwargs):
def _run(self, verbose=False, **job_kwargs):
from spikeinterface.core.node_pipeline import run_node_pipeline

# TODO: should we save directly to npy in binary_folder format / or to zarr?
# if self.sorting_analyzer.format == "binary_folder":
# gather_mode = "npy"
# extension_folder = self.sorting_analyzer.folder / "extenstions" / self.extension_name
# gather_kwargs = {"folder": extension_folder}
gather_mode = "memory"
gather_kwargs = {}
# gather results directly to the final on-disk location (one npy file / zarr dataset per
# nodepipeline variable) to avoid an extra in-memory copy. This is only done when we are
# actually saving to a disk format (see AnalyzerExtension.run()); otherwise gather in memory.
gather_to_disk = self._save_to_disk and self.format in ("binary_folder", "zarr")
if gather_to_disk:
extension_folder = self.sorting_analyzer.folder / "extensions" / self.extension_name
names = self.nodepipeline_variables
if self.format == "binary_folder":
gather_mode = "npy"
dest = [extension_folder / f"{name}.npy" for name in names]
else:
gather_mode = "zarr"
dest = [extension_folder / name for name in names]
else:
gather_mode = "memory"
dest = None
names = None

job_kwargs = fix_job_kwargs(job_kwargs)
nodes = self.get_pipeline_nodes()
Expand All @@ -1568,7 +1578,8 @@ def _run(self, verbose=False, **job_kwargs):
job_kwargs=job_kwargs,
job_name=self.extension_name,
gather_mode=gather_mode,
gather_kwargs=gather_kwargs,
dest=dest,
names=names,
verbose=False,
)
if isinstance(data, tuple):
Expand Down Expand Up @@ -1619,6 +1630,11 @@ def _get_data(self, outputs="numpy", concatenated=False, return_data_name=None,
), f"return_data_name {return_data_name} not in nodepipeline_variables {self.nodepipeline_variables}"

all_data = self.data[return_data_name]
# data gathered directly into a zarr store (e.g. by the node pipeline) is kept as a
# zarr.Array handle. On a non-lazy analyzer we materialize it to a numpy array (this mirrors
# the non-lazy load convention). A memmap is an np.ndarray subclass so it is left untouched.
if not self.sorting_analyzer._lazy and not isinstance(all_data, np.ndarray):
all_data = np.asarray(all_data)
keep_mask = None
if periods is not None:
keep_mask = select_sorting_periods_mask(
Expand Down
Loading
Loading