Subsetting
filter_scale
filter_scale(
x: NestedScale,
frame: str,
unit: str | Sequence[str],
drop_empty_frames: bool = False,
) -> NestedScale
Keep only the atoms belonging to unit at frame.
A real subset records coverage (per weight, of the root parent),
parent_totals, parent_name, and is renamed "parent[frame:codes]".
A filter that keeps every atom is a no-op.
prune_scale
prune_scale(x: NestedScale, frame: str) -> NestedScale
Collapse to a coarser frame: frame becomes the atom layer.
Weights are summed over the collapsed atoms; the result is renamed
"name@frame". Atoms with no code at frame are dropped, and the loss
shows in coverage.