Changeset ade352a in sasmodels


Ignore:
Timestamp:
Nov 9, 2015 1:43:52 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:
cbb54e2
Parents:
9d76d29
Message:

tweak code comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/spherepy.py

    r3e428ec rade352a  
    9191    qr = q * radius 
    9292    sn, cn = sin(qr), cos(qr) 
    93     # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT TWO LINES 
     93    ## The natural expression for the bessel function is the following: 
     94    ##     bes = 3 * (sn-qr*cn)/qr**3 if qr>0 else 1 
     95    ## however, to support vector q values we need to handle the conditional 
     96    ## as a vector, which we do by first evaluating the full expression 
     97    ## everywhere, then fixing it up where it is broken.   We should probably 
     98    ## set numpy to ignore the 0/0 error before we do though... 
    9499    bes = 3 * (sn - qr * cn) / qr ** 3 # may be 0/0 but we fix that next line 
    95100    bes[qr == 0] = 1 
    96     # FOR NON VECTORIZED VERSION, UNCOMMENT THE NEXT LINE 
    97     #bes = 3 * (sn-qr*cn)/qr**3 if qr>0 else 1 
    98101    fq = bes * (sld - solvent_sld) * form_volume(radius) 
    99102    return 1.0e-4 * fq ** 2 
    100 # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT LINE 
    101 Iq.vectorized = True 
     103Iq.vectorized = True  # Iq accepts an array of Q values 
    102104 
    103105def Iqxy(qx, qy, sld, solvent_sld, radius): 
    104106    return Iq(sqrt(qx ** 2 + qy ** 2), sld, solvent_sld, radius) 
    105 Iqxy.vectorized = True 
     107Iqxy.vectorized = True  # Iqxy accepts arrays of Qx, Qy values 
    106108 
    107109def sesans(z, sld, solvent_sld, radius): 
     
    119121    g[low] = sqrt(1 - dlow2 / 4.) * (1 + dlow2 / 8.) + dlow2 / 2.*(1 - dlow2 / 16.) * log(dlow / (2. + sqrt(4. - dlow2))) 
    120122    return g 
    121 sesans.vectorized = True 
     123sesans.vectorized = True  # sesans accepts and array of z values 
    122124 
    123125def ER(radius): 
Note: See TracChangeset for help on using the changeset viewer.