fa786e5f2a8016725991cf2d02eebe6368dc04b3,dipy/reconst/dti.py,,wls_fit_tensor,#Any#Any#,1154
Before Change
tol = 1e-6
data = np.asarray(data)
data_flat = data.reshape((-1, data.shape[-1]))
dti_params = np.empty((len(data_flat), 4, 3))
//obtain OLS fitting matrix
//U,S,V = np.linalg.svd(design_matrix, False)
//math: beta_ols = inv(X.T*X)*X.T*y
//math: ols_fit = X*beta_ols*inv(y)
//ols_fit = np.dot(U, U.T)
ols_fit = _ols_fit_matrix(design_matrix)
min_diffusivity = tol / -design_matrix.min()
for param, sig in zip(dti_params, data_flat):
param[0], param[1:] = _wls_iter(ols_fit, design_matrix, sig,
min_diffusivity)
dti_params.shape = data.shape[:-1] + (12,)
return dti_params
After Change
//ols_fit = np.dot(U, U.T)
ols_fit = _ols_fit_matrix(design_matrix)
log_s = np.log(data)
w = np.exp(np.einsum("...ij,...j", ols_fit, log_s))
evals, evecs = decompose_tensor(
from_lower_triangular(
np.einsum("...ij,...j",
pinv_vec(design_matrix * w[..., None]),
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
Instances
Project Name: nipy/dipy
Commit Name: fa786e5f2a8016725991cf2d02eebe6368dc04b3
Time: 2015-10-15
Author: dimrozakis@gmail.com
File Name: dipy/reconst/dti.py
Class Name:
Method Name: wls_fit_tensor
Project Name: nipy/dipy
Commit Name: fa786e5f2a8016725991cf2d02eebe6368dc04b3
Time: 2015-10-15
Author: dimrozakis@gmail.com
File Name: dipy/reconst/dti.py
Class Name:
Method Name: wls_fit_tensor
Project Name: nipy/dipy
Commit Name: 4f3da275037d4fe3108039fdbfc03b2f81fbee8c
Time: 2015-10-15
Author: dimrozakis@gmail.com
File Name: dipy/reconst/dti.py
Class Name:
Method Name: ols_fit_tensor
Project Name: nipy/dipy
Commit Name: a4f0fae1a19403c0b49be4014362a26b147fa93f
Time: 2016-02-03
Author: arokem@gmail.com
File Name: dipy/reconst/sfm.py
Class Name: ExponentialIsotropicModel
Method Name: fit