Edward d'Auvergne wrote:
On Thu, Mar 12, 2009 at 7:04 PM, Sébastien Morin <sebastien.morin.1@xxxxxxxxx> wrote:Edward d'Auvergne wrote:On Thu, Mar 12, 2009 at 6:05 PM, Sébastien Morin <sebastien.morin.1@xxxxxxxxx> wrote:Hi, In an attempt to find the problem causing this bug, I dug into the code and found something which could be erroneous... This alone does not fix the bug, but may be part of the fix (or not)... In function math_fns/direction_cosine.calc_ellipsoid_di(), there could be an error at line 229: diff_data.dz[1] = data.sin_b * data.sin_g If I am right (?), this part of the code is related to page 193 of Edward d'Auvergne's thesis: c11 = diff_data.dx[0] c21 = diff_data.dx[1] c31 = diff_data.dx[2] c12 = diff_data.dy[0] c22 = diff_data.dy[1] c32 = diff_data.dy[2] c13 = diff_data.dz[0] c23 = diff_data.dz[1] --> FALSE !!!! c33 = diff_data.dz[2] Indeed, c23 = sin(beta) * cos(gamma), whereas diff_data.dz[1] = data.sin_b * data.sin_g Thus, either me, the code or Edward's thesis are erroneous here... Am I right ?These unit vectors are the columns of the reverse matrix, or the transpose, or simply rows of the normal matrix. This depends if you are defining the rotation from being from the diffusion tensor frame to the lab frame or the reverse - both are related by the transpose. Hence this value is c32 which in my thesis is sin(alpha)*sin(beta). Does this answer your question and solve the issue? There could be bugs elsewhere in here though because of this.Ok... I am far from an expert in trigonometry... :p If I understand well what you wrote, there is no error in the code or the thesis ? Or should something be corrected ?Sorry, I had a much closer look and you are correct - there is an error there. The problem is a typo in equation 6.61 (page 193) of my thesis, c23 should be sin(beta) * sin(gamma). I double checked using wikipedia and tracked it back to the thesis. Glad that it's in the thesis and not the code!!! Cheers, Edward P.S. It would be useful if you could confirm that the problem is indeed in the thesis and not the code ;)
I agree.
The error in not in relax, but in the thesis... I verified this on the
Mathematica website at:
http://mathworld.wolfram.com/EulerAngles.html
where equations 39-44 are equivalent of equation 6.61 in your thesis
(page 193, c_23 -> sigma_23). From Mathematica:
sigma_23 = sin PSI * sin THETA
thus
c_23 = sin GAMMA * sin BETA
is what should be found in the thesis (instead of c_23 = cos GAMMA * sin
BETA).
Note that everything is fine in relax code. :)
Ok, I'll correct my printed copy of your masterpiece..!
Regards,
Séb :)
--
Sébastien Morin
PhD Student
S. Gagné NMR Laboratory
Université Laval & PROTEO
Québec, Canada