Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ updates:
labels: [⬆️ Lock]
multi-ecosystem-group: lock
patterns: ["*"]
- package-ecosystem: pre-commit
directory: "/"
labels: [⬆️ Lock]
multi-ecosystem-group: lock
patterns: ["*"]
- package-ecosystem: uv
directory: "/"
labels: [⬆️ Lock]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-slim
steps:
- uses: release-drafter/release-drafter@v6
- uses: release-drafter/release-drafter@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.8.7
rev: 0.8.9
hooks:
- id: check-dev-files
args:
Expand Down Expand Up @@ -57,7 +57,7 @@ repos:
metadata.vscode

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.2
rev: v0.15.10
hooks:
- id: ruff-check
args: [--fix]
Expand Down Expand Up @@ -91,19 +91,20 @@ repos:
- id: taplo-format

- repo: https://github.com/pappasam/toml-sort
rev: v0.24.3
rev: v0.24.4
hooks:
- id: toml-sort
args:
- --in-place

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v9.7.0
rev: v10.0.0
hooks:
- id: cspell
language_version: 25.9.0

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.6.0
rev: 3.6.1
hooks:
- id: editorconfig-checker
name: editorconfig
Expand All @@ -124,6 +125,6 @@ repos:
types_or: [python, pyi, jupyter]

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.5
rev: 0.11.6
hooks:
- id: uv-lock
10 changes: 4 additions & 6 deletions docs/jpsi2ksp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"# J/ψ → K⁰ Σ⁺ p̅\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
]
},
Expand Down Expand Up @@ -337,7 +338,7 @@
" f\"sigma{i}\": X,\n",
" f\"sigma{j}\": Y,\n",
"}\n",
"dalitz_data.update(data_transformer(dalitz_data))"
"dalitz_data.update(data_transformer(dalitz_data)) # ty:ignore[no-matching-overload]"
]
},
{
Expand Down Expand Up @@ -482,10 +483,7 @@
") -> jnp.ndarray:\n",
" original_parameters = dict(func.parameters)\n",
" zero_parameters = {\n",
" k: 0\n",
" for k, v in func.parameters.items()\n",
" if R\"\\mathcal{H}\" in k\n",
" if resonance_latex not in k\n",
" k: 0 for k in func.parameters if R\"\\mathcal{H}\" in k if resonance_latex not in k\n",
" }\n",
" func.update_parameters(zero_parameters)\n",
" intensities = func(phsp)\n",
Expand Down Expand Up @@ -555,7 +553,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.9"
"version": "3.13.13"
}
},
"nbformat": 4,
Expand Down
10 changes: 4 additions & 6 deletions docs/xib2pkk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"# Ξ<sub>b</sub>⁻ → p K⁻ K⁻\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
]
},
Expand Down Expand Up @@ -364,7 +365,7 @@
" f\"sigma{i}\": X,\n",
" f\"sigma{j}\": Y,\n",
"}\n",
"dalitz_data.update(data_transformer(dalitz_data))"
"dalitz_data.update(data_transformer(dalitz_data)) # ty:ignore[no-matching-overload]"
]
},
{
Expand Down Expand Up @@ -507,10 +508,7 @@
") -> jnp.ndarray:\n",
" original_parameters = dict(func.parameters)\n",
" zero_parameters = {\n",
" k: 0\n",
" for k, v in func.parameters.items()\n",
" if R\"\\mathcal{H}\" in k\n",
" if resonance_latex not in k\n",
" k: 0 for k in func.parameters if R\"\\mathcal{H}\" in k if resonance_latex not in k\n",
" }\n",
" func.update_parameters(zero_parameters)\n",
" intensities = func(phsp)\n",
Expand Down Expand Up @@ -565,7 +563,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.9"
"version": "3.13.13"
}
},
"nbformat": 4,
Expand Down
18 changes: 9 additions & 9 deletions src/ampform_dpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def formulate(
for args in product(*allowed_helicities.values()):
for sub_system in subsystem_ids:
chain_model = self.formulate_subsystem_amplitude(
*args,
*args, # ty:ignore[invalid-argument-type]
sub_system, # ty:ignore[too-many-positional-arguments]
use_coefficients=use_coefficients,
)
Expand Down Expand Up @@ -167,7 +167,7 @@ def formulate(
),
amplitudes=amplitude_definitions,
variables=angle_definitions,
parameter_defaults=parameter_defaults, # ty:ignore[invalid-argument-type]
parameter_defaults=parameter_defaults,
masses=masses,
invariants=formulate_invariants(self.decay),
)
Expand Down Expand Up @@ -255,7 +255,7 @@ def formulate_subsystem_amplitude( # noqa: PLR0914
intensity=sp.Abs(amp_symbol) ** 2,
amplitudes={amp_symbol: amplitude_sum.expression},
variables=amplitude_sum.subexpressions | {θij: θij_expr},
parameter_defaults=amplitude_sum.parameters, # ty:ignore[invalid-argument-type]
parameter_defaults=amplitude_sum.parameters,
)

def formulate_aligned_amplitude(
Expand Down Expand Up @@ -506,20 +506,20 @@ def wrapper(self: DefinedExpression, other):

@define
class DefinedExpression:
expression: sp.Expr = field(converter=sp.sympify, default=sp.S.One)
expression: sp.Expr = field(converter=sp.sympify, default=sp.S.One) # ty:ignore[invalid-assignment]
parameters: dict[sp.Basic, complex | float] = field(factory=dict)
subexpressions: dict[sp.Basic, sp.Expr] = field(factory=dict)

@_binary_operation(operator.mul)
def __mul__(self, other) -> DefinedExpression: ... # type:ignore[empty-body]
def __mul__(self, other) -> DefinedExpression: ... # ty:ignore[empty-body]
@_binary_operation(operator.add)
def __add__(self, other) -> DefinedExpression: ... # type:ignore[empty-body]
def __add__(self, other) -> DefinedExpression: ... # ty:ignore[empty-body]
@_binary_operation(operator.sub)
def __sub__(self, other) -> DefinedExpression: ... # type:ignore[empty-body]
def __sub__(self, other) -> DefinedExpression: ... # ty:ignore[empty-body]
@_binary_operation(operator.truediv)
def __truediv__(self, other) -> DefinedExpression: ... # type:ignore[empty-body]
def __truediv__(self, other) -> DefinedExpression: ... # ty:ignore[empty-body]
@_binary_operation(operator.pow)
def __pow__(self, other) -> DefinedExpression: ... # type:ignore[empty-body]
def __pow__(self, other) -> DefinedExpression: ... # ty:ignore[empty-body]


DynamicsBuilder = Callable[[ThreeBodyDecayChain], DefinedExpression]
Expand Down
2 changes: 1 addition & 1 deletion src/ampform_dpd/_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def to_ls(obj: LSCoupling | tuple[int, SupportsFloat] | None) -> LSCoupling | No
return obj
if isinstance(obj, tuple):
L, S = obj
return LSCoupling(L, S) # ty:ignore[invalid-argument-type]
return LSCoupling(L, S)
msg = f"Cannot convert {type(obj).__name__} to {LSCoupling.__name__}"
raise TypeError(msg)

Expand Down
12 changes: 6 additions & 6 deletions src/ampform_dpd/adapter/qrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ def _convert_transition(
if index in transition.intermediate_states
else _to_state(state, index=index)
for index, state in transition.states.items()
}, # ty:ignore[invalid-argument-type]
},
interactions={
i: _to_ls_coupling(interaction)
for i, interaction in transition.interactions.items()
}, # ty:ignore[invalid-argument-type]
},
)


Expand All @@ -142,7 +142,7 @@ def _to_particle(
return Particle(
name=particle.name,
latex=particle.name if particle.latex is None else particle.latex,
spin=particle.spin, # ty:ignore[invalid-argument-type]
spin=particle.spin,
parity=int(particle.parity), # ty:ignore[invalid-argument-type]
mass=particle.mass,
width=particle.width,
Expand Down Expand Up @@ -238,7 +238,7 @@ def filter_min_ls(
else transition0.interactions[i]
)
for i in transition0.interactions
}, # ty:ignore[invalid-argument-type]
},
)
min_transitions.append(min_transition)
return tuple(min_transitions)
Expand Down Expand Up @@ -280,7 +280,7 @@ def _impl_normalize_state_ids(obj) -> NoReturn:
def _(obj: ReactionInfo) -> ReactionInfo:
return ReactionInfo(
# no attrs.evolve() in order to call __attrs_post_init__()
transitions=[_impl_normalize_state_ids(g) for g in obj.transitions], # ty:ignore[invalid-argument-type]
transitions=[_impl_normalize_state_ids(g) for g in obj.transitions],
formalism=obj.formalism,
)

Expand Down Expand Up @@ -353,7 +353,7 @@ def _impl_permute_equal_final_states(obj) -> NoReturn:
@_impl_permute_equal_final_states.register(ReactionInfo)
def _(obj: ReactionInfo) -> ReactionInfo:
return ReactionInfo(
transitions=permute_equal_final_states(obj.transitions), # ty:ignore[invalid-argument-type]
transitions=permute_equal_final_states(obj.transitions),
formalism=obj.formalism,
)

Expand Down
4 changes: 2 additions & 2 deletions src/ampform_dpd/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_subsystem(self, subsystem_id: FinalStateID) -> ThreeBodyDecay:
subsystems = ", ".join(sorted(str(i) for i in _get_subsystem_ids(self)))
msg = f"Decay {decay_description} only has subsystems {subsystems}, not {subsystem_id}"
warn(msg, category=UserWarning)
return ThreeBodyDecay(self.states, filtered_chains) # ty:ignore[invalid-argument-type]
return ThreeBodyDecay(self.states, filtered_chains)


def _get_decay_description(decay: ThreeBodyDecay) -> str:
Expand Down Expand Up @@ -206,7 +206,7 @@ def spectator(self) -> FinalState:
def _get_child_of_type(self, typ: type[T]) -> T:
for child in self.decay.children:
if isinstance(child, typ):
return child # ty:ignore[invalid-return-type]
return child
msg = f"The production node does not have any children that are of type {typ.__name__}"
raise ValueError(msg)

Expand Down
6 changes: 3 additions & 3 deletions src/ampform_dpd/dynamics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RelativisticBreitWigner(sp.Expr):
meson_radius: Any
phsp_factor: PhaseSpaceFactorProtocol = argument(
default=PhaseSpaceFactor, sympify=False
)
) # ty:ignore[invalid-assignment]
_latex_repr_ = (
R"\mathcal{{R}}_{{{angular_momentum}}}\left({s}, {mass0}, {gamma0}\right)"
)
Expand Down Expand Up @@ -65,7 +65,7 @@ class BreitWignerMinL(sp.Expr):
R_prod: Any
phsp_factor: PhaseSpaceFactorProtocol = argument(
default=PhaseSpaceFactor, sympify=False
)
) # ty:ignore[invalid-assignment]
_latex_repr_ = R"\mathcal{{R}}^\mathrm{{BW}}_{{{l_dec},{l_prod}}}\left({s}\right)"

def evaluate(self): # noqa: PLR0914
Expand Down Expand Up @@ -176,7 +176,7 @@ class BreitWigner(sp.Expr):
meson_radius: Any = 1
phsp_factor: PhaseSpaceFactorProtocol = argument(
default=PhaseSpaceFactor, sympify=False
)
) # ty:ignore[invalid-assignment]

def evaluate(self):
width = self.energy_dependent_width()
Expand Down
2 changes: 1 addition & 1 deletion src/ampform_dpd/dynamics/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BreitWignerBuilder:
energy_dependent_width: bool = True
decay_form_factor: bool = True
production_form_factor: bool = True
phsp_factor: PhaseSpaceFactorProtocol = PhaseSpaceFactor
phsp_factor: PhaseSpaceFactorProtocol = PhaseSpaceFactor # ty:ignore[invalid-assignment]

def __call__(self, decay_chain: ThreeBodyDecayChain) -> DefinedExpression:
"""Formulate a (relativistic) Breit-Wigner for this resonance."""
Expand Down
2 changes: 1 addition & 1 deletion src/ampform_dpd/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _as_resonance_markdown_table(items: Sequence[Particle]) -> str:
f"{int(1e3 * particle.width):,.0f}",
]
if render_index:
row_items.insert(0, particle.index if isinstance(particle, State) else " ")
row_items.insert(0, particle.index if isinstance(particle, State) else " ") # ty:ignore[invalid-argument-type]
src += _create_markdown_table_row(row_items)
return src

Expand Down
7 changes: 3 additions & 4 deletions src/ampform_dpd/io/serialization/amplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ def formulate( # noqa: PLR0914
amplitude_definitions = {}
angle_definitions = {}
parameter_defaults = {}
n_chains = len(get_decay_chains(model))
helicity_values: tuple[sp.Rational, sp.Rational, sp.Rational, sp.Rational]
n_chains: int = len(get_decay_chains(model))
for helicity_values in product(*allowed_helicities.values()):
for chain_idx in range(n_chains):
amp_defs = formulate_chain_amplitude(
*helicity_values,
*helicity_values, # ty:ignore[invalid-argument-type]
model, # ty:ignore[too-many-positional-arguments]
chain_idx,
to_latex,
Expand Down Expand Up @@ -109,7 +108,7 @@ def formulate( # noqa: PLR0914
intensity=intensity,
amplitudes=amplitude_definitions,
variables=angle_definitions,
parameter_defaults=parameter_defaults, # ty:ignore[invalid-argument-type]
parameter_defaults=parameter_defaults,
masses=masses,
invariants=formulate_invariants(decay),
)
Expand Down
2 changes: 1 addition & 1 deletion src/ampform_dpd/io/serialization/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def to_decay(
chains=sorted({
to_decay_chain(chain, initial_state, final_state, to_latex)
for chain in get_decay_chains(model)
}), # ty:ignore[invalid-argument-type]
}),
)


Expand Down
24 changes: 12 additions & 12 deletions tests/adapter/test_qrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,26 @@ def test_to_three_body_decay(jpsi2pksigma_reaction: ReactionInfo, min_ls: bool):
if min_ls:
assert n_chains == 2
assert production_ls == [
LSCoupling(L=1, S=1), # ty:ignore[invalid-argument-type]
LSCoupling(L=0, S=1), # ty:ignore[invalid-argument-type]
LSCoupling(L=1, S=1),
LSCoupling(L=0, S=1),
]
assert decay_ls == [
LSCoupling(L=2, S=0.5), # ty:ignore[invalid-argument-type]
LSCoupling(L=1, S=0.5), # ty:ignore[invalid-argument-type]
LSCoupling(L=2, S=0.5),
LSCoupling(L=1, S=0.5),
]
else:
assert n_chains == 4
assert production_ls == [
LSCoupling(L=1, S=1), # ty:ignore[invalid-argument-type]
LSCoupling(L=1, S=2), # ty:ignore[invalid-argument-type]
LSCoupling(L=0, S=1), # ty:ignore[invalid-argument-type]
LSCoupling(L=2, S=1), # ty:ignore[invalid-argument-type]
LSCoupling(L=1, S=1),
LSCoupling(L=1, S=2),
LSCoupling(L=0, S=1),
LSCoupling(L=2, S=1),
]
assert decay_ls == [
LSCoupling(L=2, S=0.5), # ty:ignore[invalid-argument-type]
LSCoupling(L=2, S=0.5), # ty:ignore[invalid-argument-type]
LSCoupling(L=1, S=0.5), # ty:ignore[invalid-argument-type]
LSCoupling(L=1, S=0.5), # ty:ignore[invalid-argument-type]
LSCoupling(L=2, S=0.5),
LSCoupling(L=2, S=0.5),
LSCoupling(L=1, S=0.5),
LSCoupling(L=1, S=0.5),
]
elif reaction.formalism == "helicity":
assert n_chains == 2
Expand Down
Loading
Loading