swev-id: astropy__astropy-14369 — CDS units: correct chained division associativity; fix ascii.cds MRT unit parsing (fixes #73)#102
Open
rowan-stein wants to merge 4 commits intoastropy__astropy-14369from
Conversation
…e parsing; add CDS/MRT tests; note PLY regen required
… parser (auto-generated files)
noa-lucent
approved these changes
Dec 18, 2025
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for regenerating the CDS parser assets. I verified the grammar changes, the regenerated parsetab matches those productions, the lexer table still exposes the punctuation tokens, and the new CDS/MRT tests cover the left-associative and leading-slash scenarios. The alias additions are minimal and targeted. Approved.
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.
This PR fixes incorrect parsing of CDS unit strings with chained division, which affected MRT files read via
ascii.cds.Summary
A/B/C/Dparses asA * B^-1 * C^-1 * D^-1(consistent with Generic and OGIP formats)./pixel/s→(pixel*s)^-1).10+3J,kpc2).Tests
10+3J/m/s/kpc2→1000 J / (kpc2 m s)10-7J/s/kpc2→1e-07 J / (kpc2 s)Implementation notes
astropy/units/format/cds.pygrammar; regenerated PLY tables (cds_lextab.py,cds_parsetab.py).pix/pixel,vox/voxel,photon) to ensure spelled-out forms parse when used with leading division.Fixes #73.
Reference: Task swev-id: astropy__astropy-14369.