fix(vectors): clear error for an out-of-range layer in normalize_alpha / dose#21
Conversation
…_alpha A layer missing from the steering vector raised a bare KeyError with no hint of which layers exist. Guard in normalize_alpha (dose() reaches it through the same path) and name both the bad layer and the available ones. Fixes bamdadd#20
|
Thanks for this — the change itself is good. The out-of-range layer now raises a clear, typed The only thing standing between this and a merge is formatting: CI's uv run ruff format .
git commit -am "style: ruff format"
git pushPush that and the checks should go green; I'll merge as soon as they do. Ping me if anything's unclear. If steerbench is useful to you, a star helps others find it and Watch will keep you posted — glad to have you contributing. |
|
Applied the one formatting step for you ( Two clean contributions in a row now — really glad to have you here. If steerbench is useful to you, a star helps others find it and Watch keeps you posted on new issues; would love more contributions whenever you're up for it. |
Problem
Requesting a layer that is not in the vector raised a bare
KeyError: 999, which doesn't tell the user which layers exist.Fix
Guard at the top of
normalize_alpha(whichdose()also goes through):Tests
normalize_alpha(vec, layer=999, ...)anddose(vec, layer=999, ...)both raise the newValueErrornaming the layer and listing available layers (2-layer vector)python -m pytest tests/test_vectors.pypasses.Fixes #20