Skip to content

refactor: safe configuration resolution and shared RSM geometry (1/4) - #136

Open
pecomyint wants to merge 1 commit into
mainfrom
rsm/01-config-geometry
Open

refactor: safe configuration resolution and shared RSM geometry (1/4)#136
pecomyint wants to merge 1 commit into
mainfrom
rsm/01-config-geometry

Conversation

@pecomyint

Copy link
Copy Markdown
Collaborator

Stack 1 of 4. Base main. No beam time required.

Behavior-preserving groundwork. Six-axis Q is bit-identical across the offline, HPC and area-detector paths; the point is to make the next three PRs safe, not to change results.

What this adds

Raw vs effective configuration. IOC_RSM_PARAMETER becomes the canonical geometry section and generates an effective [HKL] mapping in memory. Hand-authored [HKL] on disk is never rewritten and unknown groups survive, so adopting the canonical section is reversible.

Snapshot / CAS persistence. DbProfileConfigSource.save and TomlConfigSource.save both did a shallow existing.update(), so saving one section replaced it wholesale, and the read-modify-write was unguarded — two editors meant last-writer-wins with no warning. Now: load_snapshot() / replace_if_revision() with conflict detection.

One geometry model. RotationAxis / DetectorModel / RSMGeometry and a single build_hxrd, replacing four near-duplicate QConversion + HXRD + init_area sites. Ang2Q.area is called with an explicit deg=True.

Validated SAMPLE_ORIENTATION. Checked against the xrayutilities docstring rather than assumed:

  • 'det' requires an innermost detector rotation not parallel to the primary beam, and correctly falls through a final beam-axis rotation (which 'det' ignores) — this is what keeps PR 3's detrot continuous.
  • 'sam' warns that it is only physically correct when the innermost sample circle is the azimuth motor. That is a constraint on which motor, not a structural check.
  • An orientation collinear with the primary beam is rejected. xrayutilities otherwise silently substitutes a different z-axis — exactly the class of quiet wrong-physics this stack exists to remove. 'det' is the xu default, so this governs every existing profile.

Verification

Full unit suite green, ruff check src/dashpva/ clean, legacy profiles resolve unchanged, and the existing bit-identical-Q test guards the refactor.

Review notes

Merge with a merge commit, not a squash — PRs 2–4 stack on this.

@pecomyint
pecomyint requested a review from Osayi-ANL August 12, 2026 04:21

@Osayi-ANL Osayi-ANL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see a problem with this commit

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.

2 participants