Changeset 09b84ed in sasmodels
- Timestamp:
- Mar 17, 2016 12:45:55 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:
- c970053
- Parents:
- bfef528
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/poly_gauss_coil.py
r246517d r09b84ed 50 50 """ 51 51 52 from numpy import inf, sqrt, power52 from numpy import inf, sqrt, exp, power 53 53 54 54 name = "poly_gauss_coil" … … 69 69 def Iq(q, i_zero, radius_gyration, polydispersity): 70 70 # pylint: disable = missing-docstring 71 # need to trap the case of the polydispersity being 1 (ie, monodispersity)72 71 u = polydispersity - 1.0 73 if polydispersity == 1:74 minusoneonu = -1.0 / u75 else:76 minusoneonu = -1.0 / u77 72 z = ((q * radius_gyration) * (q * radius_gyration)) / (1.0 + 2.0 * u) 78 73 if (q == 0).any(): 79 inten = i_zero74 inten = i_zero 80 75 else: 81 inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 76 # need to trap the case of the polydispersity being 1 (ie, monodispersity!) 77 if polydispersity == 1: 78 inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z) 79 else: 80 minusoneonu = -1.0 / u 81 inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 82 82 return inten 83 Iq.vectorized = True # Iq accepts an array of q values83 #Iq.vectorized = True # Iq accepts an array of q values 84 84 85 85 def Iqxy(qx, qy, *args): … … 100 100 background = 'background') 101 101 102 # these unit test values taken from SasView 3.1.2 102 103 tests = [ 103 [{'scale': 70.0, 'radius_gyration': 75.0, 'polydispersity': 2.0, 'background': 0.0},104 [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 'polydispersity': 2.0, 'background': 0.0}, 104 105 [0.0106939, 0.469418], [57.6405, 0.169016]], 105 106 ]
Note: See TracChangeset
for help on using the changeset viewer.