From 519898a2bb9993756935fb1f8d820f7c43586422 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 08:36:54 +0000 Subject: [PATCH 1/2] Bump the actions group with 2 updates Bumps the actions group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/upload-artifact` from 6 to 7 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) Updates `actions/download-artifact` from 7 to 8 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3f09274..2e5ad7b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,7 +50,7 @@ jobs: SIMWEIGHTS_TESTDATA: . run: python3 -m pytest --cov-report=xml --junit-xml=test-results-${{matrix.os}}-${{matrix.python-version}}.junit.xml - name: Upload Test Results - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 if: always() with: if-no-files-found: error @@ -88,7 +88,7 @@ jobs: SIMWEIGHTS_TESTDATA: . run: /opt/icetray/bin/icetray-shell python -m pytest --junit-xml=test-results-icetray.junit.xml - name: Upload Test Results - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 if: always() with: if-no-files-found: error @@ -105,7 +105,7 @@ jobs: if: always() steps: - name: Download Artifacts - uses: actions/download-artifact@v7 + uses: actions/download-artifact@v8 with: path: . pattern: test-results-* From 22c27ee4f73dfcb7eebc0a18d2f371ab0f159a47 Mon Sep 17 00:00:00 2001 From: Kevin Meagher <11620178+kjmeagher@users.noreply.github.com> Date: Mon, 2 Mar 2026 08:21:39 -0600 Subject: [PATCH 2/2] fix get_column for new uproot --- .github/workflows/tests.yml | 10 ++--- .pre-commit-config.yaml | 15 ++----- pyproject.toml | 10 ++--- src/simweights/_fluxes.py | 88 ++++++++++++++++++++++--------------- src/simweights/_utils.py | 4 +- 5 files changed, 67 insertions(+), 60 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2e5ad7b..138062d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,16 +18,16 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] os: [ubuntu-24.04] include: - - python-version: "3.13" + - python-version: "3.14" os: macos-15-intel - - python-version: "3.13" + - python-version: "3.14" os: macos-14 - - python-version: "3.13" + - python-version: "3.14" os: macos-15 - - python-version: "3.13" + - python-version: "3.14" os: macos-26 steps: - uses: actions/checkout@v6 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41e1bcb..85534d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: hooks: - id: yamlfmt - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.15.0 + rev: v2.16.0 hooks: - id: pretty-format-toml args: [--autofix] @@ -27,22 +27,15 @@ repos: hooks: - id: blacken-docs args: [-l 100] - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.19.1 - hooks: - - id: mypy - files: simweights - additional_dependencies: [numpy] - exclude: ^contrib/ - repo: https://github.com/pycqa/pylint - rev: v4.0.4 + rev: v4.0.5 hooks: - id: pylint files: simweights exclude: ^contrib/ additional_dependencies: [numpy, pandas] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.10 + rev: v0.15.4 hooks: - id: ruff args: [--fix, --show-fixes] @@ -62,7 +55,7 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.5 + rev: v1.5.6 hooks: - id: forbid-crlf - id: forbid-tabs diff --git a/pyproject.toml b/pyproject.toml index 08b386b..2024bb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,10 +21,11 @@ classifiers = [ 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Topic :: Scientific/Engineering :: Astronomy', 'Topic :: Scientific/Engineering :: Physics' ] -dependencies = ["numpy>=1.21.2", "scipy"] +dependencies = ["numpy>=2", "scipy"] dynamic = ["version", "description"] keywords = ["python", "science", "astronomy", "astrophysics", "IceCube", "neutrino", "simulation"] license = {file = "LICENSES/BSD-2-Clause.txt"} @@ -33,7 +34,7 @@ readme = "README.rst" requires-python = "~=3.8" [project.optional-dependencies] -dev = ["pytest", "pre-commit", "reuse", "black", "ruff", "pylint", "mypy"] +dev = ["pytest", "pre-commit", "reuse", "ruff", "pylint"] docs = ["sphinx", "sphinx-rtd-theme", "pandas"] examples = ['matplotlib'] test = [ @@ -68,11 +69,6 @@ source = ["simweights"] [tool.doc8] max-line-length = 128 -[tool.mypy] -enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] -strict = true -warn_unreachable = true - [tool.pylint.format] max-line-length = "128" diff --git a/src/simweights/_fluxes.py b/src/simweights/_fluxes.py index 437b5df..974125a 100644 --- a/src/simweights/_fluxes.py +++ b/src/simweights/_fluxes.py @@ -184,21 +184,31 @@ class GaisserH3a(CosmicRayFlux): pdgids = PDGID_5COMP _funcs = ( - lambda E: 0.7860 * E**-2.66 * exp(-E / (4e6 * 1)) - + 0.0020 * E**-2.4 * exp(-E / (3e7 * 1)) - + 0.00017 * E**-2.4 * exp(-E / (2e9 * 1)), - lambda E: 0.3550 * E**-2.58 * exp(-E / (4e6 * 2)) - + 0.0020 * E**-2.4 * exp(-E / (3e7 * 2)) - + 0.00017 * E**-2.4 * exp(-E / (2e9 * 2)), - lambda E: 0.2200 * E**-2.63 * exp(-E / (4e6 * 7)) - + 0.00134 * E**-2.4 * exp(-E / (3e7 * 7)) - + 0.000114 * E**-2.4 * exp(-E / (2e9 * 7)), - lambda E: 0.1430 * E**-2.67 * exp(-E / (4e6 * 13)) - + 0.00134 * E**-2.4 * exp(-E / (3e7 * 13)) - + 0.000114 * E**-2.4 * exp(-E / (2e9 * 13)), - lambda E: 0.2120 * E**-2.63 * exp(-E / (4e6 * 26)) - + 0.00134 * E**-2.4 * exp(-E / (3e7 * 26)) - + 0.000114 * E**-2.4 * exp(-E / (2e9 * 26)), + lambda E: ( + 0.7860 * E**-2.66 * exp(-E / (4e6 * 1)) + + 0.0020 * E**-2.4 * exp(-E / (3e7 * 1)) + + 0.00017 * E**-2.4 * exp(-E / (2e9 * 1)) + ), + lambda E: ( + 0.3550 * E**-2.58 * exp(-E / (4e6 * 2)) + + 0.0020 * E**-2.4 * exp(-E / (3e7 * 2)) + + 0.00017 * E**-2.4 * exp(-E / (2e9 * 2)) + ), + lambda E: ( + 0.2200 * E**-2.63 * exp(-E / (4e6 * 7)) + + 0.00134 * E**-2.4 * exp(-E / (3e7 * 7)) + + 0.000114 * E**-2.4 * exp(-E / (2e9 * 7)) + ), + lambda E: ( + 0.1430 * E**-2.67 * exp(-E / (4e6 * 13)) + + 0.00134 * E**-2.4 * exp(-E / (3e7 * 13)) + + 0.000114 * E**-2.4 * exp(-E / (2e9 * 13)) + ), + lambda E: ( + 0.2120 * E**-2.63 * exp(-E / (4e6 * 26)) + + 0.00134 * E**-2.4 * exp(-E / (3e7 * 26)) + + 0.000114 * E**-2.4 * exp(-E / (2e9 * 26)) + ), ) @@ -212,9 +222,9 @@ class GaisserH4a(CosmicRayFlux): pdgids = PDGID_5COMP _funcs = ( - lambda E: 0.7860 * E**-2.66 * exp(-E / (4e6 * 1)) - + 0.0020 * E**-2.4 * exp(-E / (3e7 * 1)) - + 0.0200 * E**-2.6 * exp(-E / 6e10), + lambda E: ( + 0.7860 * E**-2.66 * exp(-E / (4e6 * 1)) + 0.0020 * E**-2.4 * exp(-E / (3e7 * 1)) + 0.0200 * E**-2.6 * exp(-E / 6e10) + ), lambda E: 0.3550 * E**-2.58 * exp(-E / (4e6 * 2)) + 0.002 * E**-2.4 * exp(-E / (3e7 * 2)), lambda E: 0.2200 * E**-2.63 * exp(-E / (4e6 * 7)) + 0.00134 * E**-2.4 * exp(-E / (3e7 * 7)), lambda E: 0.1430 * E**-2.67 * exp(-E / (4e6 * 13)) + 0.00134 * E**-2.4 * exp(-E / (3e7 * 13)), @@ -233,14 +243,16 @@ class GaisserH4a_IT(CosmicRayFlux): # pylint: disable=invalid-name pdgids = PDGID_4COMP _funcs = ( - lambda E: 0.7860 * E**-2.66 * exp(-E / (4e6 * 1)) - + 0.0020 * E**-2.4 * exp(-E / (3e7 * 1)) - + 0.0200 * E**-2.6 * exp(-E / 6e10), + lambda E: ( + 0.7860 * E**-2.66 * exp(-E / (4e6 * 1)) + 0.0020 * E**-2.4 * exp(-E / (3e7 * 1)) + 0.0200 * E**-2.6 * exp(-E / 6e10) + ), lambda E: 0.3550 * E**-2.58 * exp(-E / (4e6 * 2)) + 0.0020 * E**-2.4 * exp(-E / (3e7 * 2)), - lambda E: 0.2200 * E**-2.63 * exp(-E / (4e6 * 7)) - + 0.00134 * E**-2.4 * exp(-E / (3e7 * 7)) - + 0.1430 * E**-2.67 * exp(-E / (4e6 * 13)) - + 0.00134 * E**-2.4 * exp(-E / (3e7 * 13)), + lambda E: ( + 0.2200 * E**-2.63 * exp(-E / (4e6 * 7)) + + 0.00134 * E**-2.4 * exp(-E / (3e7 * 7)) + + 0.1430 * E**-2.67 * exp(-E / (4e6 * 13)) + + 0.00134 * E**-2.4 * exp(-E / (3e7 * 13)) + ), lambda E: 0.2120 * E**-2.63 * exp(-E / (4e6 * 26)) + 0.00134 * E**-2.4 * exp(-E / (3e7 * 26)), ) @@ -304,9 +316,11 @@ class GlobalFitGST(CosmicRayFlux): lambda E: 0.32 * E**-2.58 * exp(-E / 1.2e5 / 2) + 0.0065 * E**-2.3 * exp(-E / 4e6 / 2), lambda E: 0.01 * E**-2.40 * exp(-E / 1.2e5 / 7) + 0.0006 * E**-2.3 * exp(-E / 4e6 / 7), lambda E: 0.013 * E**-2.40 * exp(-E / 1.2e5 / 13) + 0.0007 * E**-2.3 * exp(-E / 4e6 / 13), - lambda E: 0.006 * E**-2.30 * exp(-E / 1.2e5 / 26) - + 0.00023 * E**-2.2 * exp(-E / 4e6 / 26) - + 0.0000025 * E**-2.2 * exp(-E / 1.3e9 / 26), + lambda E: ( + 0.006 * E**-2.30 * exp(-E / 1.2e5 / 26) + + 0.00023 * E**-2.2 * exp(-E / 4e6 / 26) + + 0.0000025 * E**-2.2 * exp(-E / 1.3e9 / 26) + ), ) @@ -320,13 +334,17 @@ class GlobalFitGST_IT(CosmicRayFlux): # pylint: disable=invalid-name _funcs = ( lambda E: 0.7 * E**-2.66 * exp(-E / 1.2e5) + 0.015 * E**-2.4 * exp(-E / 4e6) + 0.0014 * E**-2.4 * exp(-E / 1.3e9), lambda E: 0.32 * E**-2.58 * exp(-E / 1.2e5 / 2) + 0.0065 * E**-2.3 * exp(-E / 4e6 / 2), - lambda E: 0.01 * E**-2.40 * exp(-E / 1.2e5 / 7) - + 0.0006 * E**-2.3 * exp(-E / 4e6 / 7) - + 0.013 * E**-2.40 * exp(-E / 1.2e5 / 13) - + 0.0007 * E**-2.3 * exp(-E / 4e6 / 13), - lambda E: 0.006 * E**-2.30 * exp(-E / 1.2e5 / 26) - + 0.00023 * E**-2.2 * exp(-E / 4e6 / 26) - + 0.0000025 * E**-2.2 * exp(-E / 1.3e9 / 26), + lambda E: ( + 0.01 * E**-2.40 * exp(-E / 1.2e5 / 7) + + 0.0006 * E**-2.3 * exp(-E / 4e6 / 7) + + 0.013 * E**-2.40 * exp(-E / 1.2e5 / 13) + + 0.0007 * E**-2.3 * exp(-E / 4e6 / 13) + ), + lambda E: ( + 0.006 * E**-2.30 * exp(-E / 1.2e5 / 26) + + 0.00023 * E**-2.2 * exp(-E / 4e6 / 26) + + 0.0000025 * E**-2.2 * exp(-E / 1.3e9 / 26) + ), ) diff --git a/src/simweights/_utils.py b/src/simweights/_utils.py index de16b94..7d2d11b 100644 --- a/src/simweights/_utils.py +++ b/src/simweights/_utils.py @@ -81,6 +81,8 @@ def has_column(table: Any, name: str) -> bool: def get_column(table: Any, name: str) -> Any: """Helper function getting a column from a table, works with h5py, pytables, and pandas.""" + if hasattr(table, "arrays"): + return table.arrays(library="np")[name] if hasattr(table, "cols"): return np.asarray(getattr(table.cols, name)[:], dtype=np.float64) if hasattr(table, name): @@ -92,8 +94,6 @@ def get_column(table: Any, name: str) -> Any: if hasattr(table, "primary") and hasattr(table.primary.dir, name): return np.asarray(np.atleast_1d(getattr(table.primary.dir, name)), dtype=np.float64) column = table[name] - if hasattr(column, "array") and callable(column.array): - return np.asarray(column.array(library="np"), dtype=np.float64) return np.asarray(np.atleast_1d(column), dtype=np.float64)