Changeset 18b89c4 in sasview for sansmodels/src/sans/models
- Timestamp:
- Jan 18, 2011 4:26:29 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f1abc57
- Parents:
- 18695bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_dispersity.py
rdfa8832 r18b89c4 17 17 self.model.setParam('radius', 20.0) 18 18 self.model.setParam('length', 400.0) 19 self.model.setParam('contrast', 3.e-6) 19 self.model.setParam('sldCyl', 4.e-6) 20 self.model.setParam('sldSolv', 1.e-6) 20 21 self.model.setParam('background', 0.0) 21 22 self.model.setParam('cyl_theta', 0.0) … … 33 34 self.model.dispersion['radius']['width'] = 5.0 34 35 self.model.dispersion['radius']['npts'] = 100 36 self.model.dispersion['radius']['nsigmas'] = 2.5 35 37 36 38 self.assertAlmostEqual(self.model.run(0.001), 1.021051*4527.47250339, 3) … … 43 45 self.model.dispersion['radius']['width'] = 5.0 44 46 self.model.dispersion['radius']['npts'] = 100 47 self.model.dispersion['radius']['nsigmas'] = 2.5 45 48 self.model.setParam('scale', 10.0) 46 49 … … 54 57 self.model.dispersion['radius']['width'] = 5.0 55 58 self.model.dispersion['radius']['npts'] = 100 59 self.model.dispersion['radius']['nsigmas'] = 2.5 56 60 self.model.setParam('scale', 10.0) 57 61 … … 66 70 self.model.dispersion['radius']['width'] = 0.0 67 71 self.model.dispersion['radius']['npts'] = 100 72 self.model.dispersion['radius']['nsigmas'] = 2.5 68 73 self.model.setParam('scale', 1.0) 69 74 … … 84 89 weights = numpy.zeros(100) 85 90 for i in range(100): 86 values_ph[i]=( 2.0*math.pi/99.0*i)87 values_th[i]=( math.pi/99.0*i)91 values_ph[i]=(360/99.0*i) 92 values_th[i]=(180/99.0*i) 88 93 weights[i]=(1.0) 89 94 … … 143 148 self.model.dispersion['radius']['width'] = 5.0 144 149 self.model.dispersion['radius']['npts'] = 10 150 self.model.dispersion['radius']['nsigmas'] = 2.5 145 151 146 152 disp_rr = GaussianDispersion() … … 148 154 self.model.dispersion['thickness']['width'] = 2. 149 155 self.model.dispersion['thickness']['npts'] = 10 156 self.model.dispersion['thickness']['nsigmas'] = 2.5 150 157 151 158 disp_len = GaussianDispersion() … … 153 160 self.model.dispersion['length']['width'] = 50.0 154 161 self.model.dispersion['length']['npts'] = 10 162 self.model.dispersion['length']['nsigmas'] = 2.5 155 163 156 164 self.assertAlmostEqual(self.model.run(0.001), 1.07832610*358.44062724936009, 3) … … 171 179 weights = numpy.zeros(100) 172 180 for i in range(100): 173 values_ph[i]=( 2.0*math.pi/99.0*i)174 values_th[i]=( math.pi/99.0*i)181 values_ph[i]=(360/99.0*i) 182 values_th[i]=(180/99.0*i) 175 183 weights[i]=(1.0) 176 184 … … 228 236 self.model.dispersion['radius']['width'] = 10. 229 237 self.model.dispersion['radius']['npts'] = 10 238 self.model.dispersion['radius']['nsigmas'] = 2.5 230 239 231 240 disp_rr = GaussianDispersion() … … 233 242 self.model.dispersion['thickness']['width'] = 2. 234 243 self.model.dispersion['thickness']['npts'] = 10 235 244 self.model.dispersion['thickness']['nsigmas'] = 2.5 236 245 237 246 self.assertAlmostEqual(self.model.run(0.001), 1.16747510*407.344127907553, 3) … … 249 258 self.model.setParam('radius_a', 20.0) 250 259 self.model.setParam('radius_b', 400.0) 251 self.model.setParam('contrast', 3.e-6) 252 self.model.setParam('background', 0.0) 253 self.model.setParam('axis_theta', 1.57) 260 self.model.setParam('sldEll', 4.e-6) 261 self.model.setParam('sldSolv', 1.e-6) 262 self.model.setParam('background', 0.0) 263 self.model.setParam('axis_theta', 89.95445) 254 264 self.model.setParam('axis_phi', 0.0) 255 265 … … 270 280 disp = DisperseModel(self.model, ['radius_a', 'radius_b'], [5, 50]) 271 281 disp.setParam('n_pts', 10) 282 272 283 self.assertAlmostEqual(disp.run(0.001), 11948.72581312305, 3) 273 284 self.assertAlmostEqual(disp.runXY([0.001,0.001]), 11811.972359807551, 3) … … 279 290 self.model.dispersion['radius_a']['width'] = 5.0 280 291 self.model.dispersion['radius_a']['npts'] = 10 292 self.model.dispersion['radius_a']['nsigmas'] = 2.5 281 293 282 294 disp_rr = GaussianDispersion() … … 284 296 self.model.dispersion['radius_b']['width'] = 50. 285 297 self.model.dispersion['radius_b']['npts'] = 10 286 298 self.model.dispersion['radius_b']['nsigmas'] = 2.5 287 299 288 300 self.assertAlmostEqual(self.model.run(0.001), 1.10650710*11948.72581312305, 3) … … 302 314 weights = numpy.zeros(100) 303 315 for i in range(100): 304 values_ph[i]=( 2.0*math.pi/99.0*i)305 values_th[i]=( math.pi/99.0*i)316 values_ph[i]=(360/99.0*i) 317 values_th[i]=(180/99.0*i) 306 318 weights[i]=(1.0) 307 319 … … 329 341 self.model.setParam('scale', 1.0) 330 342 self.model.setParam('radius', 60.0) 331 self.model.setParam('contrast', 1) 343 self.model.setParam('sldSph', 2.0e-06) 344 self.model.setParam('sldSolv', 1.0e-6) 332 345 self.model.setParam('background', 0.0) 333 346 … … 356 369 self.model.dispersion['radius']['width'] = 10.0 357 370 self.model.dispersion['radius']['npts'] = 10 371 self.model.dispersion['radius']['nsigmas'] = 2.5 358 372 359 373 self.assertAlmostEqual(self.model.run(0.001), 1.19864810*96795008379475.25,3) … … 373 387 self.model.setParam('r_ratio', 1.5) 374 388 self.model.setParam('length', 400.0) 375 self.model.setParam('contrast', 3.e-6) 376 self.model.setParam('background', 0.0) 377 self.model.setParam('cyl_theta', 1.57) 389 self.model.setParam('sldCyl', 4.0e-6) 390 self.model.setParam('sldSolv', 1.0e-6) 391 self.model.setParam('background', 0.0) 392 self.model.setParam('cyl_theta', 90) 378 393 self.model.setParam('cyl_phi', 0.0) 379 394 self.model.setParam('cyl_psi', 0.0) … … 386 401 """ 387 402 self.assertAlmostEqual(self.model.run(0.001), 675.50440232504991, 3) 388 self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 669.5173937622792, 3)403 self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 669.5173937622792, 0) 389 404 390 405 def test_dispersion(self): … … 396 411 disp.setParam('n_pts', 10) 397 412 self.assertAlmostEqual(disp.run(0.001), 711.18048194151925, 3) 398 self.assertAlmostEqual(disp.runXY([0.001,0.001]), 704.63525988095705, 3)413 self.assertAlmostEqual(disp.runXY([0.001,0.001]), 704.63525988095705, 0) 399 414 400 415 def test_new_disp(self): … … 404 419 self.model.dispersion['r_minor']['width'] = 5.0 405 420 self.model.dispersion['r_minor']['npts'] = 10 421 self.model.dispersion['r_minor']['nsigmas'] = 2.5 406 422 407 423 disp_rr = GaussianDispersion() … … 409 425 self.model.dispersion['r_ratio']['width'] = 0.25 410 426 self.model.dispersion['r_ratio']['npts'] = 10 427 self.model.dispersion['r_ratio']['nsigmas'] = 2.5 411 428 412 429 disp_len = GaussianDispersion() … … 414 431 self.model.dispersion['length']['width'] = 50.0 415 432 self.model.dispersion['length']['npts'] = 10 433 self.model.dispersion['length']['nsigmas'] = 2.5 416 434 417 435 self.assertAlmostEqual(self.model.run(0.001), 1.23925910*711.18048194151925, 3) 418 self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 1.238955*704.63525988095705, 3)436 self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 1.238955*704.63525988095705, 0) 419 437 420 438 … … 434 452 weights = numpy.zeros(100) 435 453 for i in range(100): 436 values_ps[i]=( 2.0*math.pi/99.0*i)437 values_ph[i]=( 2.0*math.pi/99.0*i)438 values_th[i]=( math.pi/99.0*i)454 values_ps[i]=(360/99.0*i) 455 values_ph[i]=(360/99.0*i) 456 values_th[i]=(180/99.0*i) 439 457 weights[i]=(1.0) 440 458
Note: See TracChangeset
for help on using the changeset viewer.