Skip to content

refactor(#298) rename AdHocDiffractometer.azimuthal_reference -> azimuth#300

Merged
prjemian merged 3 commits into
mainfrom
298-rename-azimuthal-reference-to-azimuth
Jun 15, 2026
Merged

refactor(#298) rename AdHocDiffractometer.azimuthal_reference -> azimuth#300
prjemian merged 3 commits into
mainfrom
298-rename-azimuthal-reference-to-azimuth

Conversation

@prjemian

Copy link
Copy Markdown
Collaborator

Adds azimuth as the canonical property name and constructor kwarg on
AdHocDiffractometer. The original azimuthal_reference name is kept
as a forwarding alias that emits DeprecationWarning on every access
(getter, setter, and constructor kwarg) and will be removed in a
future release.

required_reference_vector now 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 TestAzimuthDeprecation block adds seven tests covering
the deprecation warnings, alias-shares-storage behavior, kwarg
conflict handling, and the legacy to_dict / from_dict keys.

Deprecation removal is deferred to a separate future PR on a later
release line.

Contributed by: OpenCode (argo/claudeopus47)

prjemian added 3 commits June 15, 2026 18:12
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)
@prjemian prjemian merged commit a7109f6 into main Jun 15, 2026
7 checks passed
@prjemian prjemian deleted the 298-rename-azimuthal-reference-to-azimuth branch June 15, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API: rename AdHocDiffractometer.azimuthal_reference to azimuth

1 participant