Skip to content

Introduce per-phase sample-detector displacement with flat detector#73

Open
clemisch wants to merge 3 commits into
vincefn:masterfrom
clemisch:phase_displace_ratio
Open

Introduce per-phase sample-detector displacement with flat detector#73
clemisch wants to merge 3 commits into
vincefn:masterfrom
clemisch:phase_displace_ratio

Conversation

@clemisch

@clemisch clemisch commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Introduces model for sample-detector displacement, assuming transmission geometry and a flat detector as presented in Hulbert2023.

Unlike other displacements (m2ThetaDisplacement, m2ThetaTransparency) which act only on the whole PowderPattern (i.e. all phases), this new displacement can act also per-phase. In each PowderPatternDiffraction it combines per-sample and per-phase displacement and computes resulting 2θ shift from it.

m2ThetaFlatDetDispRatio is the sample displacement, and m2ThetaPhaseFlatDetDispRatio is the per-phase displacement.

GSAS-II has something similar called LayerDisp here which allows per-phase offsets. Afaik it's currently undocumented.

Before, PowderPattern calculated delta from its displacement, and phase
calculated delta from per-phase displacement, then the deltas were added.

Physically this doesn't make sense. Displacements should be added and
delta computed from combined (physical) displacement.

This is implemented in this commit.
after last commit the function CalcFlatDetDispShift had only one call site
so we might as well inline it
@clemisch

clemisch commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

I did notice a wrinkle which originates from allowing displacement on both sample and phase and combining them inside the phase:

I have a non-zero m2ThetaFlatDetDispRatio on the sample, none on the phase. So I compute the reflections 2θ positions via PowderPattern.X2XCorr (manually for e.g. a plot), but the displacement m2ThetaFlatDetDispRatio is not taken into account and the reflections are wrong.

This is confusing but by design: we can't compute 2θ shifts from sample and phase displacement independently and then combine them, because they don't combine linearly. We have to compute the effective displacement sample+phase and then compute 2θ shifts. And that we can only do in PowderPatternDiffraction.X2XCorrPhase, i.e. per-phase.

For refinement this is no problem because it happens behind the scenes. But it makes manual computation like above more complicated. See e.g. https://gitlab.esrf.fr/cschmid/xrdmap/-/commit/a806b05049ff2931719babff0b6b8fcabf810cac.

I still want to have per-phase offsets, but I can see this confusion is a strong argument against it.

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.

1 participant