Repository navigation
Conversation
|
Behavior change: I changed the behavior of the Previously, an unknown parity was stored as Now with
|
|
single_state_g_parity = ingoing_edge_qns[0].g_parity # should be single_state.g_parityIn the (2, 1) case, K = lambda pid: GParityEdgeInput(isospin_magnitude=1/2, spin_magnitude=0, pid=pid)
f0 = GParityEdgeInput(isospin_magnitude=0, spin_magnitude=0, pid=9010221, g_parity=+1)
node = GParityNodeInput(l_magnitude=1, s_magnitude=0)
g_parity_conservation([f0], [K(321), K(-321)], node) # False ✓
g_parity_conservation([K(321), K(-321)], [f0], node) # True ✗ should be FalseThis only affects topologies with two initial states. |
Closes #19
✨ New features
Paritycan now represent a parity that exists but whose value is not known, through the newParity.UNKNOWNconstant. This is distinct fromNone, which still means that a parity (such as C-parity or G-parity) is not defined for a particle at all. A newParity.is_unknownproperty checks for this state.Parity.UNKNOWNbehaves consistently with known parities: negation leaves it unchanged, it survivescopy,deepcopy, andpickle, it is hashable, and itsreprisParity.UNKNOWN. It sorts betweenNoneandParity(-1), whileint(Parity.UNKNOWN)and comparisons with plain integers raise aValueErrorinstead of silently treating the unknown value as a number.{"value": "?"}. The particle validation schema accepts it, andqrules.iowritesParity.UNKNOWNin that form, so unknown parities round-trip through YAML and JSON.⚙️ Enhancements
load_pdg()now distinguishes unknown from undefined parities for both the scikit-hep and the PDG API source. A missing spatial parity becomesParity.UNKNOWN, since every particle has one. A missing C-parity or G-parity becomesParity.UNKNOWNonly if the quantum numbers show that it exists (self-conjugate particles for C, flavorless mesons with isospin for G) and staysNoneotherwise. For example,K+keepsc_parity=None, whileZ0getsparity=Parity.UNKNOWN.?.❗ Behavioral changes
Important
Particles with an unknown parity can now appear in solutions.
Previously, an unknown parity was stored as
None, whichparity_conservationtreated as a violation and which never matched an intermediate state in the solver. As a result, particles likeZ0,W±,D(s)*±, and severalXi/Omegaresonances (24 of the 542 default particles) were silently excluded from any reaction where parity conservation applies.±1), but notNone, so these particles can be selected as resonances.parity_conservation,parity_conservation_helicity,c_parity_conservation, andg_parity_conservationtreatParity.UNKNOWNas cannot be checked and let it pass instead of rejecting it. The C-parity and G-parity rules still apply the particle-antiparticle pair formulas, which do not depend on the individual parities.Nonekeeps its meaning of not defined for C-parity and G-parity.Expect additional solutions in reactions involving these particles. Both parity rules now also handle a missing spatial parity consistently: before,
parity_conservationrejectedNonewhileparity_conservation_helicityignored it. Note thatg,Z0, andH0getc_parity=Parity.UNKNOWN, although C-parity is physically not defined for the gluon and theZ0, because the particle databases do not distinguish these cases.Squash commit messages