Changeset ade352a in sasmodels
- Timestamp:
- Nov 9, 2015 1:43:52 PM (9 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/spherepy.py
r3e428ec rade352a 91 91 qr = q * radius 92 92 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... 94 99 bes = 3 * (sn - qr * cn) / qr ** 3 # may be 0/0 but we fix that next line 95 100 bes[qr == 0] = 1 96 # FOR NON VECTORIZED VERSION, UNCOMMENT THE NEXT LINE97 #bes = 3 * (sn-qr*cn)/qr**3 if qr>0 else 198 101 fq = bes * (sld - solvent_sld) * form_volume(radius) 99 102 return 1.0e-4 * fq ** 2 100 # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT LINE 101 Iq.vectorized = True 103 Iq.vectorized = True # Iq accepts an array of Q values 102 104 103 105 def Iqxy(qx, qy, sld, solvent_sld, radius): 104 106 return Iq(sqrt(qx ** 2 + qy ** 2), sld, solvent_sld, radius) 105 Iqxy.vectorized = True 107 Iqxy.vectorized = True # Iqxy accepts arrays of Qx, Qy values 106 108 107 109 def sesans(z, sld, solvent_sld, radius): … … 119 121 g[low] = sqrt(1 - dlow2 / 4.) * (1 + dlow2 / 8.) + dlow2 / 2.*(1 - dlow2 / 16.) * log(dlow / (2. + sqrt(4. - dlow2))) 120 122 return g 121 sesans.vectorized = True 123 sesans.vectorized = True # sesans accepts and array of z values 122 124 123 125 def ER(radius):
Note: See TracChangeset
for help on using the changeset viewer.