fix(#278) warn when fixed_psi_* target is unreachable; add reference.natural_psi#283
Merged
Merged
Conversation
…natural_psi fixed_psi_* modes silently returned [] when the user-specified ψ target did not match the natural ψ for the requested reflection, leaving callers without a clue why their reflection was unreachable. Under the ψ-validation-filter design (issue #176), ψ is uniquely determined by Q_phi = UB @ (h, k, l) and the azimuthal reference — every Bragg solution of a reflection has the same ψ. No motor configuration can change it. Returning [] on a mismatched target is mathematically correct, but the silence was unhelpful. Changes: - _solve_psi_mode now emits a UserWarning that names the natural ψ and points the user at ad_hoc_diffractometer.reference.natural_psi when the target mismatches; a separate warning fires when ψ is undefined (Q parallel to reference or beam). - New public helper reference.natural_psi(geometry, h, k, l) returns the natural ψ from UB and hkl alone (None when undefined). - YAML comments above every fixed_psi* mode in psic, kappa6c, fourcv, fourch, kappa4cv, and kappa4ch clarify the validation- filter semantics. 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.
Investigation
#278's "0 solutions" symptom is mathematically correct behavior under the \u03c8-validation-filter design (issue #176): for fixed (UB, hkl), every Bragg solution has the same natural \u03c8 \u2014 uniquely determined by
Q_phi = UB @ hkland the azimuthal reference. The user asked for psi=0 on reflections whose natural \u03c8 are 90\u00b0, 107\u00b0, 180\u00b0, etc., soforward()correctly returned[]. The user's own Newton check in the issue confirmed these reflections aren't reachable at psi=0. The real defect was the silent empty list.Changes
_solve_psi_modenow emits aUserWarningthat names the natural \u03c8 and points the user atad_hoc_diffractometer.reference.natural_psiwhen the target mismatches; a separate warning fires when \u03c8 is undefined (Q parallel to reference or beam).reference.natural_psi(geometry, h, k, l)returns the natural \u03c8 from UB and hkl alone (Nonewhen undefined).fixed_psi*mode in psic, kappa6c, fourcv, fourch, kappa4cv, and kappa4ch clarify the validation-filter semantics.Recommended workflow (now possible)
QC
pytest -m slow_benchmark: 3 passedContributed by: OpenCode (argo/claudeopus47)