From 9133e28371654f150ffdc4dd9c5be3c99f941de6 Mon Sep 17 00:00:00 2001 From: Rutger Fick Date: Mon, 5 Nov 2018 15:12:03 +0100 Subject: [PATCH] pep8" --- .travis.yml | 2 +- .../intra_voxel_incoherent_motion.py | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a8f49ac..9c894109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ install: - python setup.py install --record installed_files.txt script: -- flake8 --ignore N802,N806,E731,F401,W504 `find . -name \*.py | grep -v setup.py | grep -v /doc/` +- flake8 --ignore N802,N806,E731,F401,W504,605 `find . -name \*.py | grep -v setup.py | grep -v /doc/` - nosetests --with-coverage -v #- travis-sphinx build -s doc #- for a in examples/*ipynb; do diff --git a/dmipy/custom_optimizers/intra_voxel_incoherent_motion.py b/dmipy/custom_optimizers/intra_voxel_incoherent_motion.py index ef1ea3f3..baf62366 100644 --- a/dmipy/custom_optimizers/intra_voxel_incoherent_motion.py +++ b/dmipy/custom_optimizers/intra_voxel_incoherent_motion.py @@ -14,14 +14,14 @@ def ivim_2step(acquisition_scheme, data, mask=None, bvalue_threshold=4e8, the blood flow and diffusion volume fractions and diffusivities, respectively. Changes in e.g. blood volume fraction has been linked to many pathologies such as the vasculature in tumor tissue [2]_. - + Because the apparent diffusivity of blood flow is much higher than that of Brownian motion, the optimization bounds for the diffusivities of the two Balls are disjoint; the diffusivies of the diffusion compartment range between [0.5 - 6]e-3 mm^2/s (results in more precise fit according to [3]), - and those of the blood compartment range between [6 - 20]e-3 mm^2/s - (following [4]). - + and those of the blood compartment range between [6 - 20]e-3 mm^2/s + (following [4]). + The 2-step optimization [5] hinges on the observation that the blood-flow signal is negligible at b-values above 200-400 s/mm^2, but it does have a constribution below that bvalue (and to the b0). @@ -33,11 +33,11 @@ def ivim_2step(acquisition_scheme, data, mask=None, bvalue_threshold=4e8, diffusivity of this compartment. - step 2: fit the 2-compartment model to the whole signal, but fixing the "diffusion" diffusivity to the value estimated in step 1. - + In the fitted ivim_fit model, partial_volume_0 and G1Ball_1_lambda_iso represent the tissue fraction and diffusivity, and partial_volume_1 and G1Ball_2_lambda_iso represent the blood fraction and diffusivity. - + Parameters ---------- acquisition_scheme: Dmipy AcquisitionScheme instance, @@ -46,7 +46,7 @@ def ivim_2step(acquisition_scheme, data, mask=None, bvalue_threshold=4e8, data: ND-array of shape (Nx, ..., N_DWI), measured data corresponding to the acquisition scheme. mask : (N-1)-dimensional integer/boolean array of size (N_x, N_y, ...), - Optional mask of voxels to be included in the optimization. + Optional mask of voxels to be included in the optimization. bvalue_threshold: float, the bvalue threshold at which to separate the blood/diffusion parts of the data. @@ -57,12 +57,12 @@ def ivim_2step(acquisition_scheme, data, mask=None, bvalue_threshold=4e8, whether or not to optimize (or just fix it to the mean of the b0-data) the S0 value in the second optimization step. fit_args: other keywords that are passed to the optimizer - + Returns ------- ivim_fit: Dmipy FittedMultiCompartmentModel instance, contains the fitted IVIM parameters. - + References ---------- .. [1] Le Bihan, D., Breton, E., Lallemand, D., Aubin, M. L., Vignaud, J., @@ -89,7 +89,7 @@ def ivim_2step(acquisition_scheme, data, mask=None, bvalue_threshold=4e8, bvalues=acquisition_scheme.bvalues[bvalue_mask], gradient_directions=acquisition_scheme.gradient_directions[ bvalue_mask]) - + gaussian_data = np.atleast_2d(data)[..., bvalue_mask] gaussian_mod = MultiCompartmentModel([G1Ball()]) @@ -101,7 +101,7 @@ def ivim_2step(acquisition_scheme, data, mask=None, bvalue_threshold=4e8, data=gaussian_data, optimize_S0=True, **fit_args) - + ivim_mod = MultiCompartmentModel([G1Ball(), G1Ball()]) ivim_mod.set_parameter_optimization_bounds( 'G1Ball_2_lambda_iso', [6e-9, 20e-9]) # [4] @@ -155,7 +155,7 @@ def ivim_Dstar_fixed(acquisition_scheme, data, mask=None, Dstar_value=7e-9, whether or not to optimize (or just fix it to the mean of the b0-data) the S0 value in the second optimization step. fit_args: other keywords that are passed to the optimizer - + Returns ------- ivim_fit: Dmipy FittedMultiCompartmentModel instance, @@ -201,4 +201,4 @@ def ivim_Dstar_fixed(acquisition_scheme, data, mask=None, Dstar_value=7e-9, msg = 'IVIM Dstar-fixed optimization of {0:d} voxels'.format(N_voxels) msg += ' complete in {0:.3f} seconds'.format(computation_time) print(msg) - return ivim_fit \ No newline at end of file + return ivim_fit