Author: bugman Date: Wed Sep 17 17:11:36 2014 New Revision: 25876 URL: http://svn.gna.org/viewcvs/relax?rev=25876&view=rev Log: Updated all the lib.frame_order.*.pcs_numeric_int_*() functions for the new Sobol' point algorithm. The functions now all accept the max_points argument and terminate the loop over the Sobol' points once the maximum number of points has been reached. The calls to numpy.swapaxes() have also been removed as this is now pre-performed by the target function initialisation. Modified: branches/frame_order_cleanup/lib/frame_order/double_rotor.py branches/frame_order_cleanup/lib/frame_order/iso_cone.py branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py branches/frame_order_cleanup/lib/frame_order/rotor.py Modified: branches/frame_order_cleanup/lib/frame_order/double_rotor.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/double_rotor.py?rev=25876&r1=25875&r2=25876&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/double_rotor.py (original) +++ branches/frame_order_cleanup/lib/frame_order/double_rotor.py Wed Sep 17 17:11:36 2014 @@ -89,11 +89,13 @@ return rotate_daeg(matrix, Rx2_eigen) -def pcs_numeric_int_double_rotor(points=None, sigma_max=None, sigma_max_2=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, r_inter_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, Ri2_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): +def pcs_numeric_int_double_rotor(points=None, max_points=None, sigma_max=None, sigma_max_2=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, r_inter_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, Ri2_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): """The averaged PCS value via numerical integration for the double rotor frame order model. @keyword points: The Sobol points in the torsion-tilt angle space. @type points: numpy rank-2, 3D array + @keyword max_points: The maximum number of Sobol' points to use. Once this number is reached, the loop over the Sobol' torsion-tilt angles is terminated. + @type max_points: int @keyword sigma_max: The maximum opening angle for the first rotor. @type sigma_max: float @keyword sigma_max_2: The maximum opening angle for the second rotor. @@ -139,11 +141,15 @@ Ri2 = swapaxes(Ri2, 0, 1) # Unpack the points. - sigma, sigma2 = swapaxes(points, 0, 1) + sigma, sigma2 = points # Loop over the samples. num = 0 for i in range(len(points)): + # The maximum number of points has been reached (well, surpassed by one so exit the loop before it is used). + if num == max_points: + break + # Outside of the distribution, so skip the point. if abs(sigma[i]) > sigma_max: continue Modified: branches/frame_order_cleanup/lib/frame_order/iso_cone.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/iso_cone.py?rev=25876&r1=25875&r2=25876&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/iso_cone.py (original) +++ branches/frame_order_cleanup/lib/frame_order/iso_cone.py Wed Sep 17 17:11:36 2014 @@ -52,11 +52,13 @@ return rotate_daeg(matrix, Rx2_eigen) -def pcs_numeric_int_iso_cone_qrint(points=None, theta_max=None, sigma_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): +def pcs_numeric_int_iso_cone_qrint(points=None, max_points=None, theta_max=None, sigma_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): """Determine the averaged PCS value via numerical integration. @keyword points: The Sobol points in the torsion-tilt angle space. @type points: numpy rank-2, 3D array + @keyword max_points: The maximum number of Sobol' points to use. Once this number is reached, the loop over the Sobol' torsion-tilt angles is terminated. + @type max_points: int @keyword theta_max: The half cone angle. @type theta_max: float @keyword sigma_max: The maximum torsion angle. @@ -96,11 +98,15 @@ Ri = swapaxes(Ri, 0, 1) # Unpack the points. - theta, phi, sigma = swapaxes(points, 0, 1) + theta, phi, sigma = points # Loop over the samples. num = 0 for i in range(len(points)): + # The maximum number of points has been reached (well, surpassed by one so exit the loop before it is used). + if num == max_points: + break + # Outside of the distribution, so skip the point. if theta[i] > theta_max: continue Modified: branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py?rev=25876&r1=25875&r2=25876&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py (original) +++ branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py Wed Sep 17 17:11:36 2014 @@ -76,11 +76,13 @@ return rotate_daeg(matrix, Rx2_eigen) -def pcs_numeric_int_iso_cone_torsionless_qrint(points=None, theta_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): +def pcs_numeric_int_iso_cone_torsionless_qrint(points=None, max_points=None, theta_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): """Determine the averaged PCS value via numerical integration. @keyword points: The Sobol points in the torsion-tilt angle space. @type points: numpy rank-2, 3D array + @keyword max_points: The maximum number of Sobol' points to use. Once this number is reached, the loop over the Sobol' torsion-tilt angles is terminated. + @type max_points: int @keyword theta_max: The half cone angle. @type theta_max: float @keyword c: The PCS constant (without the interatomic distance and in Angstrom units). @@ -118,11 +120,15 @@ Ri = swapaxes(Ri, 0, 1) # Unpack the points. - theta, phi = swapaxes(points, 0, 1) + theta, phi = points # Loop over the samples. num = 0 for i in range(len(points)): + # The maximum number of points has been reached (well, surpassed by one so exit the loop before it is used). + if num == max_points: + break + # Outside of the distribution, so skip the point. if theta[i] > theta_max: continue Modified: branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py?rev=25876&r1=25875&r2=25876&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py (original) +++ branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py Wed Sep 17 17:11:36 2014 @@ -598,11 +598,13 @@ return cos(tmax)**3 -def pcs_numeric_int_pseudo_ellipse_qrint(points=None, theta_x=None, theta_y=None, sigma_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): +def pcs_numeric_int_pseudo_ellipse_qrint(points=None, max_points=None, theta_x=None, theta_y=None, sigma_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): """Determine the averaged PCS value via numerical integration. @keyword points: The Sobol points in the torsion-tilt angle space. @type points: numpy rank-2, 3D array + @keyword max_points: The maximum number of Sobol' points to use. Once this number is reached, the loop over the Sobol' torsion-tilt angles is terminated. + @type max_points: int @keyword theta_x: The x-axis half cone angle. @type theta_x: float @keyword theta_y: The y-axis half cone angle. @@ -644,7 +646,7 @@ Ri = swapaxes(Ri, 0, 1) # Unpack the points. - theta, phi, sigma = swapaxes(points, 0, 1) + theta, phi, sigma = points # Calculate theta_max. theta_max = tmax_pseudo_ellipse_array(phi, theta_x, theta_y) @@ -652,6 +654,10 @@ # Loop over the samples. num = 0 for i in range(len(points)): + # The maximum number of points has been reached (well, surpassed by one so exit the loop before it is used). + if num == max_points: + break + # Check the torsion angle first, for speed. if abs(sigma[i]) > sigma_max: continue Modified: branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py?rev=25876&r1=25875&r2=25876&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py (original) +++ branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py Wed Sep 17 17:11:36 2014 @@ -267,11 +267,13 @@ return 2 - 2*cos(tmax)**3 -def pcs_numeric_int_pseudo_ellipse_torsionless_qrint(points=None, theta_x=None, theta_y=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): +def pcs_numeric_int_pseudo_ellipse_torsionless_qrint(points=None, max_points=None, theta_x=None, theta_y=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): """Determine the averaged PCS value via numerical integration. @keyword points: The Sobol points in the torsion-tilt angle space. @type points: numpy rank-2, 3D array + @keyword max_points: The maximum number of Sobol' points to use. Once this number is reached, the loop over the Sobol' torsion-tilt angles is terminated. + @type max_points: int @keyword theta_x: The x-axis half cone angle. @type theta_x: float @keyword theta_y: The y-axis half cone angle. @@ -311,7 +313,7 @@ Ri = swapaxes(Ri, 0, 1) # Unpack the points. - theta, phi = swapaxes(points, 0, 1) + theta, phi = points # Calculate theta_max. theta_max = tmax_pseudo_ellipse_array(phi, theta_x, theta_y) @@ -319,6 +321,10 @@ # Loop over the samples. num = 0 for i in range(len(points)): + # The maximum number of points has been reached (well, surpassed by one so exit the loop before it is used). + if num == max_points: + break + # As theta_x <= theta_y, check if theta is outside of the isotropic cone defined by theta_y to minimise calculations for speed. if theta[i] > theta_y: continue Modified: branches/frame_order_cleanup/lib/frame_order/rotor.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/rotor.py?rev=25876&r1=25875&r2=25876&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/rotor.py (original) +++ branches/frame_order_cleanup/lib/frame_order/rotor.py Wed Sep 17 17:11:36 2014 @@ -73,11 +73,13 @@ return rotate_daeg(matrix, Rx2_eigen) -def pcs_numeric_int_rotor_qrint(points=None, sigma_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): +def pcs_numeric_int_rotor_qrint(points=None, max_points=None, sigma_max=None, c=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): """Determine the averaged PCS value via numerical integration. @keyword points: The Sobol points in the torsion-tilt angle space. @type points: numpy rank-2, 3D array + @keyword max_points: The maximum number of Sobol' points to use. Once this number is reached, the loop over the Sobol' torsion-tilt angles is terminated. + @type max_points: int @keyword sigma_max: The maximum rotor angle. @type sigma_max: float @keyword c: The PCS constant (without the interatomic distance and in Angstrom units). @@ -115,11 +117,15 @@ Ri = swapaxes(Ri, 0, 1) # Unpack the points (in this case, just an alias). - sigma = points + sigma = points[0] # Loop over the samples. num = 0 for i in range(len(points)): + # The maximum number of points has been reached (well, surpassed by one so exit the loop before it is used). + if num == max_points: + break + # Outside of the distribution, so skip the point. if abs(sigma[i]) > sigma_max: continue