Author: bugman Date: Wed Jul 9 16:25:57 2008 New Revision: 6891 URL: http://svn.gna.org/viewcvs/relax?rev=6891&view=rev Log: Created the to_tensor() function to convert from 5D vector to 3D matrix. Modified: branches/rdc_analysis/maths_fns/rdc.py Modified: branches/rdc_analysis/maths_fns/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/maths_fns/rdc.py?rev=6891&r1=6890&r2=6891&view=diff ============================================================================== --- branches/rdc_analysis/maths_fns/rdc.py (original) +++ branches/rdc_analysis/maths_fns/rdc.py Wed Jul 9 16:25:57 2008 @@ -117,3 +117,32 @@ # Return the average RDC. return val / K + + +def to_tensor(tensor, Axx, Ayy, Axy, Axz, Ayz): + """Create the rank-2 3D alignment tensor matrix from the 5D vector elements. + + @param tensor: The alignment tensor object, in matrix format, to populate. + @type tensor: numpy rank-2 3D tensor + @param Axx: The xx component of the alignment tensor. + @type Axx: float + @param Ayy: The yy component of the alignment tensor. + @type Ayy: float + @param Axy: The xy component of the alignment tensor. + @type Axy: float + @param Axz: The xz component of the alignment tensor. + @type Axz: float + @param Ayz: The yz component of the alignment tensor. + @type Ayz: float + """ + + # Repackage the matrix. + A[0, 0] = Axx + A[0, 1] = Axy + A[0, 2] = Axz + A[1, 0] = Ayx + A[1, 1] = Ayy + A[1, 2] = Ayz + A[2, 0] = Azx + A[2, 1] = Azy + A[2, 2] = Azz