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

Function test_tiledb_multiattr

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

Source from the content-addressed store, hash-verified

5178
5179
5180def test_tiledb_multiattr():
5181 tiledb = pytest.importorskip("tiledb")
5182 dom = tiledb.Domain(
5183 tiledb.Dim("x", (0, 1000), tile=100), tiledb.Dim("y", (0, 1000), tile=100)
5184 )
5185 schema = tiledb.ArraySchema(
5186 attrs=(tiledb.Attr("attr1"), tiledb.Attr("attr2")), domain=dom
5187 )
5188
5189 with tmpdir() as uri:
5190 tiledb.DenseArray.create(uri, schema)
5191 tdb = tiledb.DenseArray(uri, "w")
5192
5193 rng = np.random.default_rng()
5194 ar1 = rng.standard_normal(tdb.schema.shape)
5195 ar2 = rng.standard_normal(tdb.schema.shape)
5196
5197 tdb[:] = {"attr1": ar1, "attr2": ar2}
5198 tdb = tiledb.DenseArray(uri, "r")
5199
5200 # basic round-trip from dask.array
5201 d = da.from_tiledb(uri, attribute="attr2")
5202 assert_eq(d, ar2)
5203
5204 # smoke-test computation directly on the TileDB view
5205 d = da.from_tiledb(uri, attribute="attr2")
5206 assert_eq(np.mean(ar2), d.mean().compute(scheduler="threads"))
5207
5208
5209def 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