Changeset 168052c in sasmodels for sasmodels/models/polymer_excl_volume.py
- Timestamp:
- Jan 29, 2016 6:02:35 AM (8 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:
- ed82794
- Parents:
- bf6631a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/polymer_excl_volume.py
r07a6700 r168052c 113 113 category = "shape-independent" 114 114 115 # pylint: disable=bad-whitespace, line-too-long 115 116 # ["name", "units", default, [lower, upper], "type", "description"], 116 117 parameters = [["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"], 117 118 ["porod_exp", "", 3.0, [-inf, inf], "", "Porod exponent"], 118 ] 119 ] 120 # pylint: enable=bad-whitespace, line-too-long 119 121 120 122 121 def Iq(q, rg, porod_exp): 122 123 def Iq(q, 124 rg=60.0, 125 porod_exp=3.0): 123 126 """ 124 127 :param q: Input q-value (float or [float, float]) … … 131 134 o2nu = 1.0/(2.0*nu) 132 135 133 intensity = ((1.0/(nu*power(u, o2nu))) * (gamma(o2nu)*gammainc(o2nu, u) - 136 intensity = ((1.0/(nu*power(u, o2nu))) * 137 (gamma(o2nu)*gammainc(o2nu, u) - 134 138 1.0/power(u, o2nu) * gamma(porod_exp) * 135 139 gammainc(porod_exp, u))) * (q > 0) + 1.0*(q <= 0) … … 141 145 142 146 def Iqxy(qx, qy, *args): 143 iq = Iq(sqrt(qx**2 + qy**2), *args) 147 """ 148 :param qx: Input q_x-value 149 :param qy: Input q_y-value 150 :param args: Remaining arguments 151 :return: 2D-Intensity 152 """ 144 153 145 return iq154 return Iq(sqrt(qx**2 + qy**2), *args) 146 155 147 156 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values … … 158 167 159 168 tests = [ 160 161 162 163 169 # Accuracy tests based on content in test/polyexclvol_default_igor.txt 170 [{'rg': 60, 'porod_exp': 3.0}, 0.001, 0.998801], 171 [{'rg': 60, 'porod_exp': 3.0}, 0.105363, 0.0162751], 172 [{'rg': 60, 'porod_exp': 3.0}, 0.665075, 6.56261e-05], 164 173 165 166 167 168 169 170 174 # Additional tests with larger range of parameters 175 [{'rg': 10, 'porod_exp': 4.0}, 0.1, 0.723436675809], 176 [{'rg': 2.2, 'porod_exp': 22.0, 'background': 100.0}, 5.0, 100.0], 177 [{'rg': 1.1, 'porod_exp': 1, 'background': 10.0, 'scale': 1.25}, 178 20000., 10.0000712097] 179 ]
Note: See TracChangeset
for help on using the changeset viewer.