mailr10972 - /1.3/generic_fns/structure/cones.py


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

Header


Content

Posted by edward on March 10, 2010 - 20:23:
Author: bugman
Date: Wed Mar 10 20:23:23 2010
New Revision: 10972

URL: http://svn.gna.org/viewcvs/relax?rev=10972&view=rev
Log:
Added theta_max() methods to all the isotropic cone classes.

This is for determining theta from the phi polar angle.


Modified:
    1.3/generic_fns/structure/cones.py

Modified: 1.3/generic_fns/structure/cones.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/cones.py?rev=10972&r1=10971&r2=10972&view=diff
==============================================================================
--- 1.3/generic_fns/structure/cones.py (original)
+++ 1.3/generic_fns/structure/cones.py Wed Mar 10 20:23:23 2010
@@ -24,7 +24,7 @@
 """Module containing all the different cone type classes."""
 
 # Python module imports.
-from math import cos, sqrt, sin
+from math import acos, cos, pi, sqrt, sin
 
 
 class Iso_cone:
@@ -73,6 +73,19 @@
         return self._angle
 
 
+    def theta_max(self, phi):
+        """Return the maximum azimuthal angle theta for the given polar 
angle phi.
+
+        @param phi:     The polar angle.
+        @type phi:      float
+        @return:        The maximum azimuthal angle theta for the value of 
phi.
+        @rtype:         float
+        """
+
+        # The polar angle is fixed, so return zero.
+        return 0.0
+
+
 class Pseudo_elliptic:
     """The class for the pseudo-elliptic cone.
 
@@ -97,22 +110,6 @@
         self._phi_y = phi_y
 
 
-    def phi_max(self, theta):
-        """Return the maximum polar angle phi for the given azimuthal angle 
theta.
-
-        @param theta:   The azimuthal angle.
-        @type theta:    float
-        @return:        The maximum polar angle phi for the value of theta.
-        @rtype:         float
-        """
-
-        # Determine phi_max.
-        phi_max = sqrt((self._phi_x * cos(theta))**2 + (self._phi_y * 
sin(theta))**2)
-
-        # Return the limit.
-        return phi_max
-
-
     def limit_check(self, phi, theta):
         """Determine if the point is within the cone.
 
@@ -130,3 +127,49 @@
 
         # Else inside.
         return True
+
+
+    def phi_max(self, theta):
+        """Return the maximum polar angle phi for the given azimuthal angle 
theta.
+
+        @param theta:   The azimuthal angle.
+        @type theta:    float
+        @return:        The maximum polar angle phi for the value of theta.
+        @rtype:         float
+        """
+
+        # Determine phi_max.
+        phi_max = sqrt((self._phi_x * cos(theta))**2 + (self._phi_y * 
sin(theta))**2)
+
+        # Return the limit.
+        return phi_max
+
+
+    def theta_max(self, phi, theta_min=0.0, theta_max=2*pi):
+        """Return the maximum azimuthal angle theta for the given polar 
angle phi.
+
+        @param phi:         The polar angle.
+        @type phi:          float
+        @keyword theta_min: The lower limit of the azimuthal angle range for 
complex distributions.
+        @type theta_min:    float
+        @keyword theta_max: The upper limit of the azimuthal angle range for 
complex distributions.
+        @type theta_max:    float
+        @return:            The maximum azimuthal angle theta for the value 
of phi.
+        @rtype:             float
+        """
+
+        # The factor.
+        b = sqrt((phi**2 - self._phi_y**2)/(self._phi_x**2 - self._phi_y**2))
+
+        # The 4 quadrants.
+        if theta_max < pi/2:
+            phi = acos(b)
+        elif theta_max < pi:
+            phi = acos(-b)
+        elif theta_max < 3*pi/2:
+            phi = -acos(-b)
+        elif theta_max < 2*pi:
+            phi = -acos(b)
+
+        # Return the polar angle.
+        return phi




Related Messages


Powered by MHonArc, Updated Wed Mar 10 20:40:02 2010