- base & view model for imread

- transforms bugfix
- implement (nan)var and (nan)std
- add tests
This commit is contained in:
Wim Pomp
2023-08-18 18:10:42 +02:00
parent bdd7a5399c
commit ff6c1aa8a8
13 changed files with 929 additions and 779 deletions

View File

@@ -1,12 +1,25 @@
import pickle
import pytest
from pathlib import Path
from multiprocessing import active_children
from ndbioimage import Imread, ReaderNotFoundError
@pytest.mark.parametrize("file", (Path(__file__).parent / 'files').iterdir())
@pytest.mark.parametrize('file', (Path(__file__).parent / 'files').iterdir())
def test_open(file):
try:
with Imread(file) as im:
print(im[dict(c=0, z=0, t=0)].mean())
mean = im[dict(c=0, z=0, t=0)].mean()
b = pickle.dumps(im)
jm = pickle.loads(b)
assert jm[dict(c=0, z=0, t=0)].mean() == mean
v = im.view()
assert v[dict(c=0, z=0, t=0)].mean() == mean
b = pickle.dumps(v)
w = pickle.loads(b)
assert w[dict(c=0, z=0, t=0)].mean() == mean
except ReaderNotFoundError:
assert len(Imread.__subclasses__()), "No subclasses for Imread found."
assert len(Imread.__subclasses__()), 'No subclasses for Imread found.'
for child in active_children():
child.kill()