Changeset a2fcbd8 in sasmodels for explore


Ignore:
Timestamp:
Jun 29, 2017 8:25:58 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:
d327066
Parents:
e5d7a60
Message:

play with cylinder integral

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/symint.py

    re5d7a60 ra2fcbd8  
    108108    pylab.ylabel("Iq 1/cm") 
    109109 
     110def Iq_trapz(q, n): 
     111    theta = np.linspace(THETA_LOW, THETA_HIGH, n) 
     112    Zq = kernel(q=q, theta=theta) 
     113    Zq *= abs(sin(theta)) 
     114    dx = theta[1]-theta[0] 
     115    return np.trapz(Zq, dx=dx)*SCALE/pi 
     116 
     117def plot_Iq(q, n, form="trapz"): 
     118    if form == "trapz": 
     119        I = np.array([Iq_trapz(qk, n) for qk in q]) 
     120    elif form == "gauss": 
     121        I = np.array([gauss_quad(qk, n) for qk in q]) 
     122    pylab.loglog(q, I, label="%s, n=%d"%(form, n)) 
     123    pylab.xlabel("q (1/A)") 
     124    pylab.ylabel("Iq (1/cm)") 
     125 
    110126NORM, KERNEL = make_cylinder(radius=10., length=100000.) 
    111127#NORM, KERNEL = make_cylinder(radius=10., length=10000.) 
     
    128144    plot(0.8, n=2000) 
    129145    pylab.legend() 
     146    pylab.figure() 
     147    plot_Iq(np.logspace(-3,0,200), n=2**16+1, form="trapz") 
     148    plot_Iq(np.logspace(-3,0,200), n=2**10+1, form="trapz") 
     149    plot_Iq(np.logspace(-3,0,200), n=150, form="gauss") 
     150    pylab.legend() 
    130151    pylab.show() 
Note: See TracChangeset for help on using the changeset viewer.