Changeset 4f611f1 in sasmodels


Ignore:
Timestamp:
Jun 29, 2017 1:05:14 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:
e5d7a60
Parents:
4f0c993
Message:

play with cylinder integral

Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/special.py

    r859567e r4f611f1  
    283283    return scipy.special.sici(x)[0] 
    284284 
     285def sas_j1(x): 
     286    if np.isscalar(x): 
     287        retvalue = (sin(x) - x*cos(x))/x**2 if x != 0. else 0. 
     288    else: 
     289        with np.errstate(all='ignore'): 
     290            retvalue = (sin(x) - x*cos(x))/x**2 
     291        retvalue[x == 0.] = 0. 
     292         
    285293def sas_3j1x_x(x): 
    286     retvalue = 3*sas_j1(x)/x 
    287     retvalue[x==0] = 1. 
     294    if np.isscalar(x): 
     295        retvalue = 3*(sin(x) - x*cos(x))/x**3 if x != 0. else 1. 
     296    else: 
     297        with np.errstate(all='ignore'): 
     298            retvalue = 3*(sin(x) - x*cos(x))/x**3 
     299        retvalue[x == 0.] = 1. 
     300    return retvalue 
    288301 
    289302def sas_2J1x_x(x): 
    290     retvalue = 2*sas_J1(x)/x 
    291     retvalue[x==0] = 1. 
     303    if np.isscalar(x): 
     304        retvalue = 2*sas_J1(x)/x if x != 0 else 1. 
     305    else: 
     306        with np.errstate(all='ignore'): 
     307            retvalue = 2*sas_J1(x)/x 
     308        retvalue[x==0] = 1. 
     309    return retvalue 
    292310 
    293311 
Note: See TracChangeset for help on using the changeset viewer.