Author: tlinnet Date: Mon Mar 17 14:30:51 2014 New Revision: 22492 URL: http://svn.gna.org/viewcvs/relax?rev=22492&view=rev Log: Replaced funtion atan(omega1 / Delta_omega) with atan2(omega1 , Delta_omega), to make sure returned theta values are between 0 and pi. This was done in the function return_offset_data() in the specific_analyses of relax_disp. This was discussed in: http://thread.gmane.org/gmane.science.nmr.relax.devel/5210. Modified: trunk/specific_analyses/relax_disp/disp_data.py Modified: trunk/specific_analyses/relax_disp/disp_data.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/disp_data.py?rev=22492&r1=22491&r2=22492&view=diff ============================================================================== --- trunk/specific_analyses/relax_disp/disp_data.py (original) +++ trunk/specific_analyses/relax_disp/disp_data.py Mon Mar 17 14:30:51 2014 @@ -51,7 +51,7 @@ """ # Python module imports. -from math import atan, floor, pi, sqrt +from math import atan2, floor, pi, sqrt from numpy import array, float64, int32, ones, zeros from os.path import expanduser from random import gauss @@ -2896,12 +2896,12 @@ if Delta_omega == 0.0: theta[ei][si][mi][oi].append(pi / 2.0) # Calculate the theta angle describing the tilted rotating frame relative to the laboratory. + # theta = atan(omega1 / Delta_omega). # If Delta_omega is negative, there follow the symmetry of atan, that atan(-x) = - atan(x). - # Then it should be: theta = pi + atan(-x) = pi - atan(x) = pi - abs(atan( +/- x)) - elif omega1 / Delta_omega > 0 : - theta[ei][si][mi][oi].append(atan(omega1 / Delta_omega)) + # Then it should be: theta = pi + atan(-x) = pi - atan(x) = pi - abs(atan( +/- x)). + # This is taken care of with the atan2(y, x) function, which return atan(y / x), in radians, and the result is between -pi and pi. else: - theta[ei][si][mi][oi].append(pi + atan(omega1 / Delta_omega)) + theta[ei][si][mi][oi].append(atan2(omega1 , Delta_omega)) # Calculate effective field in rotating frame w_eff = sqrt( Delta_omega*Delta_omega + omega1*omega1 )