diff --git a/.circleci/config.yml b/.circleci/config.yml index 903c2aa56d..6d842d2389 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -341,7 +341,7 @@ jobs: nipreps/sdcflows:latest \ pytest -v --junit-xml=/out/pytest.xml \ --cov sdcflows --cov-report xml:/out/unittests.xml \ - sdcflows/ + -n auto sdcflows/ - save_cache: key: workdir-v3-{{ .Branch }}-{{ .BuildNum }} paths: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 06ec4b298f..716c30d92c 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -175,7 +175,7 @@ jobs: run: | export LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH export PATH=$ANTSPATH:${AFNI_HOME}:/usr/lib/fsl/5.0:$PATH - pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules sdcflows + pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules -n auto sdcflows - uses: codecov/codecov-action@v4 with: diff --git a/sdcflows/utils/epimanip.py b/sdcflows/utils/epimanip.py index 6af5be7f21..a16e3a952d 100644 --- a/sdcflows/utils/epimanip.py +++ b/sdcflows/utils/epimanip.py @@ -23,13 +23,6 @@ """ Manipulation of EPI data. -.. testsetup:: - - >>> tmpdir = getfixture('tmpdir') - >>> tmp = tmpdir.chdir() # changing to a temporary directory - >>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename( - ... tmpdir.join('epi.nii.gz').strpath) - """ @@ -42,6 +35,15 @@ def get_trt(in_meta, in_file=None): The first option is that a ``TotalReadoutTime`` field is found in the JSON sidecar: + .. testsetup:: + + >>> cwd = os.getcwd() + >>> tmpdir = getfixture('tmpdir') + >>> tmp = tmpdir.chdir() # changing to a temporary directory + >>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename( + ... tmpdir.join('epi.nii.gz').strpath) + + >>> meta = {'TotalReadoutTime': 0.05251} >>> get_trt(meta) 0.05251 @@ -157,6 +159,10 @@ def get_trt(in_meta, in_file=None): Traceback (most recent call last): ValueError: + .. testcleanup:: + + >>> os.chdir(cwd) + .. admonition:: Thanks With thanks to Dr. Rorden for his thorough diff --git a/sdcflows/workflows/fit/syn.py b/sdcflows/workflows/fit/syn.py index a0783a6deb..447f1878b4 100644 --- a/sdcflows/workflows/fit/syn.py +++ b/sdcflows/workflows/fit/syn.py @@ -22,17 +22,6 @@ # """ Estimating the susceptibility distortions without fieldmaps. - -.. testsetup:: - - >>> tmpdir = getfixture('tmpdir') - >>> tmp = tmpdir.chdir() # changing to a temporary directory - >>> data = np.zeros((10, 10, 10, 1, 3)) - >>> data[..., 1] = 1 - >>> nb.Nifti1Image(data, None, None).to_filename( - ... tmpdir.join('field.nii.gz').strpath) - - """ from nipype.pipeline import engine as pe from nipype.interfaces import utility as niu @@ -138,9 +127,7 @@ def init_syn_sdc_wf( from ...interfaces.bspline import ( ApplyCoeffsField, BSplineApprox, - DEFAULT_LF_ZOOMS_MM, DEFAULT_HF_ZOOMS_MM, - DEFAULT_ZOOMS_MM, ) from ...interfaces.brainmask import BinaryDilation, Union @@ -272,9 +259,10 @@ def init_syn_sdc_wf( name="bs_filter", ) bs_filter.interface._always_run = debug - bs_filter.inputs.bs_spacing = ( - [DEFAULT_LF_ZOOMS_MM, DEFAULT_HF_ZOOMS_MM] if not sloppy else [DEFAULT_ZOOMS_MM] - ) + bs_filter.inputs.bs_spacing = [DEFAULT_HF_ZOOMS_MM] + + if sloppy: + bs_filter.inputs.zooms_min = 4.0 workflow.connect([ (inputnode, readout_time, [(("epi_ref", _pop), "in_file"),