Changeset bf09f55 in sasmodels


Ignore:
Timestamp:
Sep 19, 2017 2:04:26 PM (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:
62d7601
Parents:
8db25bf
Message:

updated angle calculator for jitter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/angles.py

    re755d8a rbf09f55  
     1from __future__ import print_function 
     2 
    13import sympy as sp 
    2 dphi, dpsi, dtheta = sp.var("dphi dpsi dtheta") 
     4sp.init_printing() 
     5dphi, dpsi, dtheta = sp.var("phi_d psi_d theta_d") 
    36phi, psi, theta = sp.var("phi psi theta") 
    47x, y, z = sp.var("x y z") 
    58qx, qy, qz = sp.var("qx qy qz") 
     9qa, qb, qc = sp.var("qa qb qc") 
    610 
    711def Rx(a): 
     
    1317 
    1418print("==== asymmetric ====") 
    15 q = sp.Matrix([[qx],[qy],[0]]) 
    16 p = sp.Matrix([[x],[y],[z]]) 
     19q_xy = sp.Matrix([[qx], [qy], [0]]) 
     20q_abc = sp.Matrix([[qa], [qb], [qc]]) 
     21p_xyz = sp.Matrix([[x], [y], [z]]) 
    1722jitter = Rx(dphi)*Ry(dtheta)*Rz(dpsi) 
    1823view = Rz(phi)*Ry(theta)*Rz(psi) 
    19 jitter_inv = Rz(-dpsi)*Ry(-dtheta)*Rx(-dphi) 
    2024view_inv = Rz(-psi)*Ry(-theta)*Rz(-phi) 
    2125print(">> jitter rotation") 
    22 for row in jitter*p: print(row) 
    23 print("\n>> jitter plus view") 
    24 for row in view*jitter*p: print(row) 
     26for row in jitter*p_xyz: sp.pprint(row) 
     27#print("\n>> jitter plus view") 
     28#for row in view*jitter*p_xyz: sp.pprint(row) 
    2529print("\n>> view reverse") 
    26 for row in view_inv*q: print(row) 
     30for row in view_inv*q_xy: sp.pprint(row) 
    2731print("\n>> jitter reverse") 
    28 for row in jitter_inv*view_inv*q: print(row) 
     32jitter_inv = Rz(-psi)*Ry(-theta)*Rx(-phi) 
     33for row in jitter_inv*q_abc: sp.pprint(row) 
     34print("\n>> jitter view reverse") 
     35jitter_inv = Rz(-dpsi)*Ry(-dtheta)*Rx(-dphi) 
     36for row in jitter_inv*view_inv*q_xy: sp.pprint(row) 
    2937 
    3038print("\n\n==== symmetric ====") 
    31 q = sp.Matrix([[qx],[0],[0]]) 
    32 p = sp.Matrix([[x],[y],[z]]) 
     39q_x = sp.Matrix([[qx], [0], [0]]) 
     40q_ac = sp.Matrix([[qa], [0], [qc]]) 
     41p_xyz = sp.Matrix([[x], [y], [z]]) 
    3342jitter = Rx(dphi)*Ry(dtheta) 
    3443view = Rz(phi)*Ry(theta) 
     
    3645view_inv = Ry(-theta)*Rz(-phi) 
    3746print(">> jitter rotation") 
    38 for row in jitter*p: print(row) 
    39 print("\n>> jitter plus view") 
    40 for row in view*jitter*p: print(row) 
     47for row in jitter*p_xyz: sp.pprint(row) 
     48#print("\n>> jitter plus view") 
     49#for row in view*jitter*p_xyz: sp.pprint(row) 
    4150print("\n>> view reverse") 
    42 for row in view_inv*q: print(row) 
     51for row in view_inv*q_x: sp.pprint(row) 
    4352print("\n>> jitter reverse") 
    44 for row in jitter_inv*view_inv*q: print(row) 
     53for row in jitter_inv*q_ac: sp.pprint(row) 
Note: See TracChangeset for help on using the changeset viewer.