From 1bd881d9ebb666493ced8d6746ce7826ed808be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 15 Aug 2024 20:18:51 -0400 Subject: [PATCH 1/3] DOC: Do not use raw strings where not necessary Do not use raw strings where not necessary. --- dipy/reconst/mapmri.py | 52 ++++++++++++++++----------------- dipy/sims/voxel.py | 4 +-- dipy/tracking/local_tracking.py | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dipy/reconst/mapmri.py b/dipy/reconst/mapmri.py index 022be34b08..51e3dabf34 100644 --- a/dipy/reconst/mapmri.py +++ b/dipy/reconst/mapmri.py @@ -537,7 +537,7 @@ def odf(self, sphere, s=2): return odf def odf_sh(self, s=2): - r"""Calculates the real analytical odf for a given discrete sphere. + """Calculates the real analytical odf for a given discrete sphere. Computes the design matrix of the ODF for the given sphere vertices and radial moment :footcite:p:`Ozarslan2013` eq. (32). The radial moment @@ -564,7 +564,7 @@ def odf_sh(self, s=2): return odf def rtpp(self): - r"""Calculates the analytical return to the plane probability (RTPP). + """Calculates the analytical return to the plane probability (RTPP). RTPP is defined in :footcite:p:`Ozarslan2013` eq. (42). The analytical formula for the isotropic MAP-MRI basis was derived in @@ -620,7 +620,7 @@ def rtpp(self): return rtpp.sum() def rtap(self): - r"""Calculates the analytical return to the axis probability (RTAP). + """Calculates the analytical return to the axis probability (RTAP). RTAP is defined in :footcite:p:`Ozarslan2013` eq. (40, 44a). The analytical formula for the isotropic MAP-MRI basis was derived in @@ -674,7 +674,7 @@ def rtap(self): return rtap def rtop(self): - r"""Calculates the analytical return to the origin probability (RTOP). + """Calculates the analytical return to the origin probability (RTOP). RTOP is defined in :footcite:p:`Ozarslan2013` eq. (36, 43). The analytical formula for the isotropic MAP-MRI basis was derived in @@ -699,7 +699,7 @@ def rtop(self): return rtop def msd(self): - r"""Calculates the analytical Mean Squared Displacement (MSD). + """Calculates the analytical Mean Squared Displacement (MSD). It is defined as the Laplacian of the origin of the estimated signal :footcite:p:`Cheng2012`. The analytical formula for the MAP-MRI basis @@ -747,7 +747,7 @@ def msd(self): return msd def qiv(self): - r"""Calculates the analytical Q-space Inverse Variance (QIV). + """Calculates the analytical Q-space Inverse Variance (QIV). It is defined as the inverse of the Laplacian of the origin of the estimated propagator :footcite:p:`Hosseinbor2013` eq. (22). The @@ -1000,7 +1000,7 @@ def pdf(self, r_points): def isotropic_scale_factor(mu_squared): - r"""Estimated isotropic scaling factor. + """Estimated isotropic scaling factor. See :footcite:p:`Ozarslan2013` Eq. (49). @@ -1026,7 +1026,7 @@ def isotropic_scale_factor(mu_squared): def mapmri_index_matrix(radial_order): - r"""Calculates the indices for the MAPMRI basis in x, y and z. + """Calculates the indices for the MAPMRI basis in x, y and z. See :footcite:p:`Ozarslan2013` for a definition of MAPMRI. @@ -1054,7 +1054,7 @@ def mapmri_index_matrix(radial_order): def b_mat(index_matrix): - r"""Calculates the B coefficients from + """Calculates the B coefficients from See :footcite:p:`Ozarslan2013` Eq. (27). @@ -1087,7 +1087,7 @@ def b_mat(index_matrix): def b_mat_isotropic(index_matrix): - r"""Calculates the isotropic B coefficients. + """Calculates the isotropic B coefficients. See :footcite:p:`Ozarslan2013` Fig 8. @@ -1115,7 +1115,7 @@ def b_mat_isotropic(index_matrix): def mapmri_phi_1d(n, q, mu): - r"""One dimensional MAPMRI basis function. + """One dimensional MAPMRI basis function. See :footcite:p:`Ozarslan2013` Eq. (4). @@ -1145,7 +1145,7 @@ def mapmri_phi_1d(n, q, mu): def mapmri_phi_matrix(radial_order, mu, q_gradients): - r"""Compute the MAPMRI phi matrix for the signal. + """Compute the MAPMRI phi matrix for the signal. See :footcite:p:`Ozarslan2013` eq. (23). @@ -1191,7 +1191,7 @@ def mapmri_phi_matrix(radial_order, mu, q_gradients): def mapmri_psi_1d(n, x, mu): - r"""One dimensional MAPMRI propagator basis function. + """One dimensional MAPMRI propagator basis function. See :footcite:p:`Ozarslan2013` Eq. (10). @@ -1218,7 +1218,7 @@ def mapmri_psi_1d(n, x, mu): def mapmri_psi_matrix(radial_order, mu, rgrad): - r"""Compute the MAPMRI psi matrix for the propagator. + """Compute the MAPMRI psi matrix for the propagator. See :footcite:p:`Ozarslan2013` eq. (22). @@ -1261,7 +1261,7 @@ def mapmri_psi_matrix(radial_order, mu, rgrad): def mapmri_odf_matrix(radial_order, mu, s, vertices): - r"""Compute the MAPMRI ODF matrix. + """Compute the MAPMRI ODF matrix. See :footcite:p:`Ozarslan2013` Eq. (33). @@ -1311,7 +1311,7 @@ def mapmri_odf_matrix(radial_order, mu, s, vertices): def _odf_cfunc(n1, n2, n3, a, b, g, s): - r"""Compute the MAPMRI ODF function. + """Compute the MAPMRI ODF function. See :footcite:p:`Ozarslan2013` Eq. (34). @@ -1340,7 +1340,7 @@ def _odf_cfunc(n1, n2, n3, a, b, g, s): def mapmri_isotropic_phi_matrix(radial_order, mu, q): - r"""Three dimensional isotropic MAPMRI signal basis function + """Three dimensional isotropic MAPMRI signal basis function See :footcite:p:`Ozarslan2013` Eq. (61). @@ -1380,7 +1380,7 @@ def mapmri_isotropic_phi_matrix(radial_order, mu, q): def mapmri_isotropic_radial_signal_basis(j, l_value, mu, qval): - r"""Radial part of the isotropic 1D-SHORE signal basis. + """Radial part of the isotropic 1D-SHORE signal basis. See :footcite:p:`Ozarslan2013` eq. (61). @@ -1464,7 +1464,7 @@ def mapmri_isotropic_M_mu_dependent(radial_order, mu, qval): def mapmri_isotropic_psi_matrix(radial_order, mu, rgrad): - r"""Three dimensional isotropic MAPMRI propagator basis function. + """Three dimensional isotropic MAPMRI propagator basis function. See :footcite:p:`Ozarslan2013` Eq. (61). @@ -1505,7 +1505,7 @@ def mapmri_isotropic_psi_matrix(radial_order, mu, rgrad): def mapmri_isotropic_radial_pdf_basis(j, l_value, mu, r): - r"""Radial part of the isotropic 1D-SHORE propagator basis. + """Radial part of the isotropic 1D-SHORE propagator basis. See :footcite:p:`Ozarslan2013` eq. (61). @@ -1593,9 +1593,9 @@ def binomialfloat(n, k): def mapmri_isotropic_odf_matrix(radial_order, mu, s, vertices): - r"""Compute the isotropic MAPMRI ODF matrix. + """Compute the isotropic MAPMRI ODF matrix. - The computation follows :footcite:p:`Ozarslan2013` Eq. 32 but, it is done + The computation follows :footcite:p:`Ozarslan2013` Eq. 32, but it is done for the isotropic propagator in footcite:p:`Ozarslan2013` eq. (60). Analytical derivation in :footcite:p:`Fick2016b` eq. (C8). @@ -1650,7 +1650,7 @@ def mapmri_isotropic_odf_matrix(radial_order, mu, s, vertices): def mapmri_isotropic_odf_sh_matrix(radial_order, mu, s): - r"""Compute the isotropic MAPMRI ODF matrix. + """Compute the isotropic MAPMRI ODF matrix. The computation follows :footcite:p:`Ozarslan2013` Eq. 32, but it is done for the isotropic propagator in :footcite:p:`Ozarslan2013` eq. (60). Here @@ -1705,7 +1705,7 @@ def mapmri_isotropic_odf_sh_matrix(radial_order, mu, s): def mapmri_isotropic_laplacian_reg_matrix(radial_order, mu): - r"""Computes the Laplacian regularization matrix for MAP-MRI's isotropic + """Computes the Laplacian regularization matrix for MAP-MRI's isotropic implementation. See :footcite:p:`Fick2016b` eq. (C7). @@ -1732,7 +1732,7 @@ def mapmri_isotropic_laplacian_reg_matrix(radial_order, mu): def mapmri_isotropic_laplacian_reg_matrix_from_index_matrix(ind_mat, mu): - r"""Computes the Laplacian regularization matrix for MAP-MRI's isotropic + """Computes the Laplacian regularization matrix for MAP-MRI's isotropic implementation. See :footcite:p:`Fick2016b` eq. (C7). @@ -1816,7 +1816,7 @@ def mapmri_isotropic_laplacian_reg_matrix_from_index_matrix(ind_mat, mu): def mapmri_isotropic_index_matrix(radial_order): - r"""Calculates the indices for the isotropic MAPMRI basis. + """Calculates the indices for the isotropic MAPMRI basis. See :footcite:p:`Ozarslan2013` Fig 8. diff --git a/dipy/sims/voxel.py b/dipy/sims/voxel.py index 6b79045ce0..0ec0914ec8 100644 --- a/dipy/sims/voxel.py +++ b/dipy/sims/voxel.py @@ -201,7 +201,7 @@ def sticks_and_ball( def callaghan_perpendicular(q, radius): - r"""Calculates the perpendicular diffusion signal E(q) in a cylinder of + """Calculates the perpendicular diffusion signal E(q) in a cylinder of radius R using the Soderman model. Assumes that the pulse length is infinitely short and the diffusion time is @@ -268,7 +268,7 @@ def cylinders_and_ball_soderman( fractions=(35, 35), snr=20, ): - r"""Calculates the three-dimensional signal attenuation E(q) originating + """Calculates the three-dimensional signal attenuation E(q) originating from within a cylinder of radius R using the Soderman approximation. The diffusion signal is assumed to be separable perpendicular and parallel diff --git a/dipy/tracking/local_tracking.py b/dipy/tracking/local_tracking.py index 34923cb717..a512b8cb33 100644 --- a/dipy/tracking/local_tracking.py +++ b/dipy/tracking/local_tracking.py @@ -295,7 +295,7 @@ def __init__( randomize_forward_direction=False, initial_directions=None, ): - r"""A streamline generator using the particle filtering tractography + """A streamline generator using the particle filtering tractography method. See :footcite:p:`Girard2014` for further details about the method. From 000c3fe5f9d1d81a54be3f7d9b19288a63ed9ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 15 Aug 2024 20:38:38 -0400 Subject: [PATCH 2/3] DOC: Increase consistency in optional argument syntax Increase consistency in optional argument syntax: - Mark optional arguments as such. - Use the same syntax when marking optional arguments as such: use `{argument_name}, optional` Remove default parameter values from the modified docstrings to reduce the maintenance burden and avoids the risk of inconsistencies if the default value is changed in the method signature but not the parameter docstring. --- dipy/align/streamwarp.py | 2 +- dipy/core/optimize.py | 12 ++++---- dipy/denoise/enhancement_kernel.pyx | 6 ++-- dipy/denoise/localpca.py | 48 ++++++++++++++--------------- dipy/denoise/noise_estimate.py | 14 ++++----- dipy/io/stateful_tractogram.py | 2 +- dipy/nn/deepn4.py | 2 +- dipy/nn/evac.py | 2 +- dipy/nn/histo_resdnn.py | 4 +-- dipy/nn/synb0.py | 2 +- dipy/reconst/csdeconv.py | 36 ++++++++++------------ dipy/reconst/cti.py | 6 ++-- dipy/reconst/dki.py | 48 ++++++++++++++--------------- dipy/reconst/dki_micro.py | 10 +++--- dipy/reconst/dsi.py | 8 ++--- dipy/reconst/forecast.py | 10 +++--- dipy/reconst/fwdti.py | 12 ++++---- dipy/reconst/gqi.py | 4 +-- dipy/reconst/mapmri.py | 14 ++++----- dipy/reconst/mcsd.py | 8 ++--- dipy/reconst/msdki.py | 8 ++--- dipy/reconst/sfm.py | 4 +-- dipy/reconst/shore.py | 19 ++++++------ dipy/segment/bundles.py | 4 +-- dipy/segment/clustering.py | 16 +++++----- dipy/segment/mask.py | 6 ++-- dipy/sims/voxel.py | 40 ++++++++++++------------ dipy/stats/analysis.py | 6 ++-- dipy/stats/qc.py | 2 +- dipy/stats/resampling.py | 12 ++++---- dipy/tracking/life.py | 4 +-- dipy/tracking/streamlinespeed.pyx | 4 +-- dipy/viz/regtools.py | 22 ++++++------- 33 files changed, 197 insertions(+), 200 deletions(-) diff --git a/dipy/align/streamwarp.py b/dipy/align/streamwarp.py index 352be5f4fe..a9f336213b 100755 --- a/dipy/align/streamwarp.py +++ b/dipy/align/streamwarp.py @@ -73,7 +73,7 @@ def bundlewarp( moving : Streamlines Target bundle that will be moved/registered to match the static bundle - dist : float, optional. + dist : float, optional Precomputed distance matrix (default None) alpha : float, optional diff --git a/dipy/core/optimize.py b/dipy/core/optimize.py index 6701303d73..6069106ada 100644 --- a/dipy/core/optimize.py +++ b/dipy/core/optimize.py @@ -260,15 +260,15 @@ def sparse_nnls( non_neg : Boolean, optional (default: True) Whether to enforce non-negativity of the solution. - check_error_iter : int (default:10) + check_error_iter : int, optional How many rounds to run between error evaluation for convergence-checking. - max_error_checks : int (default: 10) + max_error_checks : int, optional Don't check errors more than this number of times if no improvement in r-squared is seen. - converge_on_sse : float (default: 0.99) + converge_on_sse : float, optional a percentage improvement in SSE that is required each time to say that things are still going well. @@ -397,9 +397,9 @@ def __init__(self, m, *, A=None, L=None): ---------- m : int Positive int indicating the number of regressors. - A : array (t = m + k + 1, p, p) (optional) + A : array (t = m + k + 1, p, p), optional Constraint matrices $A$. - L : array (m, m) (optional) + L : array (m, m), optional Regularization matrix $L$. Default: None. @@ -493,7 +493,7 @@ def solve(self, design_matrix, measurements, *, check=False, **kwargs): Design matrix. measurements : array (n) Measurements. - check : boolean (optional) + check : boolean, optional If True check whether the unconstrained optimization solution already satisfies the constraints, before running the constrained optimization. This adds overhead, but can avoid unnecessary diff --git a/dipy/denoise/enhancement_kernel.pyx b/dipy/denoise/enhancement_kernel.pyx index 1612b9bd01..867b1082d9 100644 --- a/dipy/denoise/enhancement_kernel.pyx +++ b/dipy/denoise/enhancement_kernel.pyx @@ -40,14 +40,14 @@ cdef class EnhancementKernel: Angular diffusion t : float Diffusion time - force_recompute : boolean + force_recompute : boolean, optional Always compute the look-up table even if it is available in cache. Default is False. - orientations : integer or Sphere object + orientations : integer or Sphere object, optional Specify the number of orientations to be used with electrostatic repulsion, or provide a Sphere object. The default sphere is 'repulsion100'. - verbose : boolean + verbose : boolean, optional Enable verbose mode. References diff --git a/dipy/denoise/localpca.py b/dipy/denoise/localpca.py index 9918c08e7a..ccd994e7dd 100644 --- a/dipy/denoise/localpca.py +++ b/dipy/denoise/localpca.py @@ -198,23 +198,23 @@ def genpca( Array of data to be denoised. The dimensions are (X, Y, Z, N), where N are the diffusion gradient directions. The first 3 dimension must have size >= 2 * patch_radius + 1 or size = 1. - sigma : float or 3D array (optional) + sigma : float or 3D array, optional Standard deviation of the noise estimated from the data. If no sigma is given, this will be estimated based on random matrix theory :footcite:p:`Veraart2016b`, :footcite:p:`Veraart2016c`. - mask : 3D boolean array (optional) + mask : 3D boolean array, optional A mask with voxels that are true inside the brain and false outside of it. The function denoises within the true part and returns zeros outside of those voxels. - patch_radius : int or 1D array (optional) + patch_radius : int or 1D array, optional The radius of the local patch to be taken around each voxel (in voxels). E.g. patch_radius=2 gives 5x5x5 patches. - pca_method : 'eig' or 'svd' (optional) + pca_method : 'eig' or 'svd', optional Use either eigenvalue decomposition (eig) or singular value decomposition (svd) for principal component analysis. The default method is 'eig' which is faster. However, occasionally 'svd' might be more accurate. - tau_factor : float (optional) + tau_factor : float, optional Thresholding of PCA eigenvalues is done by nulling out eigenvalues that are smaller than: @@ -225,12 +225,12 @@ def genpca( $\tau_{factor}$ can be set to a predefined values (e.g. $\tau_{factor} = 2.3$ :footcite:p:`Manjon2013`), or automatically calculated using random matrix theory (in case that $\tau_{factor}$ is set to None). - return_sigma : bool (optional) + return_sigma : bool, optional If true, the Standard deviation of the noise will be returned. - out_dtype : str or dtype (optional) + out_dtype : str or dtype, optional The dtype for the output array. Default: output has the same dtype as the input. - suppress_warning : bool (optional) + suppress_warning : bool, optional If true, suppress warning caused by patch_size < arr.shape[-1]. Returns @@ -413,30 +413,30 @@ def localpca( arr : 4D array Array of data to be denoised. The dimensions are (X, Y, Z, N), where N are the diffusion gradient directions. - sigma : float or 3D array (optional) + sigma : float or 3D array, optional Standard deviation of the noise estimated from the data. If not given, calculate using method in :footcite:t:`Manjon2013`. - mask : 3D boolean array (optional) + mask : 3D boolean array, optional A mask with voxels that are true inside the brain and false outside of it. The function denoises within the true part and returns zeros outside of those voxels. - patch_radius : int or 1D array (optional) + patch_radius : int or 1D array, optional The radius of the local patch to be taken around each voxel (in voxels). E.g. patch_radius=2 gives 5x5x5 patches. gtab: gradient table object (optional if sigma is provided) gradient information for the data gives us the bvals and bvecs of diffusion data, which is needed to calculate noise level if sigma is not provided. - patch_radius_sigma : int (optional) + patch_radius_sigma : int, optional The radius of the local patch to be taken around each voxel (in voxels) for estimating sigma. E.g. patch_radius_sigma=2 gives 5x5x5 patches. - pca_method : 'eig' or 'svd' (optional) + pca_method : 'eig' or 'svd', optional Use either eigenvalue decomposition (eig) or singular value decomposition (svd) for principal component analysis. The default method is 'eig' which is faster. However, occasionally 'svd' might be more accurate. - tau_factor : float (optional) + tau_factor : float, optional Thresholding of PCA eigenvalues is done by nulling out eigenvalues that are smaller than: @@ -449,16 +449,16 @@ def localpca( set to None, it will be automatically calculated using the Marcenko-Pastur distribution :footcite:p:`Veraart2016c`. Default: 2.3 according to :footcite:t:`Manjon2013`. - return_sigma : bool (optional) + return_sigma : bool, optional If true, a noise standard deviation estimate based on the Marcenko-Pastur distribution is returned :footcite:p:`Veraart2016c`. - correct_bias : bool (optional) + correct_bias : bool, optional Whether to correct for bias due to Rician noise. This is an implementation of equation 8 in :footcite:p:`Manjon2013`. - out_dtype : str or dtype (optional) + out_dtype : str or dtype, optional The dtype for the output array. Default: output has the same dtype as the input. - suppress_warning : bool (optional) + suppress_warning : bool, optional If true, suppress warning caused by patch_size < arr.shape[-1]. Returns @@ -519,25 +519,25 @@ def mppca( arr : 4D array Array of data to be denoised. The dimensions are (X, Y, Z, N), where N are the diffusion gradient directions. - mask : 3D boolean array (optional) + mask : 3D boolean array, optional A mask with voxels that are true inside the brain and false outside of it. The function denoises within the true part and returns zeros outside of those voxels. - patch_radius : int or 1D array (optional) + patch_radius : int or 1D array, optional The radius of the local patch to be taken around each voxel (in voxels). E.g. patch_radius=2 gives 5x5x5 patches. - pca_method : 'eig' or 'svd' (optional) + pca_method : 'eig' or 'svd', optional Use either eigenvalue decomposition (eig) or singular value decomposition (svd) for principal component analysis. The default method is 'eig' which is faster. However, occasionally 'svd' might be more accurate. - return_sigma : bool (optional) + return_sigma : bool, optional If true, a noise standard deviation estimate based on the Marcenko-Pastur distribution is returned :footcite:p:`Veraart2016b`. - out_dtype : str or dtype (optional) + out_dtype : str or dtype, optional The dtype for the output array. Default: output has the same dtype as the input. - suppress_warning : bool (optional) + suppress_warning : bool, optional If true, suppress warning caused by patch_size < arr.shape[-1]. Returns diff --git a/dipy/denoise/noise_estimate.py b/dipy/denoise/noise_estimate.py index 6bb08438d7..e68ec9519c 100644 --- a/dipy/denoise/noise_estimate.py +++ b/dipy/denoise/noise_estimate.py @@ -77,7 +77,7 @@ def piesno(data, N, *, alpha=0.01, step=100, itermax=100, eps=1e-5, return_mask= sigma : float The estimated standard deviation of the gaussian noise. - mask : ndarray (optional) + mask : ndarray, optional A boolean mask indicating the voxels identified as pure noise. Notes @@ -176,27 +176,27 @@ def _piesno_3D( N : int The number of phase array coils of the MRI scanner. - alpha : float (optional) + alpha : float, optional Probabilistic estimation threshold for the gamma function. Default: 0.01. - step : int (optional) + step : int, optional number of initial estimates for sigma to try. Default: 100. - itermax : int (optional) + itermax : int, optional Maximum number of iterations to execute if convergence is not reached. Default: 100. - eps : float (optional) + eps : float, optional Tolerance for the convergence criterion. Convergence is reached if two subsequent estimates are smaller than eps. Default: 1e-5. - return_mask : bool (optional) + return_mask : bool, optional If True, return a mask identifying all the pure noise voxel that were found. Default: False. - initial_estimation : float (optional) + initial_estimation : float, optional Upper bound for the initial estimation of sigma. default : None, which computes the optimal quantile for N. diff --git a/dipy/io/stateful_tractogram.py b/dipy/io/stateful_tractogram.py index 443a0b07a1..4d7b974c42 100644 --- a/dipy/io/stateful_tractogram.py +++ b/dipy/io/stateful_tractogram.py @@ -619,7 +619,7 @@ def remove_invalid_streamlines(self, *, epsilon=1e-3): Parameters ---------- - epsilon : float (optional) + epsilon : float, optional Epsilon value for the bounding box verification. Default is 1e-6. diff --git a/dipy/nn/deepn4.py b/dipy/nn/deepn4.py index 681abfdbf9..06873f5889 100644 --- a/dipy/nn/deepn4.py +++ b/dipy/nn/deepn4.py @@ -158,7 +158,7 @@ def __init__(self, *, verbose=False): Parameters ---------- - verbose : bool (optional) + verbose : bool, optional Whether to show information about the processing. Default: False """ diff --git a/dipy/nn/evac.py b/dipy/nn/evac.py index 756ed7734b..daaf8c6053 100644 --- a/dipy/nn/evac.py +++ b/dipy/nn/evac.py @@ -315,7 +315,7 @@ def __init__(self, *, verbose=False): Parameters ---------- - verbose : bool (optional) + verbose : bool, optional Whether to show information about the processing. Default: False """ diff --git a/dipy/nn/histo_resdnn.py b/dipy/nn/histo_resdnn.py index ad2a0b2cf6..96fd6d722d 100644 --- a/dipy/nn/histo_resdnn.py +++ b/dipy/nn/histo_resdnn.py @@ -77,7 +77,7 @@ def __init__(self, *, sh_order_max=8, basis_type="tournier07", verbose=False): for a symmetric basis. Default: 8 basis_type : {'tournier07', 'descoteaux07'}, optional ``tournier07`` (default) or ``descoteaux07``. - verbose : bool (optional) + verbose : bool, optional Whether to show information about the processing. Default: False @@ -185,7 +185,7 @@ def predict(self, data, gtab, *, mask=None, chunk_size=1000): gtab : GradientTable class instance The acquisition scheme matching the data (must contain at least one b0) - mask : np.ndarray (optional) + mask : np.ndarray, optional Binary mask of the brain to avoid unnecessary computation and unreliable prediction outside the brain. Default: Compute prediction only for nonzero voxels (with at least diff --git a/dipy/nn/synb0.py b/dipy/nn/synb0.py index 9d1d62bd40..8ada57feb1 100644 --- a/dipy/nn/synb0.py +++ b/dipy/nn/synb0.py @@ -157,7 +157,7 @@ def __init__(self, *, verbose=False): Parameters ---------- - verbose : bool (optional) + verbose : bool, optional Whether to show information about the processing. Default: False """ diff --git a/dipy/reconst/csdeconv.py b/dipy/reconst/csdeconv.py index c0736bcfe0..868be6baf8 100644 --- a/dipy/reconst/csdeconv.py +++ b/dipy/reconst/csdeconv.py @@ -222,22 +222,21 @@ def __init__( function without diffusion weighting (i.e. S0). This is to be able to generate a single fiber synthetic signal. The response function will be used as deconvolution kernel :footcite:p:`Tournier2007`. - reg_sphere : Sphere (optional) + reg_sphere : Sphere, optional sphere used to build the regularization B matrix. Default: 'symmetric362'. - sh_order_max : int (optional) + sh_order_max : int, optional maximal spherical harmonics order (l). Default: 8 - lambda_ : float (optional) + lambda_ : float, optional weight given to the constrained-positivity regularization part of the deconvolution equation (see :footcite:p:`Tournier2007`). - Default: 1 - tau : float (optional) + tau : float, optional threshold controlling the amplitude below which the corresponding fODF is assumed to be zero. Ideally, tau should be set to zero. However, to improve the stability of the algorithm, tau is set to tau*100 % of the mean fODF amplitude (here, 10% by default) (see :footcite:p:`Tournier2007`). Default: 0.1. - convergence : int + convergence : int, optional Maximum number of iterations to allow the deconvolution to converge. @@ -757,12 +756,12 @@ def odf_deconv(odf_sh, R, B_reg, lambda_=1.0, tau=0.1, r2_term=False): B_reg : ndarray (``(sh_order_max + 1)(sh_order_max + 2)/2``, ``(sh_order_max + 1)(sh_order_max + 2)/2``) SH basis matrix used for deconvolution - lambda_ : float - lambda parameter in minimization equation (default 1.0) - tau : float - threshold (``tau *max(fODF)``) controlling the amplitude below - which the corresponding fODF is assumed to be zero. - r2_term : bool + lambda_ : float, optional + lambda parameter in minimization equation (default 1.0) + tau : float, optional + threshold (``tau *max(fODF)``) controlling the amplitude below + which the corresponding fODF is assumed to be zero. + r2_term : bool, optional True if ODF is computed from model that uses the $r^2$ term in the integral. Recall that Tuch's ODF (used in Q-ball Imaging :footcite:p:`Tuch2004`) and the true normalized ODF definition differ @@ -868,24 +867,23 @@ def odf_sh_to_sharp( array of odfs expressed as spherical harmonics coefficients sphere : Sphere sphere used to build the regularization matrix - basis : {None, 'tournier07', 'descoteaux07'} + basis : {None, 'tournier07', 'descoteaux07'}, optional different spherical harmonic basis: ``None`` for the default DIPY basis, ``tournier07`` for the Tournier 2007 :footcite:p:`Tournier2007` basis, and ``descoteaux07`` for the Descoteaux 2007 :footcite:p:`Descoteaux2007` basis (``None`` defaults to ``descoteaux07``). - ratio : float, + ratio : float, optional ratio of the smallest vs the largest eigenvalue of the single prolate tensor response function (:math:`\frac{\lambda_2}{\lambda_1}`) - sh_order_max : int + sh_order_max : int, optional maximal SH order ($l$) of the SH representation - lambda_ : float + lambda_ : float, optional lambda parameter (see odfdeconv) (default 1.0) - tau : float + tau : float, optional tau parameter in the L matrix construction (see odfdeconv) - (default 0.1) - r2_term : bool + r2_term : bool, optional True if ODF is computed from model that uses the $r^2$ term in the integral. Recall that Tuch's ODF (used in Q-ball Imaging :footcite:p:`Tuch2004`) and the true normalized ODF definition differ diff --git a/dipy/reconst/cti.py b/dipy/reconst/cti.py index f3ba9ae61d..21cc9342d7 100644 --- a/dipy/reconst/cti.py +++ b/dipy/reconst/cti.py @@ -156,7 +156,7 @@ def cti_prediction(cti_params, gtab1, gtab2, S0=1): gtab2: dipy.core.gradients.GradientTable A GradientTable class instance for second DDE diffusion epoch - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -297,7 +297,7 @@ def predict(self, cti_params, S0=1): A GradientTable class instance for first DDE diffusion epoch gtab2: dipy.core.gradients.GradientTable A GradientTable class instance for second DDE diffusion epoch - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. @@ -351,7 +351,7 @@ def predict(self, gtab1, gtab2, S0=1): A GradientTable class instance for first DDE diffusion epoch gtab2: dipy.core.gradients.GradientTable A GradientTable class instance for second DDE diffusion epoch - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 diff --git a/dipy/reconst/dki.py b/dipy/reconst/dki.py index 211de94c8a..a12f12a892 100644 --- a/dipy/reconst/dki.py +++ b/dipy/reconst/dki.py @@ -430,7 +430,7 @@ def directional_diffusion(dt, V, min_diffusivity=0): elements of the diffusion tensor of the voxel. V : array (g, 3) g directions of a Sphere in Cartesian coordinates - min_diffusivity : float (optional) + min_diffusivity : float, optional Because negative eigenvalues are not physical and small eigenvalues cause quite a lot of noise in diffusion-based metrics, diffusivity values smaller than `min_diffusivity` are replaced with @@ -525,22 +525,22 @@ def directional_kurtosis( elements of the kurtosis tensor of the voxel. V : array (g, 3) g directions of a Sphere in Cartesian coordinates - min_diffusivity : float (optional) + min_diffusivity : float, optional Because negative eigenvalues are not physical and small eigenvalues cause quite a lot of noise in diffusion-based metrics, diffusivity values smaller than `min_diffusivity` are replaced with `min_diffusivity`. Default = 0 - min_kurtosis : float (optional) + min_kurtosis : float, optional Because high-amplitude negative values of kurtosis are not physically and biologicaly pluasible, and these cause artefacts in kurtosis-based measures, directional kurtosis values smaller than `min_kurtosis` are replaced with `min_kurtosis`. Default = -3./7 (theoretical kurtosis limit for regions that consist of water confined to spherical pores :footcite:p:`Jensen2005`). - adc : ndarray(g,) (optional) + adc : ndarray(g,), optional Apparent diffusion coefficient (ADC) in all g directions of a sphere for a single voxel. - adv : ndarray(g,) (optional) + adv : ndarray(g,), optional Apparent diffusion variance (advc) in all g directions of a sphere for a single voxel. @@ -589,12 +589,12 @@ def apparent_kurtosis_coef( 3) Fifteen elements of the kurtosis tensor sphere : a Sphere class instance The AKC will be calculated for each of the vertices in the sphere - min_diffusivity : float (optional) + min_diffusivity : float, optional Because negative eigenvalues are not physical and small eigenvalues cause quite a lot of noise in diffusion-based metrics, diffusivity values smaller than `min_diffusivity` are replaced with `min_diffusivity`. - min_kurtosis : float (optional) + min_kurtosis : float, optional Because high-amplitude negative values of kurtosis are not physically and biologicaly pluasible, and these cause artefacts in kurtosis-based measures, directional kurtosis values smaller than @@ -686,17 +686,17 @@ def mean_kurtosis(dki_params, min_kurtosis=-3.0 / 7, max_kurtosis=3, analytical= 2) Three lines of the eigenvector matrix each containing the first, second and third coordinates of the eigenvector 3) Fifteen elements of the kurtosis tensor - min_kurtosis : float (optional) + min_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, mean kurtosis values that are smaller than `min_kurtosis` are replaced with `min_kurtosis`. Default = -3./7 (theoretical kurtosis limit for regions that consist of water confined to spherical pores :footcite:p:`Jensen2005`). - max_kurtosis : float (optional) + max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, mean kurtosis values that are larger than `max_kurtosis` are replaced with `max_kurtosis`. - analytical : bool (optional) + analytical : bool, optional If True, MK is calculated using its analytical solution, otherwise an exact numerical estimator is used (see Notes). @@ -960,17 +960,17 @@ def radial_kurtosis( second and third coordinates of the eigenvector 3) Fifteen elements of the kurtosis tensor - min_kurtosis : float (optional) + min_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, radial kurtosis values that are smaller than `min_kurtosis` are replaced with `min_kurtosis`. Default = -3./7 (theoretical kurtosis limit for regions that consist of water confined to spherical pores :footcite:p:`Jensen2005`). - max_kurtosis : float (optional) + max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, radial kurtosis values that are larger than `max_kurtosis` are replaced with `max_kurtosis`. Default = 10 - analytical : bool (optional) + analytical : bool, optional If True, RK is calculated using its analytical solution, otherwise an exact numerical estimator is used (see Notes). Default is set to True. @@ -1099,17 +1099,17 @@ def axial_kurtosis(dki_params, min_kurtosis=-3.0 / 7, max_kurtosis=10, analytica second and third coordinates of the eigenvector 3) Fifteen elements of the kurtosis tensor - min_kurtosis : float (optional) + min_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, axial kurtosis values that are smaller than `min_kurtosis` are replaced with `min_kurtosis`. Default = -3./7 (theoretical kurtosis limit for regions that consist of water confined to spherical pores :footcite:p:`Jensen2005`). - max_kurtosis : float (optional) + max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, axial kurtosis values that are larger than `max_kurtosis` are replaced with `max_kurtosis`. Default = 10 - analytical : bool (optional) + analytical : bool, optional If True, AK is calculated from rotated diffusion kurtosis tensor, otherwise it will be computed from the apparent diffusion kurtosis values along the principal axis of the diffusion tensor (see notes). @@ -1385,13 +1385,13 @@ def mean_kurtosis_tensor(dki_params, min_kurtosis=-3.0 / 7, max_kurtosis=10): second and third coordinates of the eigenvector 3) Fifteen elements of the kurtosis tensor - min_kurtosis : float (optional) + min_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, mean kurtosis values that are smaller than `min_kurtosis` are replaced with `min_kurtosis`. Default = -3./7 (theoretical kurtosis limit for regions that consist of water confined to spherical pores :footcite:p:`Jensen2005`). - max_kurtosis : float (optional) + max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, mean kurtosis values that are larger than `max_kurtosis` are replaced with `max_kurtosis`. Default = 10 @@ -1460,11 +1460,11 @@ def radial_tensor_kurtosis(dki_params, *, min_kurtosis=-3.0 / 7, max_kurtosis=10 second and third coordinates of the eigenvector 3) Fifteen elements of the kurtosis tensor - min_kurtosis : float (optional) + min_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, radial kurtosis values that are smaller than `min_kurtosis` are replaced with `min_kurtosis`. - max_kurtosis : float (optional) + max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, radial kurtosis values that are larger than `max_kurtosis` are replaced with `max_kurtosis`. @@ -1644,7 +1644,7 @@ def dki_prediction(dki_params, gtab, S0=1.0): 3) Fifteen elements of the kurtosis tensor gtab : a GradientTable class instance The gradient table for this prediction - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -1907,7 +1907,7 @@ def predict(self, dki_params, S0=1.0): first, second and third coordinates of the eigenvector 3. Fifteen elements of the kurtosis tensor - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -2373,7 +2373,7 @@ def predict(self, gtab, S0=1.0): gtab : a GradientTable class instance The gradient table for this prediction - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -2622,7 +2622,7 @@ def Wrotate(kt, Basis): Vector with the 15 independent elements of the kurtosis tensor Basis : array (3, 3) Vectors of the basis column-wise oriented - inds : array(m, 4) (optional) + inds : array(m, 4), optional Array of vectors containing the four indexes of m specific elements of the rotated kurtosis tensor. If not specified all 15 elements of the rotated kurtosis tensor are computed. diff --git a/dipy/reconst/dki_micro.py b/dipy/reconst/dki_micro.py index dfe54351c7..a9c447642b 100644 --- a/dipy/reconst/dki_micro.py +++ b/dipy/reconst/dki_micro.py @@ -93,11 +93,11 @@ def diffusion_components(dki_params, sphere="repulsion100", awf=None, mask=None) The sphere providing sample directions to sample the restricted and hindered cellular diffusion tensors. For more details see :footcite:p:`Fieremans2011`. - awf : ndarray (optional) + awf : ndarray, optional Array containing values of the axonal water fraction that has the shape dki_params.shape[:-1]. If not given this will be automatically computed using :func:`axonal_water_fraction` with function's default precision. - mask : ndarray (optional) + mask : ndarray, optional A boolean array used to mark the coordinates in the data that should be analyzed that has the shape dki_params.shape[:-1] @@ -206,7 +206,7 @@ def dkimicro_prediction(params, gtab, S0=1): 6) Axonal water fraction gtab : a GradientTable class instance The gradient table for this prediction - S0 : float or ndarray + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -447,7 +447,7 @@ def predict(self, params, S0=1.0): 5) Six elements of the restricted diffusion tensor 6) Axonal water fraction - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -627,7 +627,7 @@ def predict(self, gtab, S0=1.0): gtab : a GradientTable class instance The gradient table for this prediction - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. diff --git a/dipy/reconst/dsi.py b/dipy/reconst/dsi.py index e0eb5725d9..10cf5e7391 100644 --- a/dipy/reconst/dsi.py +++ b/dipy/reconst/dsi.py @@ -521,16 +521,16 @@ def __init__( ---------- gtab : GradientTable, Gradient directions and bvalues container class - qgrid_size : int, + qgrid_size : int, optional has to be an odd number. Sets the size of the q_space grid. For example if qgrid_size is 35 then the shape of the grid will be ``(35, 35, 35)``. - r_start : float, + r_start : float, optional ODF is sampled radially in the PDF. This parameters shows where the sampling should start. - r_end : float, + r_end : float, optional Radial endpoint of ODF sampling - r_step : float, + r_step : float, optional Step size of the ODf sampling from r_start to r_end filter_width : float, Strength of the hanning filter diff --git a/dipy/reconst/forecast.py b/dipy/reconst/forecast.py index 45c520daa1..99fce1d391 100644 --- a/dipy/reconst/forecast.py +++ b/dipy/reconst/forecast.py @@ -76,19 +76,19 @@ def __init__( ---------- gtab : GradientTable, gradient directions and bvalues container class. - sh_order_max : unsigned int, + sh_order_max : unsigned int, optional an even integer that represent the maximal SH order ($l$) of the basis (max 12) - lambda_lb: float, + lambda_lb: float, optional Laplace-Beltrami regularization weight. - dec_alg : str, + dec_alg : str, optional Spherical deconvolution algorithm. The possible values are Weighted Least Squares ('WLS'), Positivity Constraints using CVXPY ('POS') and the Constraint Spherical Deconvolution algorithm ('CSD'). Default is 'CSD'. - sphere : array, shape (N,3), + sphere : array, shape (N,3), optional sphere points where to enforce positivity when 'POS' or 'CSD' dec_alg are selected. - lambda_csd : float, + lambda_csd : float, optional CSD regularization weight. References diff --git a/dipy/reconst/fwdti.py b/dipy/reconst/fwdti.py index bf6af4c9c7..9997b99346 100644 --- a/dipy/reconst/fwdti.py +++ b/dipy/reconst/fwdti.py @@ -455,10 +455,10 @@ def _nls_err_func( Value of the free water isotropic diffusion. Default is set to 3e-3 $mm^{2}.s^{-1}$. Please adjust this value if you are assuming different units of diffusion. - weighting : str (optional). + weighting : str, optional Whether to use the Geman-McClure weighting criterion (see :footcite:p:`NetoHenriques2017` for details) - sigma : float or float array (optional) + sigma : float or float array, optional If 'sigma' weighting is used, we will weight the error function according to the background noise estimated either in aggregate over all directions (when a float is provided), or to an estimate of the @@ -613,7 +613,7 @@ def nls_iter( diffusion (i.e. volume fraction will be set to 1 and tissue's diffusion parameters are set to zero). Default md_reg is 2.7e-3 $mm^{2}.s^{-1}$ (corresponding to 90% of the free water diffusion value). - min_signal : float + min_signal : float, optional The minimum signal value. Needs to be a strictly positive number. cholesky : bool, optional @@ -625,7 +625,7 @@ def nls_iter( procedure to ft = arcsin(2*f - 1) + pi/2, insuring f estimates between 0 and 1. Default: True - jac : bool + jac : bool, optional Use the Jacobian? Default: False weighting: str, optional the weighting scheme to use in considering the @@ -757,7 +757,7 @@ def nls_fit_tensor( diffusion (i.e. volume fraction will be set to 1 and tissue's diffusion parameters are set to zero). Default md_reg is 2.7e-3 $mm^{2}.s^{-1}$ (corresponding to 90% of the free water diffusion value). - min_signal : float + min_signal : float, optional The minimum signal value. Needs to be a strictly positive number. Default: 1.0e-6. f_transform : bool, optional @@ -769,7 +769,7 @@ def nls_fit_tensor( If true it uses Cholesky decomposition to ensure that diffusion tensor is positive define. Default: False - jac : bool + jac : bool, optional Use the Jacobian? Default: False weighting: str, optional the weighting scheme to use in considering the diff --git a/dipy/reconst/gqi.py b/dipy/reconst/gqi.py index b3fbe26f3e..3465ac1c6e 100644 --- a/dipy/reconst/gqi.py +++ b/dipy/reconst/gqi.py @@ -26,9 +26,9 @@ def __init__(self, gtab, method="gqi2", sampling_length=1.2, normalize_peaks=Fal ---------- gtab : object, GradientTable - method : str, + method : str, optional 'standard' or 'gqi2' - sampling_length : float, + sampling_length : float, optional diffusion sampling length (lambda in eq. 2.14 and 2.16) normalize_peaks : bool, optional True to normalize peaks. diff --git a/dipy/reconst/mapmri.py b/dipy/reconst/mapmri.py index 51e3dabf34..465be8e8bc 100644 --- a/dipy/reconst/mapmri.py +++ b/dipy/reconst/mapmri.py @@ -128,35 +128,35 @@ def __init__( everywhere using the constraints of :footcite:p:`Merlet2013`. Global constraints are currently supported for anisotropic_scaling=True and for radial_order <= 10. - pos_grid : integer, + pos_grid : int, optional The number of points in the grid that is used in the local positivity constraint. - pos_radius : float or string, + pos_radius : float or string, optional If set to a float, the maximum distance the local positivity constraint constrains to posivity is that value. If set to 'adaptive', the maximum distance is dependent on the estimated tissue diffusivity. If 'infinity', semidefinite programming constraints are used :footcite:p:`DelaHaije2020`. - anisotropic_scaling : bool, + anisotropic_scaling : bool, optional If True, uses the standard anisotropic MAP-MRI basis. If False, uses the isotropic MAP-MRI basis (equal to 3D-SHORE). - eigenvalue_threshold : float, + eigenvalue_threshold : float, optional Sets the minimum of the tensor eigenvalues in order to avoid stability problem. - bval_threshold : float, + bval_threshold : float, optional Sets the b-value threshold to be used in the scale factor estimation. In order for the estimated non-Gaussianity to have meaning this value should set to a lower value (b<2000 s/mm^2) such that the scale factors are estimated on signal points that reasonably represent the spins at Gaussian diffusion. - dti_scale_estimation : bool, + dti_scale_estimation : bool, optional Whether or not DTI fitting is used to estimate the isotropic scale factor for isotropic MAP-MRI. When set to False the algorithm presets the isotropic tissue diffusivity to static_diffusivity. This vastly increases fitting speed but at the cost of slightly reduced fitting quality. Can still be used in combination with regularization and constraints. - static_diffusivity : float, + static_diffusivity : float, optional the tissue diffusivity that is used when dti_scale_estimation is set to False. The default is that of typical white matter D=0.7e-3 :footcite:p:`Fick2016b`. diff --git a/dipy/reconst/mcsd.py b/dipy/reconst/mcsd.py index bd290339b2..a5fae62d35 100644 --- a/dipy/reconst/mcsd.py +++ b/dipy/reconst/mcsd.py @@ -196,12 +196,12 @@ def __init__( for the response function without diffusion weighting (S0). Note that in order to use more than three compartments, one must create a MultiShellResponse object on the side. - reg_sphere : Sphere (optional) + reg_sphere : Sphere, optional sphere used to build the regularization B matrix. Default: 'symmetric362'. - sh_order_max : int (optional) + sh_order_max : int, optional Maximal spherical harmonics order (l). Default: 8 - iso: int (optional) + iso: int, optional Number of tissue compartments for running the MSMT-CSD. Minimum number of compartments required is 2. Default: 2 @@ -321,7 +321,7 @@ def fit(self, data, verbose=True, **kwargs): ---------- data : ndarray The diffusion data to fit the model on. - verbose : bool (optional) + verbose : bool, optional Whether to show warnings when a SolverError appears or not. Default: True """ diff --git a/dipy/reconst/msdki.py b/dipy/reconst/msdki.py index 911773e773..9d19c91495 100644 --- a/dipy/reconst/msdki.py +++ b/dipy/reconst/msdki.py @@ -236,7 +236,7 @@ def msdki_prediction(msdki_params, gtab, S0=1.0): in its last axis gtab : a GradientTable class instance The gradient table for this prediction - S0 : float or ndarray (optional) + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 @@ -282,12 +282,12 @@ def __init__(self, gtab, bmag=None, return_S0_hat=False, *args, **kwargs): gtab : GradientTable class instance Gradient table. - bmag : int + bmag : int, optional The order of magnitude that the bvalues have to differ to be considered an unique b-value. Default: derive this value from the maximal b-value provided: $bmag=log_{10}(max(bvals)) - 1$. - return_S0_hat : bool + return_S0_hat : bool, optional If True, also return S0 values for the fit. args, kwargs : arguments and keyword arguments passed to the @@ -364,7 +364,7 @@ def predict(self, msdki_params, S0=1.0): ---------- msdki_params : ndarray The parameters of the mean signal diffusion kurtosis model - S0 : float or ndarray + S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all voxels. Default: 1 diff --git a/dipy/reconst/sfm.py b/dipy/reconst/sfm.py index a2b85c85a8..6692e09b26 100644 --- a/dipy/reconst/sfm.py +++ b/dipy/reconst/sfm.py @@ -144,7 +144,7 @@ def predict(self, gtab=None): Parameters ---------- - gtab : a GradientTable class instance (optional) + gtab : a GradientTable class instance, optional Defaults to use the gtab from the IsotropicModel from which this fit was derived. @@ -209,7 +209,7 @@ def predict(self, gtab=None): Parameters ---------- - gtab : a GradientTable class instance (optional) + gtab : a GradientTable class instance, optional Defaults to use the gtab from the IsotropicModel from which this fit was derived. """ diff --git a/dipy/reconst/shore.py b/dipy/reconst/shore.py index 0cd6140827..72444a4ee8 100644 --- a/dipy/reconst/shore.py +++ b/dipy/reconst/shore.py @@ -77,30 +77,29 @@ def __init__( From the $c_i$ coefficients, there exists an analytical formula to estimate the ODF. - Parameters ---------- gtab : GradientTable, gradient directions and bvalues container class - radial_order : unsigned int, + radial_order : unsigned int, optional an even integer that represent the order of the basis - zeta : unsigned int, + zeta : unsigned int, optional scale factor - lambdaN : float, + lambdaN : float, optional radial regularisation constant - lambdaL : float, + lambdaL : float, optional angular regularisation constant - tau : float, + tau : float, optional diffusion time. By default the value that makes q equal to the square root of the b-value. - constrain_e0 : bool, + constrain_e0 : bool, optional Constrain the optimization such that E(0) = 1. - positive_constraint : bool, + positive_constraint : bool, optional Constrain the propagator to be positive. - pos_grid : int, + pos_grid : int, optional Grid that define the points of the EAP in which we want to enforce positivity. - pos_radius : float, + pos_radius : float, optional Radius of the grid of the EAP in which enforce positivity in millimeters. By default 20e-03 mm. cvxpy_solver : str, optional diff --git a/dipy/segment/bundles.py b/dipy/segment/bundles.py index 59c1e7467e..cf9479a7da 100644 --- a/dipy/segment/bundles.py +++ b/dipy/segment/bundles.py @@ -98,9 +98,9 @@ def ba_analysis(recognized_bundle, expert_bundle, *, nb_pts=20, threshold=6.0): expert_bundle : Streamlines Model bundle used as reference while extracting similar type bundle from input tractogram - nb_pts : integer (default 20) + nb_pts : integer, optional Discretizing streamlines to have nb_pts number of points - threshold : float (default 6) + threshold : float, optional Threshold used for in computing bundle adjacency. Threshold controls how much strictness user wants while calculating bundle adjacency between two bundles. Smaller threshold means bundles should be strictly diff --git a/dipy/segment/clustering.py b/dipy/segment/clustering.py index e91be1bfc5..019420ebb4 100644 --- a/dipy/segment/clustering.py +++ b/dipy/segment/clustering.py @@ -40,9 +40,9 @@ class Cluster: ---------- cluster_map : `ClusterMap` object Reference to the set of clusters this cluster is being part of. - id : int + id : int, optional Id of this cluster in its associated `cluster_map` object. - refdata : list (optional) + refdata : list, optional Actual elements that clustered indices refer to. Notes @@ -131,9 +131,9 @@ class ClusterCentroid(Cluster): ---------- cluster_map : `ClusterMapCentroid` object Reference to the set of clusters this cluster is being part of. - id : int + id : int, optional Id of this cluster in its associated `cluster_map` object. - refdata : list (optional) + refdata : list, optional Actual elements that clustered indices refer to. Notes @@ -456,12 +456,12 @@ class QuickBundles(Clustering): threshold : float The maximum distance from a bundle for a streamline to be still considered as part of it. - metric : str or `Metric` object (optional) + metric : str or `Metric` object, optional The distance metric to use when comparing two streamlines. By default, the Minimum average Direct-Flip (MDF) distance :footcite:p:`Garyfallidis2012a` is used and streamlines are automatically resampled so they have 12 points. - max_nb_clusters : int + max_nb_clusters : int, optional Limits the creation of bundles. Examples @@ -530,7 +530,7 @@ def cluster(self, streamlines, *, ordering=None): ---------- streamlines : list of 2D arrays Each 2D array represents a sequence of 3D points (points, 3). - ordering : iterable of indices + ordering : iterable of indices, optional Specifies the order in which data points will be clustered. Returns @@ -563,7 +563,7 @@ class QuickBundlesX(Clustering): Thresholds to use for each clustering layer. A threshold represents the maximum distance from a cluster for a streamline to be still considered as part of it. - metric : str or `Metric` object (optional) + metric : str or `Metric` object, optional The distance metric to use when comparing two streamlines. By default, the Minimum average Direct-Flip (MDF) distance :footcite:p:`Garyfallidis2012a` is used and streamlines are diff --git a/dipy/segment/mask.py b/dipy/segment/mask.py index 02874c6c12..7386611853 100644 --- a/dipy/segment/mask.py +++ b/dipy/segment/mask.py @@ -153,12 +153,12 @@ def median_otsu( ---------- input_volume : ndarray 3D or 4D array of the brain volume. - vol_idx : None or array, optional. + vol_idx : None or array, optional 1D array representing indices of ``axis=3`` of a 4D `input_volume`. None is only an acceptable input if ``input_volume`` is 3D. - median_radius : int + median_radius : int, optional Radius (in voxels) of the applied median filter (default: 4). - numpass: int + numpass: int, optional Number of pass of the median filter (default: 4). autocrop: bool, optional if True, the masked input_volume will also be cropped using the diff --git a/dipy/sims/voxel.py b/dipy/sims/voxel.py index 0ec0914ec8..6d258e2577 100644 --- a/dipy/sims/voxel.py +++ b/dipy/sims/voxel.py @@ -499,15 +499,15 @@ def multi_tensor_dki( Gradient table. mevals : array (K, 3) eigenvalues of the diffusion tensor for each individual compartment - S0 : float (optional) + S0 : float, optional Unweighted signal value (b0 signal). - angles : array (K,2) or (K,3) (optional) + angles : array (K,2) or (K,3), optional List of K tensor directions of the diffusion tensor of each compartment in polar angles (in degrees) or unit vectors - fractions : float (K,) (optional) + fractions : float (K,), optional Percentage of the contribution of each tensor. The sum of fractions should be equal to 100%. - snr : float (optional) + snr : float, optional Signal to noise ratio, assuming Rician noise. If set to None, no noise is added. @@ -618,9 +618,9 @@ def kurtosis_element(D_comps, frac, ind_i, ind_j, ind_k, ind_l, *, DT=None, MD=N Element's index k (0 for x, 1 for y, 2 for z) ind_l: int Elements index l (0 for x, 1 for y, 2 for z) - DT : (3,3) ndarray (optional) + DT : (3,3) ndarray, optional Voxel's global diffusion tensor. - MD : float (optional) + MD : float, optional Voxel's global mean diffusivity. Returns @@ -681,9 +681,9 @@ def dki_signal(gtab, dt, kt, *, S0=150, snr=None): Elements of the diffusion tensor. kt : (15, ) ndarray Elements of the diffusion kurtosis tensor. - S0 : float (optional) + S0 : float, optional Strength of signal in the presence of no diffusion gradient. - snr : float (optional) + snr : float, optional Signal to noise ratio, assuming Rician noise. None implies no noise. Returns @@ -844,10 +844,10 @@ def single_tensor_rtop(*, evals=None, tau=1.0 / (4 * np.pi**2)): Parameters ---------- - evals : 1D arrays, + evals : 1D arrays, optional Eigen-values for the tensor. By default, values typical for prolate white matter are used. - tau : float, + tau : float, optional diffusion time. By default the value that makes q=sqrt(b). Returns @@ -877,10 +877,10 @@ def multi_tensor_rtop(mf, *, mevals=None, tau=1 / (4 * np.pi**2)): ---------- mf : sequence of floats, bounded [0,1] Percentages of the fractions for each tensor. - mevals : sequence of 1D arrays, + mevals : sequence of 1D arrays, optional Eigen-values for each tensor. By default, values typical for prolate white matter are used. - tau : float, + tau : float, optional diffusion time. By default the value that makes q=sqrt(b). Returns @@ -915,14 +915,14 @@ def single_tensor_pdf(r, *, evals=None, evecs=None, tau=1 / (4 * np.pi**2)): ---------- r : (N,3) or (M,N,3) ndarray Measurement positions in (x, y, z), either as a list or on a grid. - evals : (3,) + evals : (3,), optional Eigenvalues of diffusion tensor. By default, use values typical for prolate white matter. - evecs : (3, 3) ndarray + evecs : (3, 3) ndarray, optional Eigenvectors of the tensor. You can also think of these as the rotation matrix that determines the orientation of the diffusion tensor. - tau : float, + tau : float, optional diffusion time. By default the value that makes q=sqrt(b). @@ -975,7 +975,7 @@ def multi_tensor_pdf(pdf_points, mevals, angles, fractions, *, tau=1 / (4 * np.p or cartesian unit coordinates. fractions : sequence of floats, Percentages of the fractions for each tensor. - tau : float, + tau : float, optional diffusion time. By default the value that makes q=sqrt(b). Returns @@ -1013,10 +1013,10 @@ def single_tensor_msd(*, evals=None, tau=1 / (4 * np.pi**2)): Parameters ---------- - evals : 1D arrays, + evals : 1D arrays, optional Eigen-values for the tensor. By default, values typical for prolate white matter are used. - tau : float, + tau : float, optional diffusion time. By default the value that makes q=sqrt(b). Returns @@ -1046,10 +1046,10 @@ def multi_tensor_msd(mf, *, mevals=None, tau=1 / (4 * np.pi**2)): ---------- mf : sequence of floats, bounded [0,1] Percentages of the fractions for each tensor. - mevals : sequence of 1D arrays, + mevals : sequence of 1D arrays, optional Eigen-values for each tensor. By default, values typical for prolate white matter are used. - tau : float, + tau : float, optional diffusion time. By default the value that makes q=sqrt(b). Returns diff --git a/dipy/stats/analysis.py b/dipy/stats/analysis.py index 1694632cfa..77566cda59 100644 --- a/dipy/stats/analysis.py +++ b/dipy/stats/analysis.py @@ -260,14 +260,14 @@ def afq_profile( The voxel_to_rasmm matrix, typically from a NIFTI file. n_points: int, optional The number of points to sample along the bundle. Default: 100. - orient_by: streamline, optional. + orient_by: streamline, optional A streamline to use as a standard to orient all of the streamlines in the bundle according to. - weights : 1D array or 2D array or callable (optional) + weights : 1D array or 2D array or callable, optional Weight each streamline (1D) or each node (2D) when calculating the tract-profiles. Must sum to 1 across streamlines (in each node if relevant). If callable, this is a function that calculates weights. - profile_stat : callable + profile_stat : callable, optional The statistic used to average the profile across streamlines. If weights is not None, this must take weights as a keyword argument. The default, np.average, is the same as np.mean but takes weights diff --git a/dipy/stats/qc.py b/dipy/stats/qc.py index 3ab04f9cf4..adbe25d444 100644 --- a/dipy/stats/qc.py +++ b/dipy/stats/qc.py @@ -81,7 +81,7 @@ def neighboring_dwi_correlation(dwi_data, gtab, *, mask=None): gtab : dipy.core.gradients.GradientTable Gradient table. mask : 3D ndarray, optional - optional mask of voxels to include in the NDC calculation + Mask of voxels to include in the NDC calculation Returns ------- diff --git a/dipy/stats/resampling.py b/dipy/stats/resampling.py index 4c06aeabf1..279a9d1a4b 100644 --- a/dipy/stats/resampling.py +++ b/dipy/stats/resampling.py @@ -23,14 +23,14 @@ def bootstrap(x, *, statistic=bs_se, B=1000, alpha=0.95, rng=None): ---------- x : ndarray (N, 1) Observable sample to resample. N should be reasonably large. - statistic : method (optional) + statistic : method, optional Method to calculate the desired statistic. (Default: calculate bootstrap standard error) - B : integer (optional) + B : integer, optional Total number of bootstrap resamples in bootstrap pdf. (Default: 1000) - alpha : float (optional) + alpha : float, optional Percentile for confidence interval of the statistic. (Default: 0.05) - rng : numpy.random.Generator + rng : numpy.random.Generator, optional Random number generator to use for sampling. If None, the generator is initialized using the default BitGenerator. @@ -92,7 +92,7 @@ def abc(x, *, statistic=bs_se, alpha=0.05, eps=1e-5): proportions (flat probability densities vector) alpha : float (0, 1) Desired confidence interval initial endpoint (Default: 0.05) - eps : float (optional) + eps : float, optional Specifies step size in calculating numerical derivative T' and T''. Default: 1e-5 @@ -233,7 +233,7 @@ def jackknife(pdf, *, statistic=np.std, M=None, rng=None): pdf : ndarray (N, 1) Probability distribution function to resample. N should be reasonably large. - statistic : method (optional) + statistic : method, optional Method to calculate the desired statistic. (Default: calculate standard deviation) M : integer (M < N) diff --git a/dipy/tracking/life.py b/dipy/tracking/life.py index 107b6acb09..34e7b54195 100644 --- a/dipy/tracking/life.py +++ b/dipy/tracking/life.py @@ -281,7 +281,7 @@ def voxel2streamline(streamline, affine, *, unique_idx=None): affine : array_like (4, 4) The mapping from voxel coordinates to streamline points. The voxel_to_rasmm matrix, typically from a NIFTI file. - unique_idx : array (optional). + unique_idx : array, optional. The unique indices in the streamlines Returns @@ -454,7 +454,7 @@ def fit(self, data, streamline, affine, *, evals=(0.001, 0, 0), sphere=None): affine : array_like (4, 4) The mapping from voxel coordinates to streamline points. The voxel_to_rasmm matrix, typically from a NIFTI file. - evals : array-like (optional) + evals : array-like, optional The eigenvalues of the tensor response function used in constructing the model signal. Default: [0.001, 0, 0] sphere: `dipy.core.Sphere` instance or False, optional diff --git a/dipy/tracking/streamlinespeed.pyx b/dipy/tracking/streamlinespeed.pyx index 66e20ca1f1..62484f32f0 100644 --- a/dipy/tracking/streamlinespeed.pyx +++ b/dipy/tracking/streamlinespeed.pyx @@ -560,11 +560,11 @@ def compress_streamlines(streamlines, tol_error=0.01, max_segment_length=10): ---------- streamlines : one or a list of array-like of shape (N,3) Array representing x,y,z of N points in a streamline. - tol_error : float (optional) + tol_error : float, optional Tolerance error in mm (default: 0.01). A rule of thumb is to set it to 0.01mm for deterministic streamlines and 0.1mm for probabilitic streamlines. - max_segment_length : float (optional) + max_segment_length : float, optional Maximum length in mm of any given segment produced by the compression. The default is 10mm. (In :footcite:p:`Presseau2015` they used a value of `np.inf`). diff --git a/dipy/viz/regtools.py b/dipy/viz/regtools.py index 24f02743bc..b8093d72f7 100644 --- a/dipy/viz/regtools.py +++ b/dipy/viz/regtools.py @@ -73,16 +73,16 @@ def overlay_images( img1 : array, shape(R, C) the image to be plotted on the green channel, to the right of the figure - title0 : string (optional) + title0 : string, optional the title to be written on top of the image to the left. By default, no title is displayed. - title_mid : string (optional) + title_mid : string, optional the title to be written on top of the middle image. By default, no title is displayed. - title1 : string (optional) + title1 : string, optional the title to be written on top of the image to the right. By default, no title is displayed. - fname : string (optional) + fname : string, optional the file name to write the resulting figure. If None (default), the image is not saved. fig_kwargs : dict @@ -341,12 +341,12 @@ def plot_slices(V, *, slice_indices=None, fname=None, **fig_kwargs): ---------- V : array, shape (S, R, C) the 3D volume to extract the slices from - slice_indices : array, shape (3,) (optional) + slice_indices : array, shape (3,), optional the indices of the sagittal (slice_indices[0]), coronal (slice_indices[1]) and axial (slice_indices[2]) slices to be displayed. If None, the middle slices along each direction are displayed. - fname : string (optional) + fname : string, optional the name of the file to save the figure to. If None (default), the figure is not saved to disk. fig_kwargs : dict @@ -406,19 +406,19 @@ def overlay_slices( the first volume to extract the slice from plotted to the left R : array, shape (S, R, C) the second volume to extract the slice from, plotted to the right - slice_index : int (optional) + slice_index : int, optional the index of the slices (along the axis given by slice_type) to be overlaid. If None, the slice along the specified axis is used - slice_type : int (optional) + slice_type : int, optional the type of slice to be extracted: 0=sagittal, 1=coronal (default), 2=axial. - ltitle : string (optional) + ltitle : string, optional the string to be written as the title of the left image. By default, no title is displayed. - rtitle : string (optional) + rtitle : string, optional the string to be written as the title of the right image. By default, no title is displayed. - fname : string (optional) + fname : string, optional the name of the file to write the image to. If None (default), the figure is not saved to disk. fig_kwargs: extra parameters for saving figure, e.g. `dpi=300`. From 4591927f504d020295a40eeb6bc1c09b4f0fa002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 15 Aug 2024 20:10:00 -0400 Subject: [PATCH 3/3] DOC: Remove default values from docstrings Remove default values from docstrings: reduces the maintenance burden and avoids the risk of inconsistencies if the default value is changed in the method signature but not the parameter docstring. --- dipy/align/streamlinear.py | 27 ++++++++++++--------------- dipy/align/streamwarp.py | 11 +++++------ dipy/core/gradients.py | 2 -- dipy/core/optimize.py | 7 +++---- dipy/data/fetcher.py | 8 ++++---- dipy/denoise/enhancement_kernel.pyx | 2 +- dipy/denoise/gibbs.py | 3 --- dipy/denoise/noise_estimate.py | 12 +++++------- dipy/io/image.py | 10 +++++----- dipy/nn/deepn4.py | 1 - dipy/nn/evac.py | 1 - dipy/nn/histo_resdnn.py | 3 +-- dipy/nn/synb0.py | 1 - dipy/reconst/csdeconv.py | 25 ++++++++++++------------- dipy/reconst/cti.py | 2 +- dipy/reconst/dki.py | 18 +++++++++--------- dipy/reconst/dki_micro.py | 4 ++-- dipy/reconst/dsi.py | 6 +++--- dipy/reconst/dti.py | 6 +++--- dipy/reconst/fwdti.py | 17 +++++------------ dipy/reconst/mcsd.py | 5 +---- dipy/reconst/msdki.py | 4 ++-- dipy/reconst/rumba.py | 15 ++++++--------- dipy/reconst/shore.py | 2 +- dipy/segment/bundles.py | 8 ++++---- dipy/segment/mask.py | 6 +++--- dipy/sims/phantom.py | 3 +-- dipy/stats/analysis.py | 5 ++--- dipy/tracking/streamline.py | 6 ++---- dipy/tracking/streamlinespeed.pyx | 2 +- 30 files changed, 94 insertions(+), 128 deletions(-) diff --git a/dipy/align/streamlinear.py b/dipy/align/streamlinear.py index 453e8bb753..8b67c659cb 100644 --- a/dipy/align/streamlinear.py +++ b/dipy/align/streamlinear.py @@ -359,8 +359,7 @@ def __init__( ``x0 = np.array([0, 0, 0, 0, 0, 0, 1., 1., 1, 0, 0, 0])`` method : str, - 'L_BFGS_B' or 'Powell' optimizers can be used. Default is - 'L_BFGS_B'. + 'L_BFGS_B' or 'Powell' optimizers can be used. bounds : list of tuples or None, If method == 'L_BFGS_B' then we can use bounded optimization. @@ -371,14 +370,13 @@ def __init__( verbose : bool, optional. If True, if True then information about the optimization is shown. - Default: False. options : None or dict, Extra options to be used with the selected method. evolution : boolean If True save the transformation for each iteration of the - optimizer. Default is False. Supported only with Scipy >= 0.11. + optimizer. Supported only with Scipy >= 0.11. num_threads : int, optional Number of threads to be used for OpenMP parallelization. If None @@ -1057,7 +1055,7 @@ def slr_with_qbx( Moving streamlines. x0 : str, optional. - rigid, similarity or affine transformation model (default affine) + rigid, similarity or affine transformation model rm_small_clusters : int, optional Remove clusters that have less than `rm_small_clusters` @@ -1067,10 +1065,9 @@ def slr_with_qbx( select_random : int, optional. If not, None selects a random number of streamlines to apply clustering - Default None. verbose : bool, optional - If True, logs information about optimization. Default: False + If True, logs information about optimization. greater_than : int, optional Keep streamlines that have length greater than this value. @@ -1236,32 +1233,32 @@ def groupwise_slr( List with streamlines of the bundles to be registered. x0 : str, optional - rigid, similarity or affine transformation model. Default: affine. + rigid, similarity or affine transformation model. tol : float, optional - Tolerance value to be used to assume convergence. Default: 0. + Tolerance value to be used to assume convergence. max_iter : int, optional Maximum number of iterations. Depending on the number of bundles to be - registered this may need to be larger. Default: 20. + registered this may need to be larger. qbx_thr : variable int, optional Thresholds for Quickbundles used for clustering streamlines and reduce computational time. If None, no clustering is performed. Higher values - cluster streamlines into a smaller number of centroids. Default: [4]. + cluster streamlines into a smaller number of centroids. nb_pts : int, optional - Number of points for discretizing each streamline. Default: 20. + Number of points for discretizing each streamline. select_random : int, optional Maximum number of streamlines for each bundle. If None, all the - streamlines are used. Default: 10000. + streamlines are used. verbose : bool, optional - If True, logs information. Default: False. + If True, logs information. rng : np.random.Generator - If None, creates random generator in function. Default: None. + If None, creates random generator in function. References ---------- diff --git a/dipy/align/streamwarp.py b/dipy/align/streamwarp.py index a9f336213b..7629e1bf14 100755 --- a/dipy/align/streamwarp.py +++ b/dipy/align/streamwarp.py @@ -74,23 +74,22 @@ def bundlewarp( Target bundle that will be moved/registered to match the static bundle dist : float, optional - Precomputed distance matrix (default None) + Precomputed distance matrix. alpha : float, optional Represents the trade-off between regularizing the deformation and having points match very closely. Lower value of alpha means high - deformations (default 0.3) + deformations. beta : int, optional Represents the strength of the interaction between points - Gaussian kernel size (default 20) + Gaussian kernel size. max_iter : int, optional - Maximum number of iterations for deformation process in ml-CPD method - (default 15) + Maximum number of iterations for deformation process in ml-CPD method. affine : boolean, optional - If False, use rigid registration as starting point (default True) + If False, use rigid registration as starting point. Returns ------- diff --git a/dipy/core/gradients.py b/dipy/core/gradients.py index 7e6c661ba1..43e6a4be12 100644 --- a/dipy/core/gradients.py +++ b/dipy/core/gradients.py @@ -39,7 +39,6 @@ def unique_bvals(bvals, bmag=None, rbvals=False): rbvals : bool, optional If True function also returns all individual rounded b-values. - Default: False Returns ------- @@ -1015,7 +1014,6 @@ def unique_bvals_magnitude(bvals, *, bmag=None, rbvals=False): rbvals : bool, optional If True function also returns all individual rounded b-values. - Default: False Returns ------- diff --git a/dipy/core/optimize.py b/dipy/core/optimize.py index 6069106ada..4093387540 100644 --- a/dipy/core/optimize.py +++ b/dipy/core/optimize.py @@ -251,13 +251,13 @@ def sparse_nnls( X : ndarray. May be either sparse or dense. Shape (N, M) The regressors - momentum : float, optional (default: 1). + momentum : float, optional The persistence of the gradient. - step_size : float, optional (default: 0.01). + step_size : float, optional The increment of parameter update in each iteration - non_neg : Boolean, optional (default: True) + non_neg : Boolean, optional Whether to enforce non-negativity of the solution. check_error_iter : int, optional @@ -498,7 +498,6 @@ def solve(self, design_matrix, measurements, *, check=False, **kwargs): already satisfies the constraints, before running the constrained optimization. This adds overhead, but can avoid unnecessary constrained optimization calls. - Default: False kwargs : keyword arguments Arguments passed to the CVXPY solve method. diff --git a/dipy/data/fetcher.py b/dipy/data/fetcher.py index ca3abbe5f3..4aa9e9bdde 100644 --- a/dipy/data/fetcher.py +++ b/dipy/data/fetcher.py @@ -2605,14 +2605,14 @@ def fetch_hcp( subjects : list Each item is an integer, identifying one of the HCP subjects hcp_bucket : string, optional - The name of the HCP S3 bucket. Default: "hcp-openaccess" + The name of the HCP S3 bucket. profile_name : string, optional - The name of the AWS profile used for access. Default: "hcp" + The name of the AWS profile used for access. path : string, optional Path to save files into. Defaults to the value of the ``DIPY_HOME`` environment variable is set; otherwise, defaults to ``$HOME/.dipy``. study : string, optional - Which HCP study to grab. Default: 'HCP_1200' + Which HCP study to grab. aws_access_key_id : string, optional AWS credentials to HCP AWS S3. Will only be used if `profile_name` is set to False. @@ -2838,7 +2838,7 @@ def fetch_hbn(subjects, *, path=None, include_afq=False): environment variable is set; otherwise, defaults to ``$HOME/.dipy``. include_afq : bool, optional - Whether to include pyAFQ derivatives. Default: False + Whether to include pyAFQ derivatives Returns ------- diff --git a/dipy/denoise/enhancement_kernel.pyx b/dipy/denoise/enhancement_kernel.pyx index 867b1082d9..212497824a 100644 --- a/dipy/denoise/enhancement_kernel.pyx +++ b/dipy/denoise/enhancement_kernel.pyx @@ -42,7 +42,7 @@ cdef class EnhancementKernel: Diffusion time force_recompute : boolean, optional Always compute the look-up table even if it is available - in cache. Default is False. + in cache. orientations : integer or Sphere object, optional Specify the number of orientations to be used with electrostatic repulsion, or provide a Sphere object. diff --git a/dipy/denoise/gibbs.py b/dipy/denoise/gibbs.py index 39d3faa712..30128e5651 100644 --- a/dipy/denoise/gibbs.py +++ b/dipy/denoise/gibbs.py @@ -250,14 +250,11 @@ def gibbs_removal(vol, *, slice_axis=2, n_points=3, inplace=True, num_processes= Matrix containing one volume (3D) or multiple (4D) volumes of images. slice_axis : int (0, 1, or 2) Data axis corresponding to the number of acquired slices. - Default is set to the third axis. n_points : int, optional Number of neighbour points to access local TV (see note). - Default is set to 3. inplace : bool, optional If True, the input data is replaced with results. Otherwise, returns a new array. - Default is set to True. num_processes : int or None, optional Split the calculation to a pool of children processes. This only applies to 3D or 4D `data` arrays. Default is 1. If < 0 the maximal diff --git a/dipy/denoise/noise_estimate.py b/dipy/denoise/noise_estimate.py index e68ec9519c..4c98ff6300 100644 --- a/dipy/denoise/noise_estimate.py +++ b/dipy/denoise/noise_estimate.py @@ -178,23 +178,21 @@ def _piesno_3D( alpha : float, optional Probabilistic estimation threshold for the gamma function. - Default: 0.01. step : int, optional - number of initial estimates for sigma to try. Default: 100. + number of initial estimates for sigma to try. itermax : int, optional Maximum number of iterations to execute if convergence - is not reached. Default: 100. + is not reached. eps : float, optional Tolerance for the convergence criterion. Convergence is reached if two subsequent estimates are smaller than eps. - Default: 1e-5. return_mask : bool, optional If True, return a mask identifying all the pure noise voxel - that were found. Default: False. + that were found. initial_estimation : float, optional Upper bound for the initial estimation of sigma. default : None, @@ -292,11 +290,11 @@ def estimate_sigma(arr, *, disable_background_masking=False, N=0): arr : 3D or 4D ndarray The array to be estimated - disable_background_masking : bool, default False + disable_background_masking : bool, optional If True, uses all voxels for the estimation, otherwise, only non-zeros voxels are used. Useful if the background is masked by the scanner. - N : int, default 0 + N : int, optional Number of coils of the receiver array. Use N = 1 in case of a SENSE reconstruction (Philips scanners) or the number of coils for a GRAPPA reconstruction (Siemens and GE). Use 0 to disable the correction factor, diff --git a/dipy/io/image.py b/dipy/io/image.py index c3e6c42621..412ae94120 100644 --- a/dipy/io/image.py +++ b/dipy/io/image.py @@ -16,7 +16,7 @@ def load_nifti_data(fname, *, as_ndarray=True): as_ndarray: bool, optional convert nibabel ArrayProxy to a numpy.ndarray. If you want to save memory and delay this casting, just turn this - option to False (default: True) + option to False. Returns ------- @@ -48,18 +48,18 @@ def load_nifti( Full path to a nifti file. return_img : bool, optional - Whether to return the nibabel nifti img object. Default: False + Whether to return the nibabel nifti img object. return_voxsize: bool, optional - Whether to return the nifti header zooms. Default: False + Whether to return the nifti header zooms. return_coords : bool, optional - Whether to return the nifti header aff2axcodes. Default: False + Whether to return the nifti header aff2axcodes. as_ndarray: bool, optional convert nibabel ArrayProxy to a numpy.ndarray. If you want to save memory and delay this casting, just turn this - option to False (default: True) + option to False. Returns ------- diff --git a/dipy/nn/deepn4.py b/dipy/nn/deepn4.py index 06873f5889..9404543100 100644 --- a/dipy/nn/deepn4.py +++ b/dipy/nn/deepn4.py @@ -160,7 +160,6 @@ def __init__(self, *, verbose=False): ---------- verbose : bool, optional Whether to show information about the processing. - Default: False """ if not have_tf: diff --git a/dipy/nn/evac.py b/dipy/nn/evac.py index daaf8c6053..e356f36910 100644 --- a/dipy/nn/evac.py +++ b/dipy/nn/evac.py @@ -317,7 +317,6 @@ def __init__(self, *, verbose=False): ---------- verbose : bool, optional Whether to show information about the processing. - Default: False """ if not have_tf: diff --git a/dipy/nn/histo_resdnn.py b/dipy/nn/histo_resdnn.py index 96fd6d722d..38281e5e87 100644 --- a/dipy/nn/histo_resdnn.py +++ b/dipy/nn/histo_resdnn.py @@ -74,12 +74,11 @@ def __init__(self, *, sh_order_max=8, basis_type="tournier07", verbose=False): Maximum SH order (l) in the SH fit. For ``sh_order_max``, there will be ``(sh_order_max + 1) * (sh_order_max + 2) / 2`` SH coefficients - for a symmetric basis. Default: 8 + for a symmetric basis. basis_type : {'tournier07', 'descoteaux07'}, optional ``tournier07`` (default) or ``descoteaux07``. verbose : bool, optional Whether to show information about the processing. - Default: False References ---------- diff --git a/dipy/nn/synb0.py b/dipy/nn/synb0.py index 8ada57feb1..bbf2e556a2 100644 --- a/dipy/nn/synb0.py +++ b/dipy/nn/synb0.py @@ -159,7 +159,6 @@ def __init__(self, *, verbose=False): ---------- verbose : bool, optional Whether to show information about the processing. - Default: False """ if not have_tf: diff --git a/dipy/reconst/csdeconv.py b/dipy/reconst/csdeconv.py index 868be6baf8..0d288297bf 100644 --- a/dipy/reconst/csdeconv.py +++ b/dipy/reconst/csdeconv.py @@ -224,9 +224,8 @@ def __init__( will be used as deconvolution kernel :footcite:p:`Tournier2007`. reg_sphere : Sphere, optional sphere used to build the regularization B matrix. - Default: 'symmetric362'. sh_order_max : int, optional - maximal spherical harmonics order (l). Default: 8 + maximal spherical harmonics order (l). lambda_ : float, optional weight given to the constrained-positivity regularization part of the deconvolution equation (see :footcite:p:`Tournier2007`). @@ -235,7 +234,7 @@ def __init__( fODF is assumed to be zero. Ideally, tau should be set to zero. However, to improve the stability of the algorithm, tau is set to tau*100 % of the mean fODF amplitude (here, 10% by default) - (see :footcite:p:`Tournier2007`). Default: 0.1. + (see :footcite:p:`Tournier2007`). convergence : int, optional Maximum number of iterations to allow the deconvolution to converge. @@ -757,7 +756,7 @@ def odf_deconv(odf_sh, R, B_reg, lambda_=1.0, tau=0.1, r2_term=False): ``(sh_order_max + 1)(sh_order_max + 2)/2``) SH basis matrix used for deconvolution lambda_ : float, optional - lambda parameter in minimization equation (default 1.0) + lambda parameter in minimization equation tau : float, optional threshold (``tau *max(fODF)``) controlling the amplitude below which the corresponding fODF is assumed to be zero. @@ -880,7 +879,7 @@ def odf_sh_to_sharp( sh_order_max : int, optional maximal SH order ($l$) of the SH representation lambda_ : float, optional - lambda parameter (see odfdeconv) (default 1.0) + lambda parameter (see odfdeconv) tau : float, optional tau parameter in the L matrix construction (see odfdeconv) r2_term : bool, optional @@ -1144,30 +1143,30 @@ def recursive_response( shape `data.shape[0:3]` and dtype=bool. Default: use the entire data array. sh_order_max : int, optional - maximal spherical harmonics order (l). Default: 8 + maximal spherical harmonics order (l). peak_thr : float, optional peak threshold, how large the second peak can be relative to the first peak in order to call it a single fiber population - :footcite:p:`Tax2014`. Default: 0.01 + :footcite:p:`Tax2014`. init_fa : float, optional - FA of the initial 'fat' response function (tensor). Default: 0.08 + FA of the initial 'fat' response function (tensor). init_trace : float, optional - trace of the initial 'fat' response function (tensor). Default: 0.0021 + trace of the initial 'fat' response function (tensor). iter : int, optional - maximum number of iterations for calibration. Default: 8. + maximum number of iterations for calibration. convergence : float, optional convergence criterion, maximum relative change of SH - coefficients. Default: 0.001. + coefficients. parallel : bool, optional Whether to use parallelization in peak-finding during the calibration - procedure. Default: True + procedure. num_processes : int, optional If `parallel` is True, the number of subprocesses to use (default multiprocessing.cpu_count()). If < 0 the maximal number of cores minus ``num_processes + 1`` is used (enter -1 to use as many cores as possible). 0 raises an error. sphere : Sphere, optional. - The sphere used for peak finding. Default: default_sphere. + The sphere used for peak finding. Returns ------- diff --git a/dipy/reconst/cti.py b/dipy/reconst/cti.py index 21cc9342d7..c444a19520 100644 --- a/dipy/reconst/cti.py +++ b/dipy/reconst/cti.py @@ -552,7 +552,7 @@ def ls_fit_cti( inverse_design_matrix : array (43, g) Inverse of the design matrix. weights : bool, optional - Parameter indicating whether weights are used. Default: True. + Parameter indicating whether weights are used. min_diffusivity : float, optional Because negative eigenvalues are not physical and small eigenvalues, much smaller than the diffusion weighting, cause quite a lot of noise diff --git a/dipy/reconst/dki.py b/dipy/reconst/dki.py index a12f12a892..f7e8cf766c 100644 --- a/dipy/reconst/dki.py +++ b/dipy/reconst/dki.py @@ -534,7 +534,7 @@ def directional_kurtosis( Because high-amplitude negative values of kurtosis are not physically and biologicaly pluasible, and these cause artefacts in kurtosis-based measures, directional kurtosis values smaller than - `min_kurtosis` are replaced with `min_kurtosis`. Default = -3./7 + `min_kurtosis` are replaced with `min_kurtosis`. (theoretical kurtosis limit for regions that consist of water confined to spherical pores :footcite:p:`Jensen2005`). adc : ndarray(g,), optional @@ -969,7 +969,7 @@ def radial_kurtosis( max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, radial kurtosis values that are larger than `max_kurtosis` are replaced with - `max_kurtosis`. Default = 10 + `max_kurtosis`. analytical : bool, optional If True, RK is calculated using its analytical solution, otherwise an exact numerical estimator is used (see Notes). Default is set to True. @@ -1108,12 +1108,11 @@ def axial_kurtosis(dki_params, min_kurtosis=-3.0 / 7, max_kurtosis=10, analytica max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, axial kurtosis values that are larger than `max_kurtosis` are replaced with - `max_kurtosis`. Default = 10 + `max_kurtosis`. analytical : bool, optional If True, AK is calculated from rotated diffusion kurtosis tensor, otherwise it will be computed from the apparent diffusion kurtosis values along the principal axis of the diffusion tensor (see notes). - Default is set to True. Returns ------- @@ -1394,7 +1393,8 @@ def mean_kurtosis_tensor(dki_params, min_kurtosis=-3.0 / 7, max_kurtosis=10): max_kurtosis : float, optional To keep kurtosis values within a plausible biophysical range, mean kurtosis values that are larger than `max_kurtosis` are replaced with - `max_kurtosis`. Default = 10 + `max_kurtosis`. + Returns ------- mkt : array @@ -1909,7 +1909,7 @@ def predict(self, dki_params, S0=1.0): S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all - voxels. Default: 1 + voxels. References ---------- @@ -2375,7 +2375,7 @@ def predict(self, gtab, S0=1.0): S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all - voxels. Default: 1 + voxels. Notes ----- @@ -2484,7 +2484,7 @@ def ls_fit_dki( return_S0_hat : bool, optional Boolean to return (True) or not (False) the S0 values for the fit. weights : bool, optional - Parameter indicating whether weights are used. Default: True. + Parameter indicating whether weights are used. min_diffusivity : float, optional Because negative eigenvalues are not physical and small eigenvalues, much smaller than the diffusion weighting, cause quite a lot of noise @@ -2561,7 +2561,7 @@ def cls_fit_dki( return_S0_hat : bool, optional Boolean to return (True) or not (False) the S0 values for the fit. weights : bool, optional - Parameter indicating whether weights are used. Default: True. + Parameter indicating whether weights are used. min_diffusivity : float, optional Because negative eigenvalues are not physical and small eigenvalues, much smaller than the diffusion weighting, cause quite a lot of noise diff --git a/dipy/reconst/dki_micro.py b/dipy/reconst/dki_micro.py index a9c447642b..d8023874e7 100644 --- a/dipy/reconst/dki_micro.py +++ b/dipy/reconst/dki_micro.py @@ -208,7 +208,7 @@ def dkimicro_prediction(params, gtab, S0=1): The gradient table for this prediction S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all - voxels. Default: 1 + voxels Returns ------- @@ -449,7 +449,7 @@ def predict(self, params, S0=1.0): S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all - voxels. Default: 1 + voxels. Notes ----- diff --git a/dipy/reconst/dsi.py b/dipy/reconst/dsi.py index 10cf5e7391..e335f1f8ae 100644 --- a/dipy/reconst/dsi.py +++ b/dipy/reconst/dsi.py @@ -176,7 +176,7 @@ def rtop_signal(self, filtering=True): Parameters ---------- filtering : boolean, optional - Whether to perform Hanning filtering. Default: True + Whether to perform Hanning filtering. Returns ------- @@ -206,7 +206,7 @@ def rtop_pdf(self, normalized=True): ---------- normalized : boolean, optional Whether to normalize the propagator by its sum in order to obtain a - pdf. Default: True. + pdf. Returns ------- @@ -241,7 +241,7 @@ def msd_discrete(self, normalized=True): ---------- normalized : boolean, optional Whether to normalize the propagator by its sum in order to obtain a - pdf. Default: True + pdf. Returns ------- diff --git a/dipy/reconst/dti.py b/dipy/reconst/dti.py index 1dee3fb4ca..9d43f6af44 100755 --- a/dipy/reconst/dti.py +++ b/dipy/reconst/dti.py @@ -1775,7 +1775,7 @@ def nlls_fit_tensor( M-estimator is used for weighting (see below). jac : bool, optional - Use the Jacobian? Default: True + Use the Jacobian? return_S0_hat : bool, optional Boolean to return (True) or not (False) the S0 values for the fit. @@ -1905,13 +1905,13 @@ def restore_fit_tensor( jac : bool, optional Whether to use the Jacobian of the tensor to speed the non-linear optimization procedure used to fit the tensor parameters (see also - :func:`nlls_fit_tensor`). Default: True + :func:`nlls_fit_tensor`). return_S0_hat : bool, optional Boolean to return (True) or not (False) the S0 values for the fit. fail_is_nan : bool, optional - Boolean to set failed NL fitting to NaN (True) or LS (False, default). + Boolean to set failed NL fitting to NaN (True) or LS (False). Returns ------- diff --git a/dipy/reconst/fwdti.py b/dipy/reconst/fwdti.py index 9997b99346..182d7f6df0 100644 --- a/dipy/reconst/fwdti.py +++ b/dipy/reconst/fwdti.py @@ -367,7 +367,7 @@ def wls_fit_tensor( be analyzed that has the shape data.shape[:-1] min_signal : float The minimum signal value. Needs to be a strictly positive - number. Default: 1.0e-6. + number. piterations : inter, optional Number of iterations used to refine the precision of f. Default is set to 3 corresponding to a precision of 0.01. @@ -468,12 +468,10 @@ def _nls_err_func( cholesky : bool, optional If true, the diffusion tensor elements were decomposed using Cholesky decomposition. See fwdti.nls_fit_tensor - Default: False f_transform : bool, optional If true, the water volume fraction was converted to ft = arcsin(2*f - 1) + pi/2, insuring f estimates between 0 and 1. See fwdti.nls_fit_tensor - Default: True References ---------- @@ -555,8 +553,7 @@ def _nls_jacobian_func( f_transform : bool, optional If true, the water volume fraction was converted to ft = arcsin(2*f - 1) + pi/2, insuring f estimates between 0 and 1. - See fwdti.nls_fit_tensor - Default: True + See fwdti.nls_fit_tensor. """ tensor = np.copy(tensor_elements) if f_transform: @@ -619,14 +616,12 @@ def nls_iter( cholesky : bool, optional If true it uses Cholesky decomposition to ensure that diffusion tensor is positive define. - Default: False f_transform : bool, optional If true, the water volume fractions is converted during the convergence procedure to ft = arcsin(2*f - 1) + pi/2, insuring f estimates between 0 and 1. - Default: True jac : bool, optional - Use the Jacobian? Default: False + True to use the Jacobian. weighting: str, optional the weighting scheme to use in considering the squared-error. Default behavior is to use uniform weighting. Other @@ -759,18 +754,16 @@ def nls_fit_tensor( (corresponding to 90% of the free water diffusion value). min_signal : float, optional The minimum signal value. Needs to be a strictly positive - number. Default: 1.0e-6. + number. f_transform : bool, optional If true, the water volume fractions is converted during the convergence procedure to ft = arcsin(2*f - 1) + pi/2, insuring f estimates between 0 and 1. - Default: True cholesky : bool, optional If true it uses Cholesky decomposition to ensure that diffusion tensor is positive define. - Default: False jac : bool, optional - Use the Jacobian? Default: False + True to use the Jacobian. weighting: str, optional the weighting scheme to use in considering the squared-error. Default behavior is to use uniform weighting. Other diff --git a/dipy/reconst/mcsd.py b/dipy/reconst/mcsd.py index a5fae62d35..51d87a7c25 100644 --- a/dipy/reconst/mcsd.py +++ b/dipy/reconst/mcsd.py @@ -198,13 +198,11 @@ def __init__( a MultiShellResponse object on the side. reg_sphere : Sphere, optional sphere used to build the regularization B matrix. - Default: 'symmetric362'. sh_order_max : int, optional - Maximal spherical harmonics order (l). Default: 8 + Maximal spherical harmonics order (l). iso: int, optional Number of tissue compartments for running the MSMT-CSD. Minimum number of compartments required is 2. - Default: 2 tol : int, optional Tolerance gap for b-values clustering. @@ -323,7 +321,6 @@ def fit(self, data, verbose=True, **kwargs): The diffusion data to fit the model on. verbose : bool, optional Whether to show warnings when a SolverError appears or not. - Default: True """ coeff = self.fitter(data) if verbose: diff --git a/dipy/reconst/msdki.py b/dipy/reconst/msdki.py index 9d19c91495..09d91a98fb 100644 --- a/dipy/reconst/msdki.py +++ b/dipy/reconst/msdki.py @@ -238,7 +238,7 @@ def msdki_prediction(msdki_params, gtab, S0=1.0): The gradient table for this prediction S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all - voxels. Default: 1 + voxels. Notes ----- @@ -366,7 +366,7 @@ def predict(self, msdki_params, S0=1.0): The parameters of the mean signal diffusion kurtosis model S0 : float or ndarray, optional The non diffusion-weighted signal in every voxel, or across all - voxels. Default: 1 + voxels. Returns ------- diff --git a/dipy/reconst/rumba.py b/dipy/reconst/rumba.py index 9c8b3f533d..1bdc091862 100644 --- a/dipy/reconst/rumba.py +++ b/dipy/reconst/rumba.py @@ -91,19 +91,17 @@ def __init__( voxelwise : bool, optional If true, performs a voxelwise fit. If false, performs a global fit on the entire brain at once. The global fit requires a 4D brain - volume in `fit`. Default: True + volume in `fit`. use_tv : bool, optional If true, applies total variation regularization. This only takes effect in a global fit (`voxelwise` is set to `False`). TV can only be applied to 4D brain volumes with no singleton dimensions. - Default: False sphere : Sphere, optional Sphere on which to construct fODF. If None, uses `repulsion724`. - Default: None verbose : bool, optional If true, logs updates on estimated signal-to-noise ratio after each iteration. This only takes effect in a global fit (`voxelwise` is - set to `False`). Default: False + set to `False`). References ---------- @@ -850,20 +848,19 @@ def rumba_deconv_global( fit at these voxels (0 elsewhere). n_iter : int, optional Number of iterations for fODF estimation. Must be a positive int. - Default: 600 recon_type : {'smf', 'sos'}, optional MRI reconstruction method: spatial matched filter (SMF) or sum-of-squares (SoS). SMF reconstruction generates Rician noise while - SoS reconstruction generates Noncentral Chi noise. Default: 'smf' + SoS reconstruction generates Noncentral Chi noise. n_coils : int, optional Number of coils in MRI scanner -- only relevant in SoS reconstruction. - Must be a positive int. Default: 1 + Must be a positive int. use_tv : bool, optional If true, applies total variation regularization. This requires a brain - volume with no singleton dimensions. Default: True + volume with no singleton dimensions. verbose : bool, optional If true, logs updates on estimated signal-to-noise ratio after each - iteration. Default: False + iteration. Returns ------- diff --git a/dipy/reconst/shore.py b/dipy/reconst/shore.py index 72444a4ee8..a4a521b98e 100644 --- a/dipy/reconst/shore.py +++ b/dipy/reconst/shore.py @@ -101,7 +101,7 @@ def __init__( positivity. pos_radius : float, optional Radius of the grid of the EAP in which enforce positivity in - millimeters. By default 20e-03 mm. + millimeters. cvxpy_solver : str, optional cvxpy solver name. Optionally optimize the positivity constraint with a particular cvxpy solver. See https://www.cvxpy.org/ for diff --git a/dipy/segment/bundles.py b/dipy/segment/bundles.py index cf9479a7da..cec2b392e1 100644 --- a/dipy/segment/bundles.py +++ b/dipy/segment/bundles.py @@ -136,9 +136,9 @@ def cluster_bundle(bundle, clust_thr, rng, *, nb_pts=20, select_randomly=500000) clustering threshold used in quickbundlesX rng : np.random.Generator numpy's random generator for generating random values. - nb_pts: integer (default 20) + nb_pts: integer, optional Discretizing streamlines to have nb_points number of points - select_randomly: integer (default 500000) + select_randomly: integer, optional Randomly select streamlines from the input bundle Returns @@ -419,9 +419,9 @@ def recognize( Optimization method 'L_BFGS_B' or 'Powell' optimizers can be used. (default 'L-BFGS-B') pruning_thr : float, optional - Pruning after reducing the search space (default 5). + Pruning after reducing the search space. pruning_distance : string, optional - Pruning distance type can be mdf or mam (default mdf) + Pruning distance type can be mdf or mam. Returns ------- diff --git a/dipy/segment/mask.py b/dipy/segment/mask.py index 7386611853..4bce4bbd28 100644 --- a/dipy/segment/mask.py +++ b/dipy/segment/mask.py @@ -157,13 +157,13 @@ def median_otsu( 1D array representing indices of ``axis=3`` of a 4D `input_volume`. None is only an acceptable input if ``input_volume`` is 3D. median_radius : int, optional - Radius (in voxels) of the applied median filter (default: 4). + Radius (in voxels) of the applied median filter. numpass: int, optional - Number of pass of the median filter (default: 4). + Number of pass of the median filter. autocrop: bool, optional if True, the masked input_volume will also be cropped using the bounding box defined by the masked data. Should be on if DWI is - upsampled to 1x1x1 resolution. (default: False). + upsampled to 1x1x1 resolution. dilate : None or int, optional number of iterations for binary dilation diff --git a/dipy/sims/phantom.py b/dipy/sims/phantom.py index e876fea32f..5c9639fd6e 100644 --- a/dipy/sims/phantom.py +++ b/dipy/sims/phantom.py @@ -22,14 +22,13 @@ def add_noise(vol, *, snr=1.0, S0=None, noise_type="rician", rng=None): snr : float, optional The desired signal-to-noise ratio. (See notes below.) S0 : float, optional - Reference signal for specifying `snr` (defaults to 1). + Reference signal for specifying `snr`. noise_type : string, optional The distribution of noise added. Can be either 'gaussian' for Gaussian distributed noise, 'rician' for Rice-distributed noise (default) or 'rayleigh' for a Rayleigh distribution. rng : numpy.random.Generator class, optional Numpy's random generator for setting seed values when needed. - Default is None. Returns ------- diff --git a/dipy/stats/analysis.py b/dipy/stats/analysis.py index 77566cda59..87cc2b9263 100644 --- a/dipy/stats/analysis.py +++ b/dipy/stats/analysis.py @@ -162,14 +162,13 @@ def gaussian_weights(bundle, *, n_points=100, return_mahalnobis=False, stat=np.m The streamlines to weight. n_points : int, optional The number of points to resample to. *If the `bundle` is an array, this - input is ignored*. Default: 100. + input is ignored*. return_mahalanobis : bool, optional Whether to return the Mahalanobis distance instead of the weights. - Default: False. stat : callable, optional. The statistic used to calculate the central tendency of streamlines in each node. Can be one of {`np.mean`, `np.median`} or other functions - that have similar API. Default: `np.mean` + that have similar API.` Returns ------- diff --git a/dipy/tracking/streamline.py b/dipy/tracking/streamline.py index 60dde2d0dd..fa9a251d7d 100644 --- a/dipy/tracking/streamline.py +++ b/dipy/tracking/streamline.py @@ -472,9 +472,8 @@ def orient_by_rois( Whether to make the change in-place in the original list (and return a reference to the list), or to make a copy of the list and return this copy, with the relevant streamlines reoriented. - Default: False. as_generator : bool - Whether to return a generator as output. Default: False + Whether to return a generator as output. Returns ------- @@ -574,9 +573,8 @@ def orient_by_streamline( Whether to make the change in-place in the original input (and return a reference), or to make a copy of the list and return this copy, with the relevant streamlines reoriented. - Default: False. as_generator : bool - Whether to return a generator as output. Default: False + Whether to return a generator as output. Returns ------- diff --git a/dipy/tracking/streamlinespeed.pyx b/dipy/tracking/streamlinespeed.pyx index 62484f32f0..cb361fd242 100644 --- a/dipy/tracking/streamlinespeed.pyx +++ b/dipy/tracking/streamlinespeed.pyx @@ -561,7 +561,7 @@ def compress_streamlines(streamlines, tol_error=0.01, max_segment_length=10): streamlines : one or a list of array-like of shape (N,3) Array representing x,y,z of N points in a streamline. tol_error : float, optional - Tolerance error in mm (default: 0.01). A rule of thumb is to set it + Tolerance error in mm. A rule of thumb is to set it to 0.01mm for deterministic streamlines and 0.1mm for probabilitic streamlines. max_segment_length : float, optional