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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ci:
autofix_commit_msg: "MAINT: implement pre-commit autofixes"
autoupdate_commit_msg: "MAINT: upgrade lock files"
autoupdate_schedule: quarterly
skip:
- check-jsonschema
- ty
Expand All @@ -13,7 +14,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.8.3
rev: 0.8.7
hooks:
- id: check-dev-files
args:
Expand All @@ -30,7 +31,7 @@ repos:
- id: strip-nb-whitespace

- repo: https://github.com/kynan/nbstripout
rev: 0.9.0
rev: 0.9.1
hooks:
- id: nbstripout
args:
Expand Down Expand Up @@ -58,7 +59,7 @@ repos:
metadata.vscode

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.1
rev: v0.15.2
hooks:
- id: ruff-check
args: [--fix]
Expand Down Expand Up @@ -125,7 +126,7 @@ repos:
pass_filenames: false

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v9.6.0
rev: v9.7.0
hooks:
- id: cspell

Expand All @@ -146,12 +147,11 @@ repos:
name: ty
entry: ty check
args: [--no-progress, --output-format=concise]
pass_filenames: false
require_serial: true
language: system
types_or: [python, pyi, jupyter]

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.3
rev: 0.10.5
hooks:
- id: uv-lock
5 changes: 2 additions & 3 deletions docs/amplitude.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Formulate amplitude model\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/amplitude/formalism.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Helicity versus canonical\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/amplitude/interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Inspect model interactively\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/amplitude/modify.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Modify amplitude model\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/amplitude/spin-alignment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Spin alignment\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/amplitude/symmetrization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Amplitude symmetrization\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/analyticity/integration-algorithms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Numerical integration\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/analyticity/phasespace-factor-widget.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Phase space factor widget\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/analyticity/phasespace-factors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Phase space factor definitions\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/analyticity/riemann-sheets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Continuation into other Riemann sheets\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/dynamics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Dynamics\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/dynamics/custom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Custom dynamics\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/dynamics/k-matrix.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# K-matrix\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```\n",
":::{autolink-concat}\n",
":::\n",
"\n",
"<!-- cspell:ignore amma -->"
]
Expand Down
5 changes: 2 additions & 3 deletions docs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
":::{title} Welcome\n",
":::\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```\n",
":::{autolink-concat}\n",
":::\n",
"\n",
"[![10.5281/zenodo.5526648](https://zenodo.org/badge/doi/10.5281/zenodo.5526648.svg)](https://doi.org/10.5281/zenodo.5526648)\n",
"[![Supported Python versions](https://img.shields.io/pypi/pyversions/ampform)](https://pypi.org/project/ampform)\n",
Expand Down
5 changes: 2 additions & 3 deletions docs/kinematics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# Kinematics\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/sympy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"source": [
"# SymPy helper functions\n",
"\n",
"```{autolink-concat}\n",
"\n",
"```"
":::{autolink-concat}\n",
":::"
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ split-on-trailing-comma = false
"PLC2701",
"PLR2004",
"PLR6301",
"RUF069",
"S101",
"SLF001",
"T20",
Expand Down Expand Up @@ -523,6 +524,7 @@ split-on-trailing-comma = false
"PLR0917",
"PLR2004",
"PLR6301",
"RUF069",
"S101",
"SLF001",
"T20",
Expand Down
2 changes: 1 addition & 1 deletion src/ampform/sympy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def rename_symbols(
free_symbols = cast("set[sp.Symbol]", expression.free_symbols)
if callable(renames):
for old_symbol in free_symbols:
new_name = renames(old_symbol.name)
new_name = renames(old_symbol.name) # ty:ignore[call-top-callable]
new_symbol = sp.Symbol(new_name, **old_symbol.assumptions0)
substitutions[old_symbol] = new_symbol
elif isinstance(renames, dict):
Expand Down
4 changes: 2 additions & 2 deletions tests/dynamics/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_simple_breit_wigner(
s = variable_set.incoming_state_mass**2
m0 = sp.Symbol("m_{N}", nonnegative=True)
w0 = sp.Symbol(R"\Gamma_{N}", nonnegative=True)
assert bw == w0 * m0 / (-sp.I * w0 * m0 - s + m0**2) # noqa: RUF069
assert bw == w0 * m0 / (-sp.I * w0 * m0 - s + m0**2)
assert set(parameters) == {m0, w0}
assert parameters[m0] == particle.mass
assert parameters[w0] == particle.width
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_breit_wigner_with_energy_dependent_width(
w = EnergyDependentWidth(
s, m0, w0, m_a=m1, m_b=m2, angular_momentum=ang_mom, meson_radius=d
)
assert bw == w0 * m0 / (-sp.I * w * m0 - s + m0**2) # noqa: RUF069
assert bw == w0 * m0 / (-sp.I * w * m0 - s + m0**2)
assert set(parameters) == {m0, w0, d}
assert parameters[m0] == particle.mass
assert parameters[w0] == particle.width
Expand Down
2 changes: 1 addition & 1 deletion tests/dynamics/test_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def round_nested(expression: sp.Expr, n_decimals: int) -> sp.Expr:
for node in sp.preorder_traversal(expression):
if node.free_symbols:
continue
if isinstance(node, sp.Pow) and node.args[1] == 1 / 2: # noqa: RUF069
if isinstance(node, sp.Pow) and node.args[1] == 1 / 2:
no_sqrt_expr = no_sqrt_expr.xreplace({node: node.n()})
rounded_expr = no_sqrt_expr
for node in sp.preorder_traversal(no_sqrt_expr):
Expand Down
4 changes: 2 additions & 2 deletions tests/helicity/test_helicity.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ def test_formulate(

if reaction.formalism == "canonical-helicity":
assert (
no_dynamics # noqa: RUF069
no_dynamics
== 0.8 * sp.sqrt(10) * sp.cos(theta) ** 2
+ 4.4 * sp.cos(theta) ** 2
+ 0.8 * sp.sqrt(10)
+ 4.4
)
else:
assert no_dynamics == 8.0 - 4.0 * sp.sin(theta) ** 2 # noqa: RUF069
assert no_dynamics == 8.0 - 4.0 * sp.sin(theta) ** 2

def test_stable_final_state_ids(self, reaction: ReactionInfo):
builder: HelicityAmplitudeBuilder = get_builder(reaction)
Expand Down
2 changes: 1 addition & 1 deletion tests/sympy/test_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_real_value_function(
assert integral_expr.configuration == configuration
assert integral_expr.dummify is dummify
func = sp.lambdify([], integral_expr, backend)
assert func() == 26 / 3 # noqa: RUF069
assert func() == 26 / 3

@pytest.mark.parametrize(
("p_value", "expected"),
Expand Down
2 changes: 1 addition & 1 deletion tests/sympy/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_lambdify(self, backend: str, real: bool):
x = sp.Symbol("x", real=real)
expression = ComplexSqrt(x)
lambdified = sp.lambdify(x, expression, backend)
assert lambdified(np.array(-1)) == 1j # noqa: RUF069
assert lambdified(np.array(-1)) == 1j

@pytest.mark.parametrize(
("input_value", "expected"),
Expand Down
Loading