Conversation
|
Hold off on merge until I fix the NRSSIntegrator on energy stacks - there's a bug there |
…includes warp_polar optimization rewrite for full broadcast, ~2-3xx faster
PyHyperScattering
|
|
Hold off on merge until I fix the NRSSIntegrator on energy stacks - there's a bug there |
…includes warp_polar optimization rewrite for full broadcast, ~2-3xx faster
PyHyperScattering
|
Unify NRSS q-coordinate semantics in PyHyperScattering
Summary
This MR adds a new
NRSSIntegratorto PyHyperScattering to handle the semantic split between:q_perp|q|The existing
WPIntegratorbehavior is intentionally preserved. It remains aqx/qy -> chi/q_perppolar remesher and is still correct for reciprocal-plane / 2D NRSS outputs.Motivation
Current NRSS outputs expose detector-plane
qx/qycoordinates. When these are reduced withWPIntegrator, the radial axis is labeled fromsqrt(qx^2 + qy^2), which is detector-planeq_perp.That is semantically fine for 2D NRSS outputs, but it is not the correct geometry-aware radial coordinate for 3D detector-aware NRSS outputs. This MR adds a dedicated reducer for NRSS-style
qx/qydata so PyHyperScattering can distinguish those cases explicitly without changing existingWPIntegratorbehavior.What Changed
New
NRSSIntegratorAdded
PyHyperScattering.NRSSIntegrator, exported throughPyHyperScattering.integrate.Behavior:
xarray.DataArrayinputs withqx/qycoordinatesWPIntegratorq_perpin 2D mode|q|in 3D modeFor 3D mode the corrected radial coordinate is computed from:
Minimal NRSS metadata contract
The reducer works with detached NRSS result arrays by using:
z_dimto distinguish 2D vs 3D semanticsphys_size_nmas a self-consistency check against the providedqx/qycoordinatesenergycoordinate for detector-aware 3D correctionphys_size_nmis not used as an alternate q source.qx/qyremain authoritative.Strict q-axis self-consistency validation
If
phys_size_nmis present,NRSSIntegratornow validates the provided 1Dqxandqyaxes against the FFT-style detector axes implied by that physical size.Default behavior is strict:
validate_q_coords_against_phys_size="raise"by default"warn"is availableFalsedisables the checkThis keeps
phys_size_nmuseful as a detached-result sanity check without creating a second source of truth for q.WPIntegratorclarificationWPIntegratorwas not changed semantically.Updates made:
q_perpradial_semantics="q_perp"in attrsqx/qyimagesTests Added
Added PyHyperScattering unit coverage for:
NRSSIntegratormatchingWPIntegratorsemanticsWPIntegratormetadata preservationphys_size_nmDocs
Updated integration docs to clarify:
WPIntegratoris aqx/qy -> chi/q_perpremesherNRSSIntegratoris the correct reducer for detector-aware 3D NRSS outputsVerification
Test command run during development:
Result:
Notes
WPIntegratorinto a geometry-aware reducer.PFGeneralIntegrator.