Changeset ea60e08 in sasmodels for explore


Ignore:
Timestamp:
Oct 23, 2017 9:42:26 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
a1c5758
Parents:
f728001
Message:

determine rotation matrix for SasView? 3.x

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/angles.py

    rf728001 rea60e08  
    200200        #vprint(q_abc, M*q_xy, "matrix application") 
    201201 
    202 comment("==== asymmetric ====") 
    203 print_steps( 
    204     jitter=Rx(dphi)*Ry(dtheta)*Rz(dpsi), 
    205     jitter_inv=Rz(-dpsi)*Ry(-dtheta)*Rx(-dphi), 
    206     view=Rz(phi)*Ry(theta)*Rz(psi), 
    207     view_inv=Rz(-psi)*Ry(-theta)*Rz(-phi), 
    208     qc_only=False, 
    209 ) 
    210  
    211 comment("\n\n==== symmetric ====") 
    212 print_steps( 
    213     jitter=Rx(dphi)*Ry(dtheta), 
    214     jitter_inv=Ry(-dtheta)*Rx(-dphi), 
    215     view=Rz(phi)*Ry(theta), 
    216     view_inv=Ry(-theta)*Rz(-phi), 
    217     qc_only=QC_ONLY, 
    218 ) 
    219  
    220 comment("\n**** qab from qc ****") 
    221 # The indirect calculation of qab is better than directly c 
    222 # alculating qab^2 = qa^2 + qb^2 since qc can be computed 
    223 # as qc = M31*qx + M32*qy, thus requiring only two elements 
    224 # of the rotation matrix. 
    225 #vprint(qab, sqrt(qa**2 + qb**2), "Direct calculation of qab") 
    226 vprint(dqa, sqrt((qx**2+qy**2) - dqc**2), 
    227        "Indirect calculation of qab, from qab^2 = |q|^2 - qc^2") 
     202if 1: 
     203    comment("==== asymmetric ====") 
     204    print_steps( 
     205        jitter=Rx(dphi)*Ry(dtheta)*Rz(dpsi), 
     206        jitter_inv=Rz(-dpsi)*Ry(-dtheta)*Rx(-dphi), 
     207        view=Rz(phi)*Ry(theta)*Rz(psi), 
     208        view_inv=Rz(-psi)*Ry(-theta)*Rz(-phi), 
     209        qc_only=False, 
     210    ) 
     211 
     212    comment("\n\n==== symmetric ====") 
     213    print_steps( 
     214        jitter=Rx(dphi)*Ry(dtheta), 
     215        jitter_inv=Ry(-dtheta)*Rx(-dphi), 
     216        view=Rz(phi)*Ry(theta), 
     217        view_inv=Ry(-theta)*Rz(-phi), 
     218        qc_only=QC_ONLY, 
     219    ) 
     220 
     221    comment("\n**** qab from qc ****") 
     222    # The indirect calculation of qab is better than directly c 
     223    # alculating qab^2 = qa^2 + qb^2 since qc can be computed 
     224    # as qc = M31*qx + M32*qy, thus requiring only two elements 
     225    # of the rotation matrix. 
     226    #vprint(qab, sqrt(qa**2 + qb**2), "Direct calculation of qab") 
     227    vprint(dqa, sqrt((qx**2+qy**2) - dqc**2), 
     228        "Indirect calculation of qab, from qab^2 = |q|^2 - qc^2") 
     229 
     230if 0: 
     231    comment("==== asymmetric (old) ====") 
     232    view_inv = Rz(-psi)*Rx(theta)*Ry(-(pi/2 - phi)) 
     233    vprint(q_abc, view_inv*q_xy, "reverse view") 
Note: See TracChangeset for help on using the changeset viewer.