Changeset 5110e16 in sasmodels for explore


Ignore:
Timestamp:
Oct 24, 2017 11:22:19 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:
1820208
Parents:
6e604f8
Message:

asymint: code tidying and documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/asymint.py

    r6e604f8 r5110e16  
    22""" 
    33Asymmetric shape integration 
     4 
     5Usage: 
     6 
     7    explore/asymint.py [MODEL] [q-value] 
     8 
     9Computes the numerical integral over theta and phi of the given model at a 
     10single point q using different algorithms or the same algorithm with different 
     11precision.  It also displays a 2-D image of the theta-phi surface that is 
     12being integrated. 
     13 
     14The available models are: 
     15 
     16    triaxial_ellipsoid, parallelpiped, paracrystal, cylinder, sphere 
     17 
     18Cylinder and sphere are included as simple checks on the integration 
     19algorithms. Cylinder is better investigated using 1-D integration methods in 
     20explore/symint.py.  Sphere has an easily computed analytic value which is 
     21identical for all theta-phi for a given q, so it is useful for checking 
     22that the normalization constants are correct for the different algorithms. 
    423""" 
    524 
     
    116135        return a1, a2, a3 
    117136    def fcc(qa, qb, qc): 
    118         a1 = ( 0. + qb + qc)/2 
    119         a2 = (-qa + 0. + qc)/2 
    120         a3 = (-qa + qb + 0.)/2 
     137        a1 = ( 0 + qb + qc)/2 
     138        a2 = (-qa + 0 + qc)/2 
     139        a3 = (-qa + qb + 0)/2 
    121140        return a1, a2, a3 
    122141    lattice_fn = {'sc': sc, 'bcc': bcc, 'fcc': fcc}[lattice] 
     
    126145        # Note: paper says that different directions can have different 
    127146        # distoration factors.  Easy enough to add to the code. 
    128         # This would definitely break 8-fold symmetry. 
    129147        arg = -(dnn*d_factor)**2*(a1**2 + a2**2 + a3**2)/2 
    130148        exp_arg = env.exp(arg) 
     
    134152        q = env.sqrt(qa**2 + qb**2 + qc**2) 
    135153        Fq = env.sas_3j1x_x(q*radius) 
    136         # the kernel computes F(q)**2, but we need S(q)*F(q)**2 
     154        # the caller computes F(q)**2, but we need it to compute S(q)*F(q)**2 
    137155        return env.sqrt(Sq)*Fq 
    138156    Fq.__doc__ = "%s paracrystal a=%g da=%g r=%g"%(lattice, dnn, d_factor, radius) 
     
    141159        'sc': sphere_volume(radius/dnn), 
    142160        'bcc': 2*sphere_volume(env.sqrt(3)/2*radius/dnn), 
    143         'fcc': 4*sphere_volume(radius/dnn/env.sqrt(2)), 
     161        'fcc': 4*sphere_volume(1/env.sqrt(2)*radius/dnn), 
    144162    }[lattice] 
    145163    volume = sphere_volume(radius) 
    146     norm = CONTRAST**2*volume*Vf/10000 
     164    norm = CONTRAST**2*volume/10000*Vf 
    147165    return norm, Fq 
    148166 
Note: See TracChangeset for help on using the changeset viewer.