Author: bugman Date: Thu Nov 6 20:00:00 2014 New Revision: 26430 URL: http://svn.gna.org/viewcvs/relax?rev=26430&view=rev Log: Implemented the compile_1st_matrix_pseudo_ellipse_torsionless() function. This is for the lib.frame_order.pseudo_ellipse_torsionless module. The function will calculate the 1st degree in-frame frame order matrix for the torsionless pseudo-ellipse model. Modified: branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py 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=26430&r1=26429&r2=26430&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 Thu Nov 6 20:00:00 2014 @@ -34,6 +34,37 @@ from lib.geometry.pec import pec from lib.frame_order.matrix_ops import pcs_pivot_motion_torsionless_qr_int, pcs_pivot_motion_torsionless_quad_int, rotate_daeg from lib.frame_order.pseudo_ellipse import tmax_pseudo_ellipse, tmax_pseudo_ellipse_array + + +def compile_1st_matrix_pseudo_ellipse_torsionless(matrix, R_eigen, theta_x, theta_y): + """Generate the 1st degree Frame Order matrix for the torsionless pseudo-ellipse. + + @param matrix: The Frame Order matrix, 1st degree to be populated. + @type matrix: numpy 3D, rank-2 array + @param R_eigen: The eigenframe rotation matrix. + @type R_eigen: numpy 3D, rank-2 array + @param theta_x: The cone opening angle along x. + @type theta_x: float + @param theta_y: The cone opening angle along y. + @type theta_y: float + """ + + # The surface area normalisation factor. + fact = 2.0 * pec(theta_x, theta_y) + + # Invert. + if fact == 0.0: + fact = 1e100 + else: + fact = 1.0 / fact + + # Numerical integration of phi of each element. + matrix[0, 0] = fact * (2.0*pi + quad(part_int_daeg1_pseudo_ellipse_00, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) + matrix[1, 1] = -fact * (2.0*pi + quad(part_int_daeg1_pseudo_ellipse_11, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) + matrix[2, 2] = fact * quad(part_int_daeg1_pseudo_ellipse_22, -pi, pi, args=(theta_x, theta_y), full_output=1)[0] + + # Rotate and return the frame order matrix. + return rotate_daeg(matrix, R_eigen) def compile_2nd_matrix_pseudo_ellipse_torsionless(matrix, Rx2_eigen, theta_x, theta_y): @@ -86,6 +117,66 @@ # Rotate and return the frame order matrix. return rotate_daeg(matrix, Rx2_eigen) + + +def part_int_daeg1_pseudo_ellipse_00(phi, x, y): + """The theta-sigma partial integral of the 1st degree Frame Order matrix element 00 for the pseudo-ellipse. + + @param phi: The azimuthal tilt-torsion angle. + @type phi: float + @param x: The cone opening angle along x. + @type x: float + @param y: The cone opening angle along y. + @type y: float + @return: The theta-sigma partial integral. + @rtype: float + """ + + # Theta max. + tmax = tmax_pseudo_ellipse(phi, x, y) + + # The theta-sigma integral. + return cos(phi)**2 * sin(tmax)**2 - 2.0 * sin(phi)**2 * cos(tmax) + + +def part_int_daeg1_pseudo_ellipse_11(phi, x, y): + """The theta-sigma partial integral of the 1st degree Frame Order matrix element 11 for the pseudo-ellipse. + + @param phi: The azimuthal tilt-torsion angle. + @type phi: float + @param x: The cone opening angle along x. + @type x: float + @param y: The cone opening angle along y. + @type y: float + @return: The theta-sigma partial integral. + @rtype: float + """ + + # Theta max. + tmax = tmax_pseudo_ellipse(phi, x, y) + + # The theta-sigma integral. + return sin(phi)**2 * sin(tmax)**2 - 2.0 * cos(phi)**2 * cos(tmax) + + +def part_int_daeg1_pseudo_ellipse_22(phi, x, y): + """The theta-sigma partial integral of the 1st degree Frame Order matrix element 22 for the pseudo-ellipse. + + @param phi: The azimuthal tilt-torsion angle. + @type phi: float + @param x: The cone opening angle along x. + @type x: float + @param y: The cone opening angle along y. + @type y: float + @return: The theta-sigma partial integral. + @rtype: float + """ + + # Theta max. + tmax = tmax_pseudo_ellipse(phi, x, y) + + # The theta-sigma integral. + return sin(tmax)**2 def part_int_daeg2_pseudo_ellipse_torsionless_00(phi, x, y):