Yes -  we spend approximately %70 of nlls_fit_tensor in leastsq.

The next big one is decompose_tensor. Approximately 20%


On Sun, Jul 21, 2013 at 6:09 PM, Eleftherios Garyfallidis <
notifications@github.com> wrote:

> In dipy/reconst/dti.py:
>
> > +    flat_data = data.reshape((-1, data.shape[-1]))
> > +    # Use the OLS method parameters as the starting point for the optimization:
> > +    inv_design = np.linalg.pinv(design_matrix)
> > +    sig = np.maximum(flat_data, min_signal)
> > +    log_s = np.log(sig)
> > +    D = np.dot(inv_design, log_s.T).T
> > +
> > +    # Flatten for the iteration over voxels:
> > +    ols_params = np.reshape(D, (-1, D.shape[-1]))
> > +    # 12 parameters per voxel (evals + evecs):
> > +    dti_params = np.empty((flat_data.shape[0], 12))
> > +    for vox in range(flat_data.shape[0]):
> > +        start_params = ols_params[vox]
> > +        # Do the optimization in this voxel:
> > +        if jac:
> > +            this_tensor, status = opt.leastsq(_nlls_err_func, start_params,
>
> @arokem <https://github.com/arokem> when you profiled the function was
> leastsq the most heavy computation?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/nipy/dipy/pull/54/files#r5310814>
> .
>