Author: bugman Date: Thu Feb 25 15:19:38 2010 New Revision: 10943 URL: http://svn.gna.org/viewcvs/relax?rev=10943&view=rev Log: The fold_spherical_angles() performs a second wrapping in case the angles shift out of the window. Window size checks have also been added. Modified: 1.3/generic_fns/angles.py Modified: 1.3/generic_fns/angles.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/angles.py?rev=10943&r1=10942&r2=10943&view=diff ============================================================================== --- 1.3/generic_fns/angles.py (original) +++ 1.3/generic_fns/angles.py Thu Feb 25 15:19:38 2010 @@ -112,6 +112,12 @@ @rtype: float """ + # Check the bounds and window. + if theta_window - (theta_upper - theta_lower) > 1e-7: + raise RelaxError, "The theta angle lower and upper bounds [%s, %s] do not match the window size of %s." % (theta_lower, theta_upper, theta_window) + if phi_window - (phi_upper - phi_lower) > 1e-7: + raise RelaxError, "The phi angle lower and upper bounds [%s, %s] do not match the window size of %s." % (phi_lower, phi_upper, phi_window) + # First wrap the angles. theta = wrap_angles(theta, theta_lower, theta_upper, theta_window) phi = wrap_angles(phi, phi_lower, phi_upper, phi_window) @@ -120,6 +126,10 @@ if phi >= phi_upper - phi_window/2.0: theta = pi - theta phi = phi - pi + + # Wrap again if necessary. + theta = wrap_angles(theta, theta_lower, theta_upper, theta_window) + phi = wrap_angles(phi, phi_lower, phi_upper, phi_window) # Return the folded angles. return theta, phi