Skip to content

Commit bcd9a2b

Browse files
ziw-liualiddell
andauthored
Update acquire-zarr tests (#320)
Update acquire-zarr OME v0.5 fixture / aqz test to reflect new config API and downsampling behavior Co-authored-by: Alan Liddell <aliddell@chanzuckerberg.com>
1 parent 5382c06 commit bcd9a2b

2 files changed

Lines changed: 53 additions & 46 deletions

File tree

tests/conftest.py

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -184,51 +184,55 @@ def aqz_ome_zarr_05(tmpdir):
184184
store_path = tmpdir / "ome_zarr_v0.5.zarr"
185185

186186
settings = aqz.StreamSettings(
187-
compression=aqz.CompressionSettings(
188-
codec=aqz.CompressionCodec.BLOSC_LZ4,
189-
compressor=aqz.Compressor.BLOSC1,
190-
level=1,
191-
shuffle=0,
192-
),
193-
data_type=aqz.DataType.UINT16,
194-
dimensions=[
195-
aqz.Dimension(
196-
name="t",
197-
kind=aqz.DimensionType.TIME,
198-
array_size_px=0,
199-
chunk_size_px=16,
200-
shard_size_chunks=1,
201-
),
202-
aqz.Dimension(
203-
name="c",
204-
kind=aqz.DimensionType.CHANNEL,
205-
array_size_px=4,
206-
chunk_size_px=1,
207-
shard_size_chunks=1,
208-
),
209-
aqz.Dimension(
210-
name="z",
211-
kind=aqz.DimensionType.SPACE,
212-
array_size_px=10,
213-
chunk_size_px=10,
214-
shard_size_chunks=1,
215-
),
216-
aqz.Dimension(
217-
name="y",
218-
kind=aqz.DimensionType.SPACE,
219-
array_size_px=48,
220-
chunk_size_px=16,
221-
shard_size_chunks=3,
222-
),
223-
aqz.Dimension(
224-
name="x",
225-
kind=aqz.DimensionType.SPACE,
226-
array_size_px=64,
227-
chunk_size_px=16,
228-
shard_size_chunks=2,
229-
),
187+
arrays=[
188+
aqz.ArraySettings(
189+
data_type=np.uint16,
190+
compression=aqz.CompressionSettings(
191+
codec=aqz.CompressionCodec.BLOSC_LZ4,
192+
compressor=aqz.Compressor.BLOSC1,
193+
level=1,
194+
shuffle=0,
195+
),
196+
dimensions=[
197+
aqz.Dimension(
198+
name="t",
199+
kind=aqz.DimensionType.TIME,
200+
array_size_px=0,
201+
chunk_size_px=16,
202+
shard_size_chunks=1,
203+
),
204+
aqz.Dimension(
205+
name="c",
206+
kind=aqz.DimensionType.CHANNEL,
207+
array_size_px=4,
208+
chunk_size_px=1,
209+
shard_size_chunks=1,
210+
),
211+
aqz.Dimension(
212+
name="z",
213+
kind=aqz.DimensionType.SPACE,
214+
array_size_px=10,
215+
chunk_size_px=10,
216+
shard_size_chunks=1,
217+
),
218+
aqz.Dimension(
219+
name="y",
220+
kind=aqz.DimensionType.SPACE,
221+
array_size_px=48,
222+
chunk_size_px=16,
223+
shard_size_chunks=3,
224+
),
225+
aqz.Dimension(
226+
name="x",
227+
kind=aqz.DimensionType.SPACE,
228+
array_size_px=64,
229+
chunk_size_px=16,
230+
shard_size_chunks=2,
231+
),
232+
],
233+
downsampling_method=aqz.DownsamplingMethod.MEAN,
234+
)
230235
],
231-
multiscale=True,
232236
store_path=str(store_path),
233237
version=aqz.ZarrVersion.V3,
234238
max_threads=1,

tests/ngff/test_ngff.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,13 +1337,16 @@ def test_acquire_zarr_ome_zarr_05(aqz_ome_zarr_05):
13371337
assert len(dataset.zattrs["ome"]["multiscales"]) == 1
13381338

13391339
multiscale = dataset.zattrs["ome"]["multiscales"][0]
1340-
assert len(multiscale["datasets"]) == 2
1340+
assert len(multiscale["datasets"]) == 3
13411341
assert multiscale["datasets"][0]["coordinateTransformations"][0][
13421342
"scale"
13431343
] == [1.0, 1.0, 1.0, 1.0, 1.0]
13441344
assert multiscale["datasets"][1]["coordinateTransformations"][0][
13451345
"scale"
1346-
] == [1.0, 1.0, 2.0, 2.0, 2.0]
1346+
] == [1.0, 1.0, 1.0, 2.0, 2.0]
1347+
assert multiscale["datasets"][2]["coordinateTransformations"][0][
1348+
"scale"
1349+
] == [1.0, 1.0, 1.0, 4.0, 4.0]
13471350
assert 1 < dataset["0"].numpy().mean() < np.iinfo(np.uint16).max
13481351

13491352

0 commit comments

Comments
 (0)