MCPcopy Create free account
hub / github.com/dask/dask / test_tiledb_multiattr

Function test_tiledb_multiattr

dask/array/tests/test_array_core.py:5337–5363  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5335
5336
5337def test_tiledb_multiattr():
5338 tiledb = pytest.importorskip("tiledb")
5339 dom = tiledb.Domain(
5340 tiledb.Dim("x", (0, 1000), tile=100), tiledb.Dim("y", (0, 1000), tile=100)
5341 )
5342 schema = tiledb.ArraySchema(
5343 attrs=(tiledb.Attr("attr1"), tiledb.Attr("attr2")), domain=dom
5344 )
5345
5346 with tmpdir() as uri:
5347 tiledb.DenseArray.create(uri, schema)
5348 tdb = tiledb.DenseArray(uri, "w")
5349
5350 rng = np.random.default_rng()
5351 ar1 = rng.standard_normal(tdb.schema.shape)
5352 ar2 = rng.standard_normal(tdb.schema.shape)
5353
5354 tdb[:] = {"attr1": ar1, "attr2": ar2}
5355 tdb = tiledb.DenseArray(uri, "r")
5356
5357 # basic round-trip from dask.array
5358 d = da.from_tiledb(uri, attribute="attr2")
5359 assert_eq(d, ar2)
5360
5361 # smoke-test computation directly on the TileDB view
5362 d = da.from_tiledb(uri, attribute="attr2")
5363 assert_eq(np.mean(ar2), d.mean().compute(scheduler="threads"))
5364
5365
5366def test_blockview():

Callers

nothing calls this directly

Calls 5

tmpdirFunction · 0.90
assert_eqFunction · 0.90
standard_normalMethod · 0.45
meanMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected