Avoid in-memory copies when filtering memmap signals in SequenceInterpolator - #1
Draft
reneburghardt with Copilot wants to merge 1 commit into
Draft
Avoid in-memory copies when filtering memmap signals in SequenceInterpolator#1reneburghardt with Copilot wants to merge 1 commit into
reneburghardt with Copilot wants to merge 1 commit into
Conversation
…ategy Co-authored-by: reneburghardt <7131281+reneburghardt@users.noreply.github.com> Agent-Logs-Url: https://github.com/reneburghardt/experanto/sessions/51fac970-0fc7-4299-892e-120fec1c57f7
Copilot created this pull request from a session on behalf of
reneburghardt
March 26, 2026 08:41
View session
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.
Fancy-indexing a
np.memmapwith non-contiguous column indices materialises the entire selected dataset into RAM at init time, defeating the point of memory-mapping. This adds asignal_idsparameter toSequenceInterpolator(andPhaseShiftedSequenceInterpolator) with a tiered strategy to avoid that:Filtering strategies
[3,4,5,6]) → strided slice view, zero-copy, still lazy_datastays as the fullnp.memmap; sorted indices stored in_signal_ids; column filter applied insideinterpolate()after the per-query row read — the full array is never materialised.npy→ subset applied once at init (smaller allocation)Usage
Affected components
_is_contiguous_range()helper addedSequenceInterpolator.__init__: routing logic +_sorted_signal_idsattribute for subclasses to reuse without re-sortingSequenceInterpolator.normalize_init: subsetsmean/stdfor the lazy pathSequenceInterpolator.interpolate: applies_signal_idsafter row read; fixes empty-array shape to useself.n_signalsPhaseShiftedSequenceInterpolator: subsets_phase_shiftsvia_sorted_signal_ids;interpolate()uses original column indices when_signal_idsis set (required becausenp.take_along_axisdemands matching shapes, which don't hold in the lazy case)