Skip to content

Commit 4bf8016

Browse files
authored
Fixing pyramid scaling factor (#238)
* Fixing pyramid scaling factor * fix pyramid test * fix test again
1 parent 885661d commit 4bf8016

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

iohub/ngff/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ def initialize_pyramid(self, levels: int) -> None:
946946
for tr in transforms:
947947
if tr.type == "scale":
948948
for i in range(len(tr.scale))[-3:]:
949-
tr.scale[i] /= factor
949+
tr.scale[i] *= factor
950950

951951
self.create_zeros(
952952
name=str(level),

tests/pyramid/test_pyramid.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def _mock_fov(
1818
shape: tuple[int, ...],
1919
scale: tuple[float, float, float],
2020
) -> Position:
21-
2221
ds_path = tmp_path / "ds.zarr"
2322
channels = [str(i) for i in range(shape[1])]
2423

@@ -51,7 +50,6 @@ def _mock_fov(
5150

5251
@pytest.mark.parametrize("ndim", [2, 5])
5352
def test_pyramid(tmp_path: Path, ndim: int) -> None:
54-
5553
# not all shapes not divisible by 2
5654
shape = (2, 2, 67, 115, 128)[-ndim:]
5755
scale = (2, 0.5, 0.5)[-min(3, ndim) :]
@@ -79,7 +77,7 @@ def test_pyramid(tmp_path: Path, ndim: int) -> None:
7977
.scale
8078
)
8179
assert np.all(level_scale[:-3] == 1)
82-
assert np.allclose(scale / level_scale[-3:], 2**level)
80+
assert np.allclose(level_scale[-3:] / scale, 2**level)
8381

8482
assert fov.metadata.multiscales[0].datasets[level].path == str(level)
8583

0 commit comments

Comments
 (0)