Repository navigation
Extract margin tapering and make chunk ownership explicit - #4887
galenlynch wants to merge 1 commit into
Conversation
Keep the taper private and accept a precomputed window so phase_shift can reuse it across chunks. Add an explicit copy option to the margin helpers so in-place tapering cannot modify parent data when no cast is needed. Preserve the existing window_on_margin behavior and verify exact FFT output and parent isolation for interior and boundary chunks.
|
Thanks @galenlynch this is very nice, will review next week (and the cool FIR phase shift implementation) but wanted to ask here because I was thinking about it recently - do you think how the e.g. this can happen: (this mostly effects It would be nice to enforce a copy at the root |
get_chunk_with_margincan return a view of parent data when no padding or casting is needed. Moving tapering outside that helper therefore requires an explicit way to obtain a buffer that callers can safely modify.This extracts a private
_taper_margins(traces, window)helper and addscopy=Trueto both margin helpers.phase_shiftrequests an owned buffer and builds its raised-cosine window once per segment, reusing it across chunks. Existingwindow_on_margin=Truebehavior remains supported.Split out from #4563 because the FIR implementation no longer depends on this refactor.
Validation: six focused tests pass, including exact agreement with the legacy FFT path for int16, float32, and float64 inputs, and checks that read-only parent arrays remain untouched at interior and boundary chunks.