Skip to content

Commit

Permalink
Merge pull request #2018 from oesteban/maint/config-file
Browse files Browse the repository at this point in the history
ENH: Config module to replace long list of downstreamed arguments
  • Loading branch information
oesteban authored Mar 11, 2020
2 parents 572a3ed + 4d55e58 commit 1d93d9e
Show file tree
Hide file tree
Showing 41 changed files with 1,840 additions and 1,640 deletions.
22 changes: 12 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ jobs:
- data-v7-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- ds005-anat-v17-{{ .Branch }}-{{ .Revision }}
- ds005-anat-v17-{{ .Branch }}
- ds005-anat-v17-master
- ds005-anat-v17-
- ds005-anat-v18-{{ .Branch }}-{{ .Revision }}
- ds005-anat-v18-{{ .Branch }}
- ds005-anat-v18-master
- ds005-anat-v18-
- run:
name: Set-up a Docker registry
command: |
Expand Down Expand Up @@ -380,7 +380,7 @@ jobs:
rm -rf /tmp/ds005/work/reportlets
rm -rf /tmp/ds005/derivatives/fmriprep
- save_cache:
key: ds005-anat-v17-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
key: ds005-anat-v18-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
paths:
- /tmp/ds005/work

Expand All @@ -404,6 +404,8 @@ jobs:
--output-spaces MNI152NLin2009cAsym fsaverage5 fsnative MNI152NLin6Asym anat \
--use-plugin /home/circleci/src/fmriprep/.circleci/legacy.yml \
--nthreads 2 --cifti-output -vv
- store_artifacts:
path: /tmp/ds005/derivatives
- run:
name: Move intermediate results for second run
command: |
Expand All @@ -414,7 +416,7 @@ jobs:
name: Checking outputs of full fMRIPrep run
command: |
mkdir -p /tmp/ds005/test
find /tmp/ds005/derivatives -path */figures -prune -o -name "*" -print | sed s+/tmp/ds005/derivatives/++ | sort > /tmp/ds005/test/outputs.out
find /tmp/ds005/derivatives \( -path */figures -o -path */log \) -prune -o -name "*" -print | sed s+/tmp/ds005/derivatives/++ | sort > /tmp/ds005/test/outputs.out
diff /tmp/src/fmriprep/.circleci/ds005_outputs.txt /tmp/ds005/test/outputs.out
exit $?
- run:
Expand All @@ -437,7 +439,7 @@ jobs:
command: |
mkdir -p /tmp/ds005/test
sudo rm -rf /tmp/ds005/derivatives_partial/freesurfer
find /tmp/ds005/derivatives_partial -path */figures -prune -o -name "*" -print | sed s+/tmp/ds005/derivatives_partial/++ | sort > /tmp/ds005/test/outputs.out
find /tmp/ds005/derivatives_partial \( -path */figures -o -path */log \) -prune -o -name "*" -print | sed s+/tmp/ds005/derivatives_partial/++ | sort > /tmp/ds005/test/outputs.out
diff /tmp/src/fmriprep/.circleci/ds005_partial_outputs.txt /tmp/ds005/test/outputs.out
exit $?
- run:
Expand All @@ -458,7 +460,7 @@ jobs:
-exec sh -c 'rm -f {}; touch {}' \;
- store_artifacts:
path: /tmp/ds005
path: /tmp/ds005/work

ds054:
machine:
Expand Down Expand Up @@ -562,7 +564,7 @@ jobs:
name: Checking outputs of fMRIPrep
command: |
mkdir -p /tmp/ds054/test
find /tmp/ds054/derivatives -path */figures -prune -o -name "*" -print | sed s+/tmp/ds054/derivatives/++ | sort > /tmp/ds054/test/outputs.out
find /tmp/ds054/derivatives \( -path */figures -o -path */log \) -prune -o -name "*" -print | sed s+/tmp/ds054/derivatives/++ | sort > /tmp/ds054/test/outputs.out
diff /tmp/src/fmriprep/.circleci/ds054_outputs.txt /tmp/ds054/test/outputs.out
exit $?
- run:
Expand Down Expand Up @@ -700,7 +702,7 @@ jobs:
name: Checking outputs of fMRIPrep
command: |
mkdir -p /tmp/ds210/test
find /tmp/ds210/derivatives -path */figures -prune -o -name "*" -print | sed s+/tmp/ds210/derivatives/++ | sort > /tmp/ds210/test/outputs.out
find /tmp/ds210/derivatives \( -path */figures -o -path */log \) -prune -o -name "*" -print | sed s+/tmp/ds210/derivatives/++ | sort > /tmp/ds210/test/outputs.out
diff /tmp/src/fmriprep/.circleci/ds210_outputs.txt /tmp/ds210/test/outputs.out
exit $?
- run:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python:

before_install:
- python -m pip install --upgrade pip
- pip install "flake8<3.0" flake8-putty
- pip install flake8

script:
- flake8 fmriprep wrapper
5 changes: 5 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
================
Developers - API
================
Internal configuration system
-----------------------------

.. automodule:: fmriprep.config
:members: from_dict, load, get, dumps, to_filename, init_spaces

Workflows
---------
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Example: ::
Command-Line Arguments
----------------------
.. argparse::
:ref: fmriprep.cli.run.get_parser
:ref: fmriprep.cli.parser._build_parser
:prog: fmriprep
:nodefault:
:nodefaultconst:
Expand Down
99 changes: 13 additions & 86 deletions docs/workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,10 @@ is presented below:
:graph2use: orig
:simple_form: yes

from collections import namedtuple
from niworkflows.utils.spaces import Reference, SpatialReferences
from fmriprep.workflows.tests import mock_config
from fmriprep.workflows.base import init_single_subject_wf
BIDSLayout = namedtuple('BIDSLayout', ('root'))
wf = init_single_subject_wf(
anat_only=False,
aroma_melodic_dim=-200,
bold2t1w_dof=9,
cifti_output=False,
debug=False,
dummy_scans=None,
echo_idx=None,
err_on_aroma_warn=False,
fmap_bspline=False,
fmap_demean=True,
force_syn=True,
freesurfer=True,
hires=True,
ignore=[],
layout=BIDSLayout('.'),
longitudinal=False,
low_mem=False,
medial_surface_nan=False,
name='single_subject_wf',
omp_nthreads=1,
output_dir='.',
reportlets_dir='.',
regressors_all_comps=False,
regressors_dvars_th=1.5,
regressors_fd_th=0.5,
skull_strip_fixed_seed=False,
skull_strip_template=Reference('OASIS30ANTs'),
spaces=SpatialReferences(
spaces=[('MNI152Lin', {}),
('fsaverage', {'density': '10k'}),
('T1w', {}),
('fsnative', {})],
checkpoint=True),
subject_id='test',
t2s_coreg=False,
task_id='',
use_aroma=False,
use_bbr=True,
use_syn=True,
bids_filters=None,
)
with mock_config():
wf = init_single_subject_wf('01')

Preprocessing of structural MRI
-------------------------------
Expand Down Expand Up @@ -96,7 +54,7 @@ single reference template (see `Longitudinal processing`_).
skull_strip_fixed_seed=False,
)

See also *sMRIPrep*'s
See also *sMRIPrep*'s
:py:func:`~smriprep.workflows.anatomical.init_anat_preproc_wf`.

.. _t1preproc_steps:
Expand Down Expand Up @@ -218,7 +176,7 @@ would be processed by the following command::
-autorecon1 \
-noskullstrip

The second phase imports the brainmask calculated in the
The second phase imports the brainmask calculated in the
`Preprocessing of structural MRI`_ sub-workflow.
The final phase resumes reconstruction, using the T2w image to assist
in finding the pial surface, if available.
Expand Down Expand Up @@ -279,44 +237,13 @@ BOLD preprocessing
:graph2use: orig
:simple_form: yes

from collections import namedtuple
from niworkflows.utils.spaces import SpatialReferences
from fmriprep.workflows.tests import mock_config
from fmriprep import config
from fmriprep.workflows.bold.base import init_func_preproc_wf
BIDSLayout = namedtuple('BIDSLayout', ['root'])
wf = init_func_preproc_wf(
aroma_melodic_dim=-200,
bold2t1w_dof=9,
bold_file='/completely/made/up/path/sub-01_task-nback_bold.nii.gz',
cifti_output=False,
debug=False,
dummy_scans=None,
err_on_aroma_warn=False,
fmap_bspline=True,
fmap_demean=True,
force_syn=True,
freesurfer=True,
ignore=[],
low_mem=False,
medial_surface_nan=False,
omp_nthreads=1,
output_dir='.',
regressors_all_comps=False,
regressors_fd_th=0.5,
regressors_dvars_th=1.5,
reportlets_dir='.',
t2s_coreg=False,
spaces=SpatialReferences(
spaces=[('MNI152Lin', {}),
('fsaverage', {'density': '10k'}),
('T1w', {}),
('fsnative', {})],
checkpoint=True),
use_aroma=False,
use_bbr=True,
use_syn=True,
layout=BIDSLayout('.'),
num_bold=1,
)
with mock_config():
bold_file = config.execution.bids_dir / 'sub-01' / 'func' \
/ 'sub-01_task-mixedgamblestask_run-01_bold.nii.gz'
wf = init_func_preproc_wf(str(bold_file))

Preprocessing of :abbr:`BOLD (blood-oxygen level-dependent)` files is
split into multiple sub-workflows described below.
Expand Down Expand Up @@ -396,7 +323,7 @@ Slice time correction
wf = init_bold_stc_wf(
metadata={'RepetitionTime': 2.0,
'SliceTiming': [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]},
)
)

If the ``SliceTiming`` field is available within the input dataset metadata,
this workflow performs slice time correction prior to other signal resampling
Expand Down Expand Up @@ -501,7 +428,7 @@ Resampling BOLD runs onto standard spaces
This sub-workflow concatenates the transforms calculated upstream (see
`Head-motion estimation`_, `Susceptibility Distortion Correction (SDC)`_ --if
fieldmaps are available--, `EPI to T1w registration`_, and an anatomical-to-standard
transform from `Preprocessing of structural MRI`_) to map the
transform from `Preprocessing of structural MRI`_) to map the
:abbr:`EPI (echo-planar imaging)`
image to the standard spaces given by the ``--output-spaces`` argument
(see :ref:`output-spaces`).
Expand Down
4 changes: 1 addition & 3 deletions fmriprep/__about__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Base module variables
"""
"""Base module variables."""
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
Expand Down
27 changes: 9 additions & 18 deletions fmriprep/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
This pipeline is developed by the Poldrack lab at Stanford University
(https://poldracklab.stanford.edu/) for use at
the Center for Reproducible Neuroscience (http://reproducibility.stanford.edu/),
as well as for open-source software distribution.
"""
"""Top-module metadata."""

from .__about__ import ( # noqa
__version__,
from .__about__ import (
__copyright__,
__credits__,
__packagename__,
__version__,
)

import warnings

# cmp is not used by fmriprep, so ignore nipype-generated warnings
warnings.filterwarnings('ignore', r'cmp not installed')
warnings.filterwarnings('ignore', r'This has not been fully tested. Please report any failures.')
warnings.filterwarnings('ignore', r"can't resolve package from __spec__ or __package__")
warnings.simplefilter('ignore', DeprecationWarning)
warnings.simplefilter('ignore', ResourceWarning)
__all__ = [
'__copyright__',
'__credits__',
'__packagename__',
'__version__',
]
Loading

0 comments on commit 1d93d9e

Please sign in to comment.