Skip to content

Adapter slice buffers and gap handling in base class

Yun-Jing Huang requested to merge adapter-slice-buffers into main
  1. Audioadapter
    1. Add buffer slicing in Audioadapter, mostly borrowed from buffer slicing in _TSTransSink
      • Previously when we request a offset segment of data, the Audioadapter will first concatenate all the data in the Audioadapter, then use array slicing to select the targeted slice of data. Now the Audioadapter will first slice the buffers to the requested slice, then do concatenation. This lowered sys usage from 7-9% to 4-5%
    2. Add methods to get gap information in requested offset segment
      • Will be used in _TSTransSink
    3. add typing and fix mypy errors
  2. _TSTransSink
    1. Add skip_gaps option in AdapterConfig
      • if skip_gaps=True, the audioadapter will return a gap buffer if there are any gaps in the requested segment.
      • if skip_gaps=False (default), the audioadapter will fill gaps with zeros if there are a combination of gaps and nongaps in the requested segment.
    2. use Audioadapter() instead of deque() for self.inbufs, and use the get_sliced_buffers() method in the audioadapter to slice buffers when buffers are aligned.
      • The goal was to use just one audioadapter/deque in the _TSTransSink base class, currently there are two, one for aligning buffers, and one for handling overlap requests. But I haven't reconciled the two, thought I could do it in a separate MR? I was thinking about reconciling the two so we can also handle the fixed global buffer stride.

related to the gated-whitening MR: sgn-ligo!17 (merged)

Edited by Yun-Jing Huang

Merge request reports

Loading