Changeset f475f90 in sasmodels


Ignore:
Timestamp:
Nov 2, 2017 12:20:15 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:
d0462cf, 376b0ee
Parents:
4991048
Message:

further guyou code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/guyou.py

    rebd2ba6 rf475f90  
    125125# cos_u = 0.171572875253809902396622551580603842860656249246103853646... 
    126126# sinsq_u = 0.970562748477140585620264690516376942836062504523376878120... 
    127 # K = 5.415790687177373152821133989303623814510776592635531270636... 
     127# K = 3.165103454447431823666270142140819753058976299237578486994... 
    128128def guyou(lam, phi): 
    129129    # [PAK] wrap into [-pi/2, pi/2] radians 
     
    163163 
    164164    # [PAK] simplify expressions, using the fact that f = -1 
    165     # Note: exp(0.5/f log(x)) => 1/sqrt(x), a x.real^2 + a x.imag^2 => a|x|^2 
    166     j = ellipticJi(0.5 * K - y, -x, sinsq_u) 
     165    j = ellipticJi(K/2 - y, -x, sinsq_u) 
    167166    tn = j[0]/j[1]  # j[0], j[1] are complex 
    168     lam = -atan2(tn.imag, tn.real) 
    169     phi = 2*atan(1/sqrt(cos_u*abs(tn)**2)) - pi/2 
     167    # Note: -atan2(im(x)/re(x)) => angle(x) 
     168    lam = -np.angle(tn) 
     169    # Note: exp(0.5/f log(a re(x)^2 + a im(x)^2)) => 1/(sqrt(a) |x|) 
     170    phi = 2*atan(1/sqrt(cos_u)/abs(tn)) - pi/2 
    170171 
    171172    # [PAK] convert to degrees, and return to original tile 
Note: See TracChangeset for help on using the changeset viewer.