Carry the steradian in the name, not only in the unit - #30
Merged
Conversation
A volumetric emission rate resolved into direction is m^-3.s^-1.sr^-1, and no segment, qualifier or operator meant per unit solid angle. Every candidate spelling raised UnknownBaseTokenError, so the only name that parsed was the one that discarded the steradian and left the unit string as the sole place the per-solid-angle character survived. Register per_solid_angle as a dimension-transforming unary_postfix operator. Postfix because the division reads after the quantity it divides, as it does in physics prose, and it renders hard_xray_source_rate_per_solid_angle directly. One operator token serves every emitted quantity, where a base would need one entry per species: source_rate, radiance and energy_source_rate all take it and all round-trip. dimension_transforming suppresses the base-implies-unit inference, which is invalid once sr^-1 joins the unit. The token is deliberately NOT a base. source_rate is already registered, so a source_rate_per_solid_angle base would be the compound-base shape the irreducibility rule forbids; the mass_flow_rate precedent turned on flow_rate being unregistered, which does not hold here. per_steradian joins the advisory aliases so a retry that names the unit rather than the quantity is offered the registered spelling. Operators go from 50 to 51 and the generated grammar modules move with them. Physical bases stay at 176, the closed base vocabulary stays at 211 tokens, and the base-kind digest is unchanged, because nothing entered the base registry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
per_solid_angleas a dimension-transforming unary postfix operator, so a quantity resolved per unit solid angle (e.g.hard_xray_source_rate_per_solid_angle) carries the steradian in the name rather than only in the unit string.source_rate,radiance,energy_source_rate, …) without adding a compound base, keeping the closed base vocabulary irreducible.per_steradianto the advisory aliases so a candidate spelling that names the unit is redirected to the registered operator spelling.Test plan
uv run pytest tests/grammar/test_solid_angle_normalization.py tests/grammar/test_advisory_alias_contract.py