refactor(#298) rename AdHocDiffractometer.azimuthal_reference -> azimuth#300
Merged
Merged
Conversation
Add 'azimuth' as the canonical property name and constructor kwarg on AdHocDiffractometer. The old 'azimuthal_reference' name is retained as a forwarding alias that emits DeprecationWarning on every read, write, and constructor-kwarg use; the deprecation message names v0.12.0 and points callers at 'azimuth'. Internal storage is renamed _azimuthal_reference -> _azimuth. All in-tree call sites in src/ (reference.py, forward.py, surface.py, mode.py, benchmark.py) and their docstrings, error messages, and log text migrate to the new name; the internal helper _require_azimuthal_reference is renamed _require_azimuth. to_dict() writes the new key 'azimuth'. from_dict() accepts either 'azimuth' (new) or 'azimuthal_reference' (legacy) so sessions saved by ad_hoc_diffractometer <= v0.11.x keep loading unchanged. required_reference_vector now returns 'azimuth' instead of 'azimuthal_reference' for psi / naz reference constraints. This is the one strict behaviour change in the PR. Test suite: 118 references across nine files bulk-renamed. A new TestAzimuthDeprecation block in tests/test_diffractometer.py adds seven tests covering deprecation warnings on the property getter, setter, and constructor kwarg; alias-shares-storage; both-kwargs disagreement raises; to_dict emits the new key; from_dict reads the legacy key. Contributed by: OpenCode (argo/claudeopus47)
Update all documentation sources (glossary, concepts, surface how-to,
modes / forward / constraints how-tos, geometry pages, declarative
schema reference, and the fourcv alignment notebook) to use the new
canonical 'azimuth' attribute name in prose, code examples, recipes,
and the per-geometry Extras tables.
Add deprecation notes in three places where a user is likely to look:
- glossary.md: the 'Azimuthal reference vector' entry now mentions
the v0.11.x-and-earlier 'azimuthal_reference' name as a deprecated
forwarding alias.
- howto/surface.md (quick-reference section): a {note} admonition
after the recipe table announces the rename, the deprecation
warnings, and the required_reference_vector return-value change.
- howto/surface.md (serialization section): a one-line note that
from_dict() still accepts the legacy 'azimuthal_reference' key
for backward compatibility with saved sessions.
Contributed by: OpenCode (argo/claudeopus47)
CI on the PR flagged branch coverage 142->144 in diffractometer.py: the path where both 'azimuth' and 'azimuthal_reference' are supplied with matching values (no conflict-raise, deprecation warning emitted, azimuth already set so the fallback assignment is skipped). Add test_azimuth_and_azimuthal_reference_matching_values_accepted to cover that branch and restore 100% coverage. Contributed by: OpenCode (argo/claudeopus47)
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.
Adds
azimuthas the canonical property name and constructor kwarg onAdHocDiffractometer. The originalazimuthal_referencename is keptas a forwarding alias that emits
DeprecationWarningon every access(getter, setter, and constructor kwarg) and will be removed in a
future release.
required_reference_vectornow returns"azimuth"(was"azimuthal_reference").to_dict()writes the new key;from_dict()accepts either key for backward compatibility with saved sessions
from ad_hoc_diffractometer ≤ v0.11.x.
Internal call sites, the full test suite (118 references across nine
files bulk-renamed), and the documentation are migrated to the new
name. A new
TestAzimuthDeprecationblock adds seven tests coveringthe deprecation warnings, alias-shares-storage behavior, kwarg
conflict handling, and the legacy
to_dict/from_dictkeys.Deprecation removal is deferred to a separate future PR on a later
release line.
Contributed by: OpenCode (argo/claudeopus47)