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
62 changes: 30 additions & 32 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
include:
- python-version: "3.14"
os: macos-26
- python-version: "3.15"
os: macos-26
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -60,36 +58,36 @@ jobs:
with:
fail_ci_if_error: false
verbose: true
TestsIceTray:
env:
UV_SYSTEM_PYTHON: 1
runs-on: ubuntu-latest
container: icecube/icetray:icetray-devel-current-ubuntu22.04-X64
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install SimWeights
run: uv pip install -e .[test]
- name: Download Test Data
run: |
curl -u icecube:${{ secrets.ICECUBE_PASSWORD }} https://convey.icecube.wisc.edu/data/ana/Software/simweights/test-data/simweights_testdata.tar.gz -O
tar xzvf simweights_testdata.tar.gz
- name: Run Unit Tests
env:
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@v7
if: always()
with:
if-no-files-found: error
name: test-results-icetray.junit.xml
path: test-results-icetray.junit.xml
# TestsIceTray:
# env:
# UV_SYSTEM_PYTHON: 1
# runs-on: ubuntu-latest
# container: icecube/icetray:icetray-devel-current-ubuntu22.04-X64
# strategy:
# fail-fast: false
# steps:
# - uses: actions/checkout@v6
# - name: Install uv
# uses: astral-sh/setup-uv@v7
# with:
# enable-cache: true
# - name: Install SimWeights
# run: uv pip install -e .[test]
# - name: Download Test Data
# run: |
# curl -u icecube:${{ secrets.ICECUBE_PASSWORD }} https://convey.icecube.wisc.edu/data/ana/Software/simweights/test-data/simweights_testdata.tar.gz -O
# tar xzvf simweights_testdata.tar.gz
# - name: Run Unit Tests
# env:
# 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@v7
# if: always()
# with:
# if-no-files-found: error
# name: test-results-icetray.junit.xml
# path: test-results-icetray.junit.xml
publish-test-results:
name: "Publish Tests Results"
needs: Tests
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- id: blacken-docs
args: [-l 100]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
rev: v0.15.21
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ignore = [
"S101", # assert-used
"COM812", # conflicts with ruff formatter
"ISC001", # conflicts with ruff formatter
"PLR0913", # Too many arguments in function definition
"PLR0911", # Too many return statement
"PLW1641" # object does not implement `__hash__` method
]
Expand Down
2 changes: 1 addition & 1 deletion src/simweights/_generation_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get_cos_zenith_range(self: "CompositeSurface", pdgid: "PDGCode | None" = Non
assert np.isfinite(czmax)
return czmin, czmax

def __eq__(self, other: object) -> bool:
def __eq__(self: GenerationSurface, other: object) -> bool:
# must handle the same set of particle types
if isinstance(other, GenerationSurface):
return self == CompositeSurface(other)
Expand Down
6 changes: 5 additions & 1 deletion tests/test_weighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
#
# SPDX-License-Identifier: BSD-2-Clause

import contextlib
import unittest
from copy import deepcopy

import numpy as np

from simweights import TIG1996, IceTopSurface, NaturalRateCylinder, NuGenSurface, PowerLaw, Weighter

with contextlib.suppress(ImportError):
import nuflux


def fluxfun1(energy):
return energy**2
Expand Down Expand Up @@ -311,7 +315,7 @@ def test_nuflux(self):
weighter1.add_weight_column("energy", data1["I3Weight"]["energy"])
weighter1.add_weight_column("cos_zen", np.cos(data1["I3Weight"]["zenith"]))

honda = nuflux.makeFlux("honda2006") # noqa : F821
honda = nuflux.makeFlux("honda2006")
w = weighter1.get_weights(honda)
fluxval = honda.getFlux(14, data1["I3Weight"]["energy"], np.cos(data1["I3Weight"]["zenith"]))
oneweight = weighter1.get_weights(1)
Expand Down