Avena Webapp API - v0.0.1
    Preparing search index...

    Function ingestScan

    • Converts one decoded scan into plot points and decides how it joins the buffer.

      Rules, against the previous accepted batch (state):

      • First batch, or the batch starts after the newest buffered sample: append. If it starts more than 1.5 intervals after it, a NaN gap marker goes first.
      • The batch starts at or before the newest buffered sample and its sequence and time fit the previous run's timeline (a repeated or late batch): samples already covered are skipped, newer ones (if any) appended.
      • Otherwise the timeline moved backward (a clock step, or a new run whose clock is behind): reset is set and the batch starts a new buffer.

      Parameters

      • state: ChannelStreamState | null

        State after the previous accepted batch, or null for none.

      • scan: ScanData

        Decoded Scan.

      • calibration: CalibrationSpec

        Calibration of the channel, applied to every present sample.

      • receivedAt: number

        Browser time the message arrived, Unix ms.

      Returns IngestResult

      Points, flags and the new state.