itasc.tracking_ultrack.track_quality

Per-track quality scoring derived from the solved Ultrack database.

Pure module (no Qt, no napari). The quality of an exported track is the sum of its nodes’ node_prob plus the sum of its selected edges’ LinkDB.weight; higher is better. Ordering by this score lets the UI relabel so ID 1 is the best track, 2 the next, and so on.

The score is keyed by the painted label value, which equals the exported track_id from ultrack.core.export.to_tracks_layer() — the same dataframe consumed in itasc.tracking_ultrack.corrections.

Functions

compute_track_scores(tracks_df, node_probs, ...)

Pure scoring core: track_id -> Σ node_prob + Σ edge weight.

quality_order(scores)

track_ids sorted by score desc, then by id asc as a stable tiebreak.

track_quality_scores(db_path, cfg)

Map exported track_id -> quality score (Σ node_prob + Σ edge weight).

itasc.tracking_ultrack.track_quality.compute_track_scores(tracks_df, node_probs, links)[source]

Pure scoring core: track_id -> Σ node_prob + Σ edge weight.

tracks_df needs id, t and track_id columns (one row per node). node_probs maps node id -> raw node_prob (None allowed). links maps a (source_id, target_id) pair -> (raw weight, annotation name); the pair is ordered earlier-frame -> later-frame, matching LinkDB.

Return type:

dict[int, float]

Parameters:
itasc.tracking_ultrack.track_quality.quality_order(scores)[source]

track_ids sorted by score desc, then by id asc as a stable tiebreak.

Return type:

list[int]

Parameters:

scores (Mapping[int, float])

itasc.tracking_ultrack.track_quality.track_quality_scores(db_path, cfg)[source]

Map exported track_id -> quality score (Σ node_prob + Σ edge weight).

Read-only over the solved database. Returns {} when the export yields no tracks (e.g. an unsolved or empty database).

Return type:

dict[int, float]

Parameters: