Summary
With magnetism enabled, the refl1d wrapper computes and returns only the ++ (pp) cross-section: ALL_POLARIZATIONS = False at module level, and calculate picks polarized_reflectivity[0] (src/easyreflectometry/calculators/refl1d/wrapper.py:17, 233-245); the all_polarizations=True branch raises NotImplementedError. Spin-flip and -- channels are silently dropped — a caller can mistake pp for the full polarized signal. The only magnetism test asserts the pp channel of a zero-moment sample matches the unpolarized result, so real polarization is untested.
Additionally, _get_polarized_probe constructs PolarizedNeutronQProbe via __new__ plus manual _union_cache_key = None to dodge a refl1d initialization bug (:335-338) — this will break silently on a refl1d version bump.
Suggested fix
- Short term: emit a clear warning (or document prominently) that magnetic mode yields the pp channel only.
- Medium term: implement the four-cross-section path (the
POLARIZED_ORSO_REV*.md design docs at repo root suggest this is planned) with a nonzero-moment validation test against refl1d reference output.
- Pin the refl1d version or upstream the probe-initialization fix.
Found during deep code review (DEEP_ANALYSIS.md §4.7).
Summary
With magnetism enabled, the refl1d wrapper computes and returns only the
++(pp) cross-section:ALL_POLARIZATIONS = Falseat module level, andcalculatepickspolarized_reflectivity[0](src/easyreflectometry/calculators/refl1d/wrapper.py:17, 233-245); theall_polarizations=Truebranch raisesNotImplementedError. Spin-flip and--channels are silently dropped — a caller can mistake pp for the full polarized signal. The only magnetism test asserts the pp channel of a zero-moment sample matches the unpolarized result, so real polarization is untested.Additionally,
_get_polarized_probeconstructsPolarizedNeutronQProbevia__new__plus manual_union_cache_key = Noneto dodge a refl1d initialization bug (:335-338) — this will break silently on a refl1d version bump.Suggested fix
POLARIZED_ORSO_REV*.mddesign docs at repo root suggest this is planned) with a nonzero-moment validation test against refl1d reference output.Found during deep code review (DEEP_ANALYSIS.md §4.7).