Skip to content

Cone of uncertainty: cap to shortest predBG array to match Trio #637

Closed

Description

@bjorkert

Background

The cone of uncertainty for Trio predictions is currently rendered out to the longest of the available predBG arrays (ZT, IOB, COB, UAM).

Graphs.swift (in updateOpenAPSPredictionDisplay()):

let maxLength = min(allArrays.map { $0.count }.max()!, toLoad + 1)

At indices past the end of a shorter array, that array simply stops contributing to min/max. This causes the cone to visibly "deform" at the tail — the band narrows or shifts as contributing arrays drop out one by one, which doesn't match how Trio draws its cone.

Proposal

If the goal is to be visually identical to Trio, cap the cone length at the shortest of the (up to 4) available predBG arrays:

let minLength = min(allArrays.map { $0.count }.min()!, toLoad + 1)

This way every point in the cone is computed from the same set of contributing arrays, and the band ends cleanly when the first array runs out instead of deforming.

Open questions

  • Confirm this matches Trio's actual rendering behavior.

Activity

  1. added a commit that references this issue on Jun 16, 2026
    3aeeeb0
  2. added a commit that references this issue on Jun 21, 2026
    fa31b21
  3. added a commit that references this issue on Jul 25, 2026
    4d19974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions