[GENIE] Add support for genie-icetray. #213
6 fail, 95 pass in 1m 51s
Annotations
Check warning on line 0 in tests.test_genie_icetray_datasets
github-actions / Test Results
All 5 runs failed: test_dataset[genie-icetray.140000A_000000.hdf] (tests.test_genie_icetray_datasets)
test-results-macos-14-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.10.junit.xml [took 0s]
test-results-ubuntu-24.04-3.11.junit.xml [took 0s]
test-results-ubuntu-24.04-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.9.junit.xml [took 0s]
Raw output
FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000A_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
fname = 'genie-icetray.140000A_000000.hdf'
@pytest.mark.parametrize("fname", datasets)
@pytest.mark.skipif(not datadir, reason="environment variable SIMWEIGHTS_TESTDATA not set")
def test_dataset(fname):
filename = Path(datadir) / fname
> reffile = h5py.File(str(filename), "r")
tests/test_genie_icetray_datasets.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:561: in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:235: in make_fid
fid = h5f.open(name, flags, fapl=fapl)
h5py/_objects.pyx:54: in h5py._objects.with_phil.wrapper
???
h5py/_objects.pyx:55: in h5py._objects.with_phil.wrapper
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000A_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
h5py/h5f.pyx:102: FileNotFoundError
Check warning on line 0 in tests.test_genie_icetray_datasets
github-actions / Test Results
All 5 runs failed: test_dataset[genie-icetray.140000B_000000.hdf] (tests.test_genie_icetray_datasets)
test-results-macos-14-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.10.junit.xml [took 0s]
test-results-ubuntu-24.04-3.11.junit.xml [took 0s]
test-results-ubuntu-24.04-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.9.junit.xml [took 0s]
Raw output
FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000B_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
fname = 'genie-icetray.140000B_000000.hdf'
@pytest.mark.parametrize("fname", datasets)
@pytest.mark.skipif(not datadir, reason="environment variable SIMWEIGHTS_TESTDATA not set")
def test_dataset(fname):
filename = Path(datadir) / fname
> reffile = h5py.File(str(filename), "r")
tests/test_genie_icetray_datasets.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:561: in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:235: in make_fid
fid = h5f.open(name, flags, fapl=fapl)
h5py/_objects.pyx:54: in h5py._objects.with_phil.wrapper
???
h5py/_objects.pyx:55: in h5py._objects.with_phil.wrapper
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000B_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
h5py/h5f.pyx:102: FileNotFoundError
Check warning on line 0 in tests.test_genie_icetray_datasets
github-actions / Test Results
All 5 runs failed: test_dataset[genie-icetray.140000C_000000.hdf] (tests.test_genie_icetray_datasets)
test-results-macos-14-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.10.junit.xml [took 0s]
test-results-ubuntu-24.04-3.11.junit.xml [took 0s]
test-results-ubuntu-24.04-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.9.junit.xml [took 0s]
Raw output
FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000C_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
fname = 'genie-icetray.140000C_000000.hdf'
@pytest.mark.parametrize("fname", datasets)
@pytest.mark.skipif(not datadir, reason="environment variable SIMWEIGHTS_TESTDATA not set")
def test_dataset(fname):
filename = Path(datadir) / fname
> reffile = h5py.File(str(filename), "r")
tests/test_genie_icetray_datasets.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:561: in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:235: in make_fid
fid = h5f.open(name, flags, fapl=fapl)
h5py/_objects.pyx:54: in h5py._objects.with_phil.wrapper
???
h5py/_objects.pyx:55: in h5py._objects.with_phil.wrapper
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000C_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
h5py/h5f.pyx:102: FileNotFoundError
Check warning on line 0 in tests.test_genie_icetray_datasets
github-actions / Test Results
All 5 runs failed: test_dataset[genie-icetray.140000D_000000.hdf] (tests.test_genie_icetray_datasets)
test-results-macos-14-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.10.junit.xml [took 0s]
test-results-ubuntu-24.04-3.11.junit.xml [took 0s]
test-results-ubuntu-24.04-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.9.junit.xml [took 0s]
Raw output
FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000D_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
fname = 'genie-icetray.140000D_000000.hdf'
@pytest.mark.parametrize("fname", datasets)
@pytest.mark.skipif(not datadir, reason="environment variable SIMWEIGHTS_TESTDATA not set")
def test_dataset(fname):
filename = Path(datadir) / fname
> reffile = h5py.File(str(filename), "r")
tests/test_genie_icetray_datasets.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:561: in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:235: in make_fid
fid = h5f.open(name, flags, fapl=fapl)
h5py/_objects.pyx:54: in h5py._objects.with_phil.wrapper
???
h5py/_objects.pyx:55: in h5py._objects.with_phil.wrapper
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'genie-icetray.140000D_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
h5py/h5f.pyx:102: FileNotFoundError
Check warning on line 0 in tests.test_genie_icetray_datasets
github-actions / Test Results
All 5 runs failed: test_dataset[level2_genie-icetray.140000_000000.hdf] (tests.test_genie_icetray_datasets)
test-results-macos-14-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.10.junit.xml [took 0s]
test-results-ubuntu-24.04-3.11.junit.xml [took 0s]
test-results-ubuntu-24.04-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.9.junit.xml [took 0s]
Raw output
FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'level2_genie-icetray.140000_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
fname = 'level2_genie-icetray.140000_000000.hdf'
@pytest.mark.parametrize("fname", datasets)
@pytest.mark.skipif(not datadir, reason="environment variable SIMWEIGHTS_TESTDATA not set")
def test_dataset(fname):
filename = Path(datadir) / fname
> reffile = h5py.File(str(filename), "r")
tests/test_genie_icetray_datasets.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:561: in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/h5py/_hl/files.py:235: in make_fid
fid = h5f.open(name, flags, fapl=fapl)
h5py/_objects.pyx:54: in h5py._objects.with_phil.wrapper
???
h5py/_objects.pyx:55: in h5py._objects.with_phil.wrapper
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'level2_genie-icetray.140000_000000.hdf', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
h5py/h5f.pyx:102: FileNotFoundError
Check warning on line 0 in tests.test_genie_weighter.TestGenieWeighter
github-actions / Test Results
All 5 runs failed: test_genie (tests.test_genie_weighter.TestGenieWeighter)
test-results-macos-14-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.10.junit.xml [took 0s]
test-results-ubuntu-24.04-3.11.junit.xml [took 0s]
test-results-ubuntu-24.04-3.12.junit.xml [took 0s]
test-results-ubuntu-24.04-3.9.junit.xml [took 0s]
Raw output
RuntimeError: GenieWeighter received an nfiles=10, but `<NONE>` was produced with genie-reader instead of genie-icetray. We expect to read the number of files from the number of observed S-frames in the file, so this is unnecessary. Do not pass in a value for nfiles for genie-reader files.
self = <test_genie_weighter.TestGenieWeighter testMethod=test_genie>
def test_genie(self):
nevents = 10000
coszen = 0.7
pdgid = 12
c1 = simweights.CircleInjector(300, 0, 1)
p1 = simweights.PowerLaw(0, 1e3, 1e4)
for event_weight in [1e-6, 1e-3, 1]:
for nfiles in [1, 5, 50]:
for include_volscale in [True, False]:
result_dtype = [("neu", np.int32), ("pzv", np.float64), ("Ev", np.float64), ("wght", np.float64)]
if include_volscale:
result_dtype.append(("volscale", np.float64))
weight = np.zeros(nevents, dtype=result_dtype)
weight["neu"] = pdgid
weight["pzv"] = coszen
weight["Ev"] = p1.ppf(np.linspace(0, 1, nevents))
weight["wght"] = event_weight
if include_volscale:
weight["volscale"] = 1
rows = nfiles * [
(
pdgid,
nevents,
1,
c1.radius,
np.arccos(c1.cos_zen_max),
np.arccos(c1.cos_zen_min),
p1.a,
p1.b,
p1.g,
),
]
info = np.array(rows, dtype=info_dtype)
d = {"I3GenieResult": weight, "I3GenieInfo": info}
for flux in [0.1, 1, 10]:
wobj = simweights.GenieWeighter(d)
w = wobj.get_weights(flux)
np.testing.assert_allclose(
w.sum(),
flux * event_weight * c1.etendue * p1.integral / nfiles,
)
E = d["I3GenieResult"]["Ev"]
y, x = np.histogram(E, weights=w, bins=51, range=[p1.a, p1.b])
Ewidth = np.ediff1d(x)
np.testing.assert_allclose(y, flux * event_weight * Ewidth * c1.etendue / nfiles, 5e-3)
with self.assertRaises(TypeError):
> simweights.GenieWeighter(d, nfiles=10)
tests/test_genie_weighter.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def GenieWeighter(file_obj: Any, nfiles: float | None = None) -> Weighter: # noqa: N802
# pylint: disable=invalid-name
"""Weighter for GENIE simulation.
Reads ``I3GenieInfo`` from S-Frames and ``I3GenieResult`` from Q-Frames for genie-reader files
and ``I3MCWeightDict`` and "I3GENIEResultDict" from Q-Frames for older legacy genie-icetray files.
"""
if has_table(file_obj, "I3GenieInfo"):
# Branch for newer genie-reader files
if nfiles is not None:
msg = (
f"GenieWeighter received an nfiles={nfiles}, but `{getattr(file_obj, 'filename', '<NONE>')}` "
"was produced with genie-reader instead of genie-icetray. We expect to read the number of "
"files from the number of observed S-frames in the file, so this is unnecessary. Do not pass "
"in a value for nfiles for genie-reader files."
)
> raise RuntimeError(msg)
E RuntimeError: GenieWeighter received an nfiles=10, but `<NONE>` was produced with genie-reader instead of genie-icetray. We expect to read the number of files from the number of observed S-frames in the file, so this is unnecessary. Do not pass in a value for nfiles for genie-reader files.
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/simweights/_genie_weighter.py:107: RuntimeError