Changeset 87964ac in sasmodels


Ignore:
Timestamp:
May 17, 2018 9:10:20 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:
65fbf7c
Parents:
df0d2ca
Message:

correct pinhole demo for truncated gaussian weight

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/resolution.py

    rdf0d2ca r87964ac  
    106106    *q* points at which the data is measured. 
    107107 
    108     *dqx* slit width in qx 
    109  
    110     *dqy* slit height in qy 
     108    *qx_width* slit width in qx 
     109 
     110    *qy_width* slit height in qy 
    111111 
    112112    *q_calc* is the list of points to calculate, or None if this should 
     
    513513 
    514514 
    515 def gaussian(q, q0, dq): 
    516     """ 
    517     Return the Gaussian resolution function. 
     515def gaussian(q, q0, dq, nsigma=2.5): 
     516    """ 
     517    Return the truncated Gaussian resolution function. 
    518518 
    519519    *q0* is the center, *dq* is the width and *q* are the points to evaluate. 
    520520    """ 
    521     return exp(-0.5*((q-q0)/dq)**2)/(sqrt(2*pi)*dq) 
     521    # Calculate the density of the tails; the resulting gaussian needs to be 
     522    # scaled by this amount in ordere to integrate to 1.0 
     523    two_tail_density = 2 * (1 + erf(-nsigma/sqrt(2)))/2 
     524    return exp(-0.5*((q-q0)/dq)**2)/(sqrt(2*pi)*dq)/(1-two_tail_density) 
    522525 
    523526 
     
    696699        output = resolution.apply(theory) 
    697700        np.testing.assert_equal(output, self.y) 
     701 
     702    # TODO: turn pinhole/slit demos into tests 
    698703 
    699704    def test_pinhole(self): 
     
    11041109 
    11051110    if isinstance(resolution, Slit1D): 
    1106         width, height = resolution.dqx, resolution.dqy 
     1111        width, height = resolution.qx_width, resolution.qy_width 
    11071112        Iq_romb = romberg_slit_1d(resolution.q, width, height, model, pars) 
    11081113    else: 
Note: See TracChangeset for help on using the changeset viewer.