Skip to content

Commit 8f9ff8d

Browse files
committed
pydra layout
1 parent bf8397e commit 8f9ff8d

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Test with pytest
3333
run: |
3434
pip install -r requirements-dev.txt
35-
pytest tests.py -v --doctest-modules --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml
35+
pytest tests/ -v --cov=simtk --doctest-modules --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml
3636
- name: Upload pytest test results
3737
uses: actions/upload-artifact@v2
3838
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.coverage
22
coverage.xml
33
.benchmarks
4+
benchmark*svg

simtk/pydra.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""simtk pydra tasks and workflows."""
2+
3+
# __all__ = [
4+
# 'load_image_task'
5+
# ]
6+
7+
# import numpy as np
8+
# from pydra import mark
9+
# import itk
10+
11+
# from simtk import load_image
12+
13+
# load_image_annotated = mark.annotate({'filename': str, 'nphases': int,
14+
# 'norientations': int, 'spacing': np.ndarray, 'return': itk.VectorImage })(load_image)
15+
# load_image_task = mark.task(load_image_annotated)()

tests/test_pydra.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from pathlib import Path
2+
import os
3+
import sys
4+
5+
import itk
6+
import numpy as np
7+
8+
script_dir = Path(__file__).resolve().parent
9+
data_dir = (script_dir / '..' / 'data').resolve()
10+
if not (data_dir / 'input' / 'Cell_3phase.tif').exists():
11+
print('Testing data not available.')
12+
sys.exit(1)
13+
package_dir = (script_dir / '..').resolve()
14+
sys.path.insert(0, str(package_dir))
15+
16+
test_psf_file = str(data_dir / 'input' / 'PSF_3phase.tif')
17+
18+
import simtk.pydra
19+
20+
def test_import_simtk_pydra():
21+
assert 'simtk' in simtk.pydra.__doc__
22+
assert 'pydra' in simtk.pydra.__doc__

tests.py renamed to tests/test_simtk.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@
66
import numpy as np
77

88
script_dir = Path(__file__).resolve().parent
9-
data_dir = (script_dir / 'data').resolve()
9+
data_dir = (script_dir / '..' / 'data').resolve()
1010
if not (data_dir / 'input' / 'Cell_3phase.tif').exists():
1111
print('Testing data not available.')
1212
sys.exit(1)
13+
package_dir = (script_dir / '..').resolve()
14+
sys.path.insert(0, str(package_dir))
1315

1416
test_psf_file = str(data_dir / 'input' / 'PSF_3phase.tif')
1517

16-
import simtk
18+
from simtk import load_image
1719

1820
def test_package():
1921
import simtk
2022
assert hasattr(simtk, '__version__')
2123

2224
def test_load_image(benchmark):
23-
image = benchmark(simtk.load_image, test_psf_file, spacing=[0.11, 0.11, 0.1])
25+
image = benchmark(load_image, test_psf_file, spacing=[0.11, 0.11, 0.1])
2426

2527
baseline = str(data_dir / 'baseline' / 'load_image.nrrd')
2628
baseline_image = itk.imread(baseline)

0 commit comments

Comments
 (0)