Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the actions group with 2 updates #11

Merged
merged 2 commits into from
May 7, 2024
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
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
- uses: scientific-python/repo-review@v0.10.6
- uses: scientific-python/repo-review@v0.11.0
with:
plugins: sp-repo-review

Expand Down Expand Up @@ -60,7 +60,9 @@ jobs:
run: python -m pip install .[test]

- name: Test package
run: python -m pytest -ra --cov --cov-report=xml --cov-report=term --durations=20
run:
python -m pytest -ra --cov --cov-report=xml --cov-report=term
--durations=20

- name: Upload coverage report
uses: codecov/[email protected].0
uses: codecov/[email protected].1
25 changes: 8 additions & 17 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

@nox.session
def lint(session: nox.Session) -> None:
"""
Run the linter.
"""
"""Run the linter."""
session.install("pre-commit")
session.run(
"pre-commit", "run", "--all-files", "--show-diff-on-failure", *session.posargs
Expand All @@ -24,9 +22,7 @@ def lint(session: nox.Session) -> None:

@nox.session
def pylint(session: nox.Session) -> None:
"""
Run PyLint.
"""
"""Run PyLint."""
# This needs to be installed into the package environment, and is slower
# than a pre-commit check
session.install(".", "pylint")
Expand All @@ -35,17 +31,16 @@ def pylint(session: nox.Session) -> None:

@nox.session
def tests(session: nox.Session) -> None:
"""
Run the unit and regular tests.
"""
"""Run the unit and regular tests."""
session.install(".[test]")
session.run("pytest", *session.posargs)


@nox.session(reuse_venv=True)
def docs(session: nox.Session) -> None:
"""
Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links.
"""Build the docs.

Pass "--serve" to serve. Pass "-b linkcheck" to check links.
"""

parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -86,9 +81,7 @@ def docs(session: nox.Session) -> None:

@nox.session
def build_api_docs(session: nox.Session) -> None:
"""
Build (regenerate) API docs.
"""
"""Build (regenerate) API docs."""

session.install("sphinx")
session.chdir("docs")
Expand All @@ -105,9 +98,7 @@ def build_api_docs(session: nox.Session) -> None:

@nox.session
def build(session: nox.Session) -> None:
"""
Build an SDist and wheel.
"""
"""Build an SDist and wheel."""

build_path = DIR.joinpath("build")
if build_path.exists():
Expand Down
3 changes: 1 addition & 2 deletions src/zfit_pwa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Copyright (c) 2024 Jonas Eschle. All rights reserved.
"""Copyright (c) 2024 Jonas Eschle. All rights reserved.

zfit-pwa: Tools to adapt to Partial Wave Analysis packages
"""
Expand Down
8 changes: 4 additions & 4 deletions src/zfit_pwa/compwa/variables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Mapping
from collections.abc import Mapping

import numpy as np
import pandas as pd
Expand All @@ -19,8 +19,9 @@ def obs_from_frame(frame1, frame2=None, bufferfactor=0.01):
if not isinstance(frame1, (Mapping, pd.DataFrame)) or not isinstance(
frame2, (Mapping, pd.DataFrame)
):
msg = "frame1 and frame2 have to be either a mapping or a pandas DataFrame, or a zfit Data object. They are currently of type: "
raise ValueError(
"frame1 and frame2 have to be either a mapping or a pandas DataFrame, or a zfit Data object. They are currently of type: ",
msg,
type(frame1),
type(frame2),
)
Expand All @@ -38,5 +39,4 @@ def obs_from_frame(frame1, frame2=None, bufferfactor=0.01):
),
)
)
obsall = zfit.dimension.combine_spaces(*obs)
return obsall
return zfit.dimension.combine_spaces(*obs)
4 changes: 1 addition & 3 deletions src/zfit_pwa/compwa/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def _pdf(self, x, norm):

@z.function(wraps="tensorwaves")
def _jitted_unnormalized_pdf(self, data):
unnormalized_pdf = self.intensity(data)

return unnormalized_pdf
return self.intensity(data)

@z.function(wraps="tensorwaves")
def _jitted_normalization(self, norm_sample):
Expand Down
17 changes: 2 additions & 15 deletions tests/compwa/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def create_amplitude():
initial_state_mass=reaction.initial_state[-1].mass,
final_state_masses={i: p.mass for i, p in reaction.final_state.items()},
)
phsp_momenta = phsp_generator.generate(100_000, rng)
phsp_generator.generate(100_000, rng)

unfolded_expression = model.expression.doit()
model.expression.doit()

return model, reaction

Expand Down Expand Up @@ -93,19 +93,6 @@ def test_wrapper_simple():
data = helicity_transformer(data_momenta)
data_frame = pd.DataFrame(data)
phsp_frame = pd.DataFrame(phsp)
initial_parameters = {
R"C_{J/\psi(1S) \to {f_{0}(1500)}_{0} \gamma_{+1}; f_{0}(1500) \to \pi^{0}_{0} \pi^{0}_{0}}": (
1.0
),
"m_{f_{0}(500)}": 0.4,
"m_{f_{0}(980)}": 0.88,
"m_{f_{0}(1370)}": 1.22,
"m_{f_{0}(1500)}": 1.45,
"m_{f_{0}(1710)}": 1.83,
R"\Gamma_{f_{0}(500)}": 0.3,
R"\Gamma_{f_{0}(980)}": 0.1,
R"\Gamma_{f_{0}(1710)}": 0.3,
}

# data conversion
# phsp_zfit = zfit.Data.from_pandas(phsp_frame)
Expand Down
Loading