Changeset 6dd90c1 in sasmodels for sasmodels/models/poly_gauss_coil.py


Ignore:
Timestamp:
Mar 16, 2016 9:25:21 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
63776d3
Parents:
5111921
Message:

update model tests for default background of 0.001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/poly_gauss_coil.py

    r4c05f49 r6dd90c1  
    6767 
    6868# NB: Scale and Background are implicit parameters on every model 
    69 def Iq(q, radius_gyration, polydispersity): 
     69def Iq(q, i_zero, radius_gyration, polydispersity): 
    7070    # pylint: disable = missing-docstring 
    71         u = polydispersity - 1.0 
     71    u = polydispersity - 1.0 
    7272    # TO DO 
    73         # should trap the case of polydispersity = 1 by switching to a taylor expansion 
    74         minusoneonu = -1.0 / u 
    75         z = ((x * radius_gyration) * (x * radius_gyration)) / (1.0 + 2.0 * u) 
    76         if x == 0: 
    77            inten = i_zero * 1.0 
    78         else: 
    79            inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
    80         return inten 
    81 Iq.vectorized =  True # Iq accepts an array of q values 
     73    # should trap the case of polydispersity = 1 by switching to a taylor expansion 
     74    minusoneonu = -1.0 / u 
     75    z = (q * radius_gyration) ** 2 / (1.0 + 2.0 * u) 
     76    if q == 0: 
     77        inten = i_zero * 1.0 
     78    else: 
     79        inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
     80    return inten 
     81#Iq.vectorized = True # Iq accepts an array of q values 
    8282 
    8383def Iqxy(qx, qy, *args): 
    8484    # pylint: disable = missing-docstring 
    8585    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    86 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
     86#Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    8787 
    8888demo =  dict(scale = 1.0, 
Note: See TracChangeset for help on using the changeset viewer.