You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
from_omx_3d and from_omx fail with openmatrix 0.4 #91
openmatrix 0.4.0 (29 Oct) is built on h5py. openmatrix.File now subclasses h5py.File, and its __getitem__ treats any key without a leading / as a matrix name in /data. Sharrow's h5py.File branches index with relative keys (handle["lookup"], handle["data"]), so these lookups fail.
Sharrow 2.16.2 with openmatrix 0.4.0:
Call
Result
from_omx_3d([openmatrix.open_file(p)], ...)
LookupError: Key lookup not found (dataset.py:542)
from_omx_3d([p], ...) (a path, which Sharrow opens with openmatrix)
same
from_omx(openmatrix.open_file(p))
LookupError: Key data not found (dataset.py:351)
from_omx_3d([h5py.File(p)], ...)
works
reload_from_omx_3d(ds, [p])
works
ActivitySim calls from_omx_3d with openmatrix handles, so Sharrow mode fails on new installs that don't use uv.lock, e.g., from pypi. #87 has the same pattern: it passes h5py.File handles through unchanged and indexes ["lookup"] and ["data"] (dataset.py:462 and 957, among others).
In the h5py.File branches, index with absolute paths: handle["/lookup"] and handle["/data"]. These work for both plain h5py and openmatrix 0.4. openmatrix 0.3.5 handles are PyTables objects and keep using the .root branch.
Alternatively, reopen any handle that isn't a plain h5py.File by its filename.
Add a test that uses openmatrix 0.4 handles.
Re #90: with a shim for this bug, load times under 0.4 are the same as under 0.3.5. The slow step, reload_from_omx_3d, opens files by path through h5py, so 0.4 doesn't change it.
Activity