Changeset 68532f3 in sasmodels for _sources/model/ellipsoid.txt


Ignore:
Timestamp:
Nov 1, 2015 2:10:22 PM (8 years ago)
Author:
ajj
Branches:
gh-pages
Children:
4a9a316
Parents:
d1fe925
Message:

Adding docs

File:
1 moved

Legend:

Unmodified
Added
Removed
  • _sources/model/ellipsoid.txt

    rd1fe925 r68532f3  
    1 # ellipsoid model 
    2 # Note: model title and parameter table are inserted automatically 
    3 r""" 
     1.. _ellipsoid: 
     2 
     3Ellipsoid 
     4======================================================= 
     5 
     6Ellipsoid of revolution with uniform scattering length density. 
     7 
     8=========== =================================== ============ ============= 
     9Parameter   Description                         Units        Default value 
     10=========== =================================== ============ ============= 
     11scale       Source intensity                    None                     1 
     12background  Source background                   |cm^-1|                  0 
     13sld         Ellipsoid scattering length density |1e-6Ang^-2|             4 
     14solvent_sld Solvent scattering length density   |1e-6Ang^-2|             1 
     15rpolar      Polar radius                        |Ang|                   20 
     16requatorial Equatorial radius                   |Ang|                  400 
     17theta       In plane angle                      degree                  60 
     18phi         Out of plane angle                  degree                  60 
     19=========== =================================== ============ ============= 
     20 
     21The returned value is scaled to units of |cm^-1|. 
     22 
     23 
    424The form factor is normalized by the particle volume. 
    525 
     
    114134L A Feigin and D I Svergun. *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, 
    115135New York, 1987. 
    116 """ 
    117136 
    118 from numpy import inf 
    119  
    120 name = "ellipsoid" 
    121 title = "Ellipsoid of revolution with uniform scattering length density." 
    122  
    123 description = """\ 
    124 P(q.alpha)= scale*f(q)^2 + background, where f(q)= 3*(sld 
    125         - solvent_sld)*V*[sin(q*r(Rp,Re,alpha)) 
    126         -q*r*cos(qr(Rp,Re,alpha))] 
    127         /[qr(Rp,Re,alpha)]^3" 
    128  
    129      r(Rp,Re,alpha)= [Re^(2)*(sin(alpha))^2 
    130         + Rp^(2)*(cos(alpha))^2]^(1/2) 
    131  
    132         sld: SLD of the ellipsoid 
    133         solvent_sld: SLD of the solvent 
    134         V: volume of the ellipsoid 
    135         Rp: polar radius of the ellipsoid 
    136         Re: equatorial radius of the ellipsoid 
    137 """ 
    138 category = "shape:ellipsoid" 
    139  
    140 #             ["name", "units", default, [lower, upper], "type","description"], 
    141 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
    142                "Ellipsoid scattering length density"], 
    143               ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 
    144                "Solvent scattering length density"], 
    145               ["rpolar", "Ang", 20, [0, inf], "volume", 
    146                "Polar radius"], 
    147               ["requatorial", "Ang", 400, [0, inf], "volume", 
    148                "Equatorial radius"], 
    149               ["theta", "degrees", 60, [-inf, inf], "orientation", 
    150                "In plane angle"], 
    151               ["phi", "degrees", 60, [-inf, inf], "orientation", 
    152                "Out of plane angle"], 
    153              ] 
    154  
    155 source = ["lib/J1.c", "lib/gauss76.c", "ellipsoid.c"] 
    156  
    157 def ER(rpolar, requatorial): 
    158     import numpy as np 
    159  
    160     ee = np.empty_like(rpolar) 
    161     idx = rpolar > requatorial 
    162     ee[idx] = (rpolar[idx] ** 2 - requatorial[idx] ** 2) / rpolar[idx] ** 2 
    163     idx = rpolar < requatorial 
    164     ee[idx] = (requatorial[idx] ** 2 - rpolar[idx] ** 2) / requatorial[idx] ** 2 
    165     idx = rpolar == requatorial 
    166     ee[idx] = 2 * rpolar[idx] 
    167     valid = (rpolar * requatorial != 0) 
    168     bd = 1.0 - ee[valid] 
    169     e1 = np.sqrt(ee[valid]) 
    170     b1 = 1.0 + np.arcsin(e1) / (e1 * np.sqrt(bd)) 
    171     bL = (1.0 + e1) / (1.0 - e1) 
    172     b2 = 1.0 + bd / 2 / e1 * np.log(bL) 
    173     delta = 0.75 * b1 * b2 
    174  
    175     ddd = np.zeros_like(rpolar) 
    176     ddd[valid] = 2.0 * (delta + 1.0) * rpolar * requatorial ** 2 
    177     return 0.5 * ddd ** (1.0 / 3.0) 
    178  
    179  
    180 demo = dict(scale=1, background=0, 
    181             sld=6, solvent_sld=1, 
    182             rpolar=50, requatorial=30, 
    183             theta=30, phi=15, 
    184             rpolar_pd=.2, rpolar_pd_n=15, 
    185             requatorial_pd=.2, requatorial_pd_n=15, 
    186             theta_pd=15, theta_pd_n=45, 
    187             phi_pd=15, phi_pd_n=1) 
    188 oldname = 'EllipsoidModel' 
    189 oldpars = dict(theta='axis_theta', phi='axis_phi', 
    190                sld='sldEll', solvent_sld='sldSolv', 
    191                rpolar='radius_a', requatorial='radius_b') 
Note: See TracChangeset for help on using the changeset viewer.