Skip to content

Commit

Permalink
Fraction-literals in __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
grayson-helmholz committed Nov 11, 2024
1 parent a365f9b commit 5312754
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/qrules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from __future__ import annotations

from fractions import Fraction
from itertools import product
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -73,7 +74,7 @@ def check_reaction_violations( # noqa: C901, PLR0917
mass_conservation_factor: float | None = 3.0,
particle_db: ParticleCollection | None = None,
max_angular_momentum: int = 1,
max_spin_magnitude: float = 2.0,
max_spin_magnitude: Fraction = Fraction(2, 1),
) -> set[frozenset[str]]:
"""Determine violated interaction rules for a given particle reaction.
Expand Down Expand Up @@ -207,7 +208,7 @@ def check_edge_qn_conservation() -> set[frozenset[str]]:
InteractionProperties(l_magnitude=l_magnitude, s_magnitude=s_magnitude)
for l_magnitude, s_magnitude in product(
_int_domain(0, max_angular_momentum),
_halves_domain(0, max_spin_magnitude),
_halves_domain(Fraction(0, 1), max_spin_magnitude),
)
]

Expand Down Expand Up @@ -272,7 +273,7 @@ def generate_transitions( # noqa: PLR0917
particle_db: ParticleCollection | None = None,
mass_conservation_factor: float | None = 3.0,
max_angular_momentum: int = 2,
max_spin_magnitude: float = 2.0,
max_spin_magnitude: Fraction = Fraction(2, 1),
topology_building: str = "isobar",
number_of_threads: int | None = None,
) -> ReactionInfo:
Expand Down

0 comments on commit 5312754

Please sign in to comment.