// Finally, converge on some solution and use it:
this_dti = np.concatenate([np.ravel(x) for x in
decompose_tensor(
from_lower_triangular(this_tensor[:6]).reshape(3,3))])
dti_params[vox] = this_dti
dti_params.shape = data.shape[:-1] + (12,)
restore_params = dti_params
return restore_params
After Change
// If leastsq failed to converge and produced nans, we"ll resort to the
// OLS solution in this voxel:
except np.linalg.LinAlgError:
print(vox)
dti_params[vox, :] = start_params
dti_params.shape = data.shape[:-1] + (12,)