mailr25735 - /branches/frame_order_cleanup/specific_analyses/frame_order/uf.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 10, 2014 - 14:24:
Author: bugman
Date: Wed Sep 10 14:24:58 2014
New Revision: 25735

URL: http://svn.gna.org/viewcvs/relax?rev=25735&view=rev
Log:
Many fixes for the frame_order.permute_axes user function.

The z-axis inversion is now encoded into a 3D numpy array as the index of the 
new z-axis position
needs to be stored.  The cone_theta_x, cone_theta_y and cone_sigma_max 
parameters are now permuted
in reverse 'perm' data structure by calling its index() method.  And the 
cone_theta_x - cone_theta_y
to y-axis - x-axis switch has been removed (this may need to be reintroduced 
later).


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/uf.py

Modified: branches/frame_order_cleanup/specific_analyses/frame_order/uf.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/uf.py?rev=25735&r1=25734&r2=25735&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/uf.py    
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/uf.py    Wed 
Sep 10 14:24:58 2014
@@ -23,7 +23,7 @@
 """Module for all of the frame order specific user functions."""
 
 # Python module imports.
-from numpy import array, float64, transpose, zeros
+from numpy import array, float64, ones, transpose, zeros
 from warnings import warn
 
 # relax module imports.
@@ -116,12 +116,12 @@
     if not hasattr(cdp, 'cone_theta_y') or not is_float(cdp.cone_theta_y):
         raise RelaxError("The parameter values are not set up.")
 
-    # The angles.  Note that cone_theta_x corresponds to a rotation about 
the y-axis!
+    # The angles.
     cone_sigma_max = 0.0
     if cdp.model == MODEL_PSEUDO_ELLIPSE:
         cone_sigma_max = cdp.cone_sigma_max
-    angles = array([cdp.cone_theta_y, cdp.cone_theta_x, cone_sigma_max], 
float64)
-    y, x, z = angles
+    angles = array([cdp.cone_theta_x, cdp.cone_theta_y, cone_sigma_max], 
float64)
+    x, y, z = angles
 
     # Generate the eigenframe of the motion.
     frame = zeros((3, 3), float64)
@@ -138,6 +138,9 @@
     print("%-20s\n%s" % ("eigenframe", frame))
     print("\nPermutation '%s':" % permutation)
 
+    # The axis inversion structure.
+    inv = ones(3, float64)
+
     # The starting condition x <= y <= z.
     if x <= y and y <= z:
         # Printout.
@@ -146,10 +149,10 @@
         # The permutation and axis inversion.
         if permutation == 'A':
             perm = [0, 2, 1]
-            z_factor = -1.0
+            inv[1] = -1.0
         else:
             perm = [2, 0, 1]
-            z_factor = 1.0
+            inv[0] = 1.0
 
     # The starting condition x <= z <= y.
     elif x <= z and z <= y:
@@ -159,10 +162,10 @@
         # The permutation and axis inversion.
         if permutation == 'A':
             perm = [0, 2, 1]
-            z_factor = -1.0
+            inv[1] = -1.0
         else:
-            perm = [1, 2, 0]
-            z_factor = -1.0
+            perm = [2, 1, 0]
+            inv[0] = -1.0
 
     # The starting condition z <= x <= y.
     elif z <= x  and x <= y:
@@ -172,10 +175,10 @@
         # The permutation and axis inversion.
         if permutation == 'A':
             perm = [1, 2, 0]
-            z_factor = 1.0
+            inv[1] = 1.0
         else:
             perm = [2, 1, 0]
-            z_factor = -1.0
+            inv[0] = -1.0
 
     # Cannot be here.
     else:
@@ -183,16 +186,16 @@
 
     # Printout.
     print("%-20s %-20s" % ("permutation", perm))
-    print("%-20s %-20s" % ("z-axis inversion", z_factor))
+    print("%-20s %-20s" % ("z-axis inversion", inv))
 
     # Permute the angles.
-    cdp.cone_theta_y = angles[perm[0]]
-    cdp.cone_theta_x = angles[perm[1]]
+    cdp.cone_theta_x = angles[perm.index(0)]
+    cdp.cone_theta_y = angles[perm.index(1)]
     if cdp.model == MODEL_PSEUDO_ELLIPSE:
-        cdp.cone_sigma_max = angles[perm[2]]
+        cdp.cone_sigma_max = angles[perm.index(2)]
 
     # Permute the axes and invert the z-axis as necessary.
-    frame_new = transpose(array([frame[:, perm[0]], frame[:, perm[1]], 
z_factor*frame[:, perm[2]]], float64))
+    frame_new = transpose(array([inv[0]*frame[:, perm[0]], inv[1]*frame[:, 
perm[1]], inv[2]*frame[:, perm[2]]], float64))
 
     # Convert the permuted frame to Euler angles and store them.
     cdp.eigen_alpha, cdp.eigen_beta, cdp.eigen_gamma = 
R_to_euler_zyz(frame_new)




Related Messages


Powered by MHonArc, Updated Wed Sep 10 15:00:03 2014