Skip to content

Commit

Permalink
Merge pull request #768 from tomotech/minor
Browse files Browse the repository at this point in the history
Document dipy.reconst.dti.iter_fit_tensor params
  • Loading branch information
Garyfallidis committed Nov 7, 2015
2 parents 718af67 + d6fd895 commit d2ef961
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Expand Up @@ -20,9 +20,10 @@ MANIFEST
dist/
.project
.pydevproject
*.swp
*.sw[po]
dipy.egg-info/
nibabel*egg/
pyx-stamps
__config__.py
.DS_Store
.DS_Store
.coverage
33 changes: 31 additions & 2 deletions dipy/reconst/dti.py
Expand Up @@ -1174,15 +1174,44 @@ def iter_fit_tensor(step=1e4):
that use vectorized operations and need to store large temporary arrays for
their vectorized operations.
Parameters
----------
step : int
The chunk size as a number of voxels.
"""

def iter_decorator(fit_tensor):
"""Actual iter decorator returned by iter_fit_tensor dec factory"""
"""Actual iter decorator returned by iter_fit_tensor dec factory
Parameters
----------
fit_tensor : callable
A tensor fitting callable (most likely a function). The callable
has to have the signature:
fit_method(design_matrix, data, *args, **kwargs)
"""

@functools.wraps(fit_tensor)
def wrapped_fit_tensor(design_matrix, data, step=step,
*args, **kwargs):
"""Iterate fit_tensor function over the data chunks"""
"""Iterate fit_tensor function over the data chunks
Parameters
----------
design_matrix : array (g, 7)
Design matrix holding the covariants used to solve for the
regression coefficients.
data : array ([X, Y, Z, ...], g)
Data or response variables holding the data. Note that the last
dimension should contain the data. It makes no copies of data.
step : int
The chunk size as a number of voxels. Overrides `step` value
of `iter_fit_tensor`.
args : {list,tuple}
Any extra optional positional arguments passed to `fit_tensor`.
kwargs : dict
Any extra optional keyword arguments passed to `fit_tensor`.
"""
shape = data.shape[:-1]
size = np.prod(shape)
step = int(step) or size
Expand Down

0 comments on commit d2ef961

Please sign in to comment.