Skip to content

Commit

Permalink
Merge pull request #815 from danielballan/numpy-2-fix
Browse files Browse the repository at this point in the history
Numpy 2 fix
  • Loading branch information
danielballan authored Jun 20, 2024
2 parents 43a742e + 90d69da commit 0c814bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion databroker/mongo_normalized.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def populate_columns(keys, min_seq_num, max_seq_num):
else:
nonscalars.append(key)
estimated_nonscalar_row_bytesizes.append(
numpy.product(data_key["shape"]) * 8
numpy.prod(data_key["shape"]) * 8
)

# Aim for 10 MB pages to stay safely clear the MongoDB's hard limit
Expand Down
19 changes: 19 additions & 0 deletions databroker/tests/test_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,3 +1289,22 @@ def test_update(db, RE, hw):
with pytest.raises(ValueError):
c[uid].update_metadata({"start": {"uid": "not allowed to change this"}})


def test_img_read(db, RE, hw):
"Test reading 2D data referenced by Datum, Resource."
RE.subscribe(db.insert)
if not hasattr(db, "v2"):
raise pytest.skip("v0 has no v2 accessor")
c = db.v2
uid, = get_uids(RE(count([hw.img], 5)))
c[uid]["primary"]["data"]["img"][:]


def test_direct_img_read(db, RE, hw):
"Test reading 2D data placed directly in the Event document."
RE.subscribe(db.insert)
if not hasattr(db, "v2"):
raise pytest.skip("v0 has no v2 accessor")
c = db.v2
uid, = get_uids(RE(count([hw.direct_img], 5)))
c[uid]["primary"]["data"]["img"][:]

0 comments on commit 0c814bc

Please sign in to comment.