Changeset ef8e68c in sasmodels for explore


Ignore:
Timestamp:
Oct 18, 2017 9:07:04 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:
aa6989b
Parents:
3c24ccd
Message:

use definition of rotation matrices from wikipedia for jitter+view equations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/angles.py

    r0d19f42 ref8e68c  
    114114    vprint(var.reshape(n, 1), mat.reshape(n, 1), comment=comment, post=post) 
    115115 
     116# From wikipedia: 
     117#    https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations 
    116118def Rx(a): 
    117119    """Rotate y and z about x""" 
    118     return Matrix([[1, 0, 0], [0, cos(a), sin(a)], [0, -sin(a), cos(a)]]) 
     120    R = [[1, 0, 0], 
     121         [0, +cos(a), -sin(a)], 
     122         [0, +sin(a), +cos(a)]] 
     123    return Matrix(R) 
    119124 
    120125def Ry(a): 
    121126    """Rotate x and z about y""" 
    122     return Matrix([[cos(a), 0, sin(a)], [0, 1, 0], [-sin(a), 0, cos(a)]]) 
     127    R = [[+cos(a), 0, +sin(a)], 
     128         [0, 1, 0], 
     129         [-sin(a), 0, +cos(a)]] 
     130    return Matrix(R) 
    123131 
    124132def Rz(a): 
    125133    """Rotate x and y about z""" 
    126     return Matrix([[cos(a), sin(a), 0], [-sin(a), cos(a), 0], [0, 0, 1]]) 
     134    R = [[+cos(a), -sin(a), 0], 
     135         [+sin(a), +cos(a), 0], 
     136         [0, 0, 1]] 
     137    return Matrix(R) 
    127138 
    128139 
     
    155166dq_xyz = Matrix([[dqx], [dqy], [dqz]]) 
    156167 
    157 # By comparing the code we generate to sasmodel 4.x orientation code, we 
    158 # are apparently using the opposite convention for phi than I expected. 
    159 # Theta 
    160 #theta = pi/2 - theta 
    161 phi = -phi 
    162 dphi = -dphi 
    163  
    164168def print_steps(jitter, jitter_inv, view, view_inv, qc_only): 
    165169    """ 
Note: See TracChangeset for help on using the changeset viewer.