Carry a swept variable's label and units onto the result coordinate - #34
Merged
Conversation
AI AnalysisOupsie! Looks like something went wrong on our end. |
The executor took a variable's id when it built an axis and dropped everything else, so every result coordinate arrived with an empty attrs dict. A program that declared label="Drive amplitude", units="V" had both strings sitting on the Variable and no way to reach them from the result. Each axis now carries the attributes alongside its coords, and _finalize writes them onto the matching coordinate of every field array. The keys are long_name and units, which is what xarray's own plotting accessor reads, so result.get(m0).sel(IQ="I").plot() labels its x axis rather than falling back to the variable id. A key the variable did not declare is left out instead of written as None, which xarray would render. The array's own attrs and name are untouched: a measurement has no unit the executor knows, and the y axis of a readout plot is physics. Three doc passages said otherwise and move with it: variables.md listed the executor and the result objects among the things that ignore units, rabi.md explained that the axis label had to be typed out by hand, and the array contract in measurements.md said nothing about coordinate attributes.
fedonman
force-pushed
the
result-coord-labels
branch
from
September 2, 2026 00:40
57e9b38 to
e850760
Compare
|
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.



The executor built each result axis from the swept variable's id alone, so a coordinate arrived with an empty
attrseven when the program declared a label and units. It now writes them on aslong_nameandunits, the two keys xarray's plotting reads, soresult.get(m0).sel(IQ="I").plot()labels its own x axis instead of falling back to the id. A key the variable did not declare is left out rather than written asNone, and the array's ownattrsandnameare untouched. Three doc passages that said otherwise move with it.Closes #31