FIX: correct multichannel Breit–Wigner coupling - #199
Merged
Merged
Conversation
3 tasks
redeboer
force-pushed
the
FIX/multichannel-breit-wigner
branch
from
July 17, 2026 14:48
2c24db0 to
f450c64
Compare
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.
Closes #198
✨ New features
unfold_definitions()function inampform_dpd.iothat recursively collects one representative definition per expression class. Instances of the same class are grouped, arguments that are identical across the group are retained, differing atomic arguments (such as channel-indexed symbols) use the first instance, and differing composite arguments are replaced by a symbol named after the class parameter, so thath(1)renders ash(z). This replaces the hand-written{e: e.doit(deep=False) for e in exprs}lists indocs/serialization.ipynb.ChannelArguments.widthChannelArguments.coupling_squared🐛 Bug fixes
ChannelArguments.evaluate()now returnsgsqvalue of a channel in the serialized model is the coupling squared, not an energy width, so the phase space factorSimpleBreitWigner.evaluate()uses exactsp.Iinstead of the Python float1j, so the expression stays exact for symbolic and high-precision input.❗ Behavioral changes
MultichannelBreitWignerbuilt from existinggsqvalues now evaluates to a different lineshape. Couplings that were tuned against the old expression have to be re-fitted.gsqvalues of thedocs/Lc2ppiK.jsonare updated from0.23395150538434703to0.328725260215546to match the corrected convention.docs/Lc2ppiK.jsonnow usespointinstead ofnameas the key inmisc.amplitude_model_checksums, and gains per-propagator checksums plus thevalidation_point_m12sq,validation_point_m23sq, andvalidation_point_m31sqparameter points.⚙️ Enhancements
MultichannelBreitWigner.evaluate()builds its running width withsp.Add(*self.channels)instead of summingchannel.evaluate(), so theChannelArgumentsnodes are kept unevaluated and can be unfolded separately.HelicityRecoupling,ParityRecoupling, andLSRecouplinguses\middle|instead of a bare|, so the separator scales with the surrounding brackets.ChannelArgumentsrenders asMultichannelBreitWignerrenders its channels by coupling squared.formulate_multichannel_breit_wigner()uses keyword arguments andg_squarednaming, making the coupling convention visible at the call site.🖱️ Developer experience
tests/test_dynamics.pywith reference values imported from HadronicLineshapes.jl, covering:MultichannelBreitWignerandBreitWigner;tests/test_io.pyforunfold_definitions(): recursive unfolding order, generalisation of composite arguments, preservation of channel-indexed symbols, and the no-op case..codex/is added to.gitignorealongside the existing agent-configuration entries.📝 Documentation
MultichannelBreitWignerandChannelArgumentsnow carry docstrings that spell out the lineshape formula and state explicitly that the channel argument is the coupling squared, with links to the amplitude-serialization convention, to HadronicLineshapes.jl, and to the related issues and pull requests.docs/serialization.ipynbgained the same formula and aseealsobox, and its plot is now rendered full-width.docs/serialization.ipynbthat compares every propagator against the reference values undermisc.amplitude_model_checksumsand marks the accuracy with 🟢, 🟡, and 🔴. The comparison is asserted withnp.testing.assert_allclose(), so the notebook fails on a regression.Squash commit messages