Skip to content

Commit

Permalink
FIX: modify isospin in create_particle() (#216)
Browse files Browse the repository at this point in the history
* MAINT: test if `isospin` is correctly modified
  • Loading branch information
redeboer committed Apr 6, 2023
1 parent 68fa240 commit 09c7fd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/qrules/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,7 @@ def create_particle( # pylint: disable=too-many-arguments,too-many-locals
if tau_lepton_number
else template_particle.tau_lepton_number
),
isospin=(
template_particle.isospin if isospin is None else template_particle.isospin
),
isospin=template_particle.isospin if isospin is None else isospin,
parity=template_particle.parity if parity is None else Parity(parity),
c_parity=template_particle.c_parity if c_parity is None else Parity(c_parity),
g_parity=template_particle.g_parity if g_parity is None else Parity(g_parity),
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,22 @@ def test_create_particle(particle_database: ParticleCollection, particle_name: s
assert new_particle.strangeness == template_particle.strangeness


def test_create_particle_isospin():
template_particle = Particle(
name="some particle",
pid=0,
spin=0,
mass=3.14,
)
new_isospin = Spin(0, 0)
new_particle = create_particle(
template_particle,
isospin=new_isospin,
)
assert template_particle.isospin != new_isospin
assert new_particle.isospin == new_isospin


def test_get_name_root(particle_database: ParticleCollection):
name_roots = {_get_name_root(p.name) for p in particle_database}
assert name_roots == {
Expand Down

0 comments on commit 09c7fd2

Please sign in to comment.