Changeset 64f0c5d in sasview for sansmodels/src/sans/models/test
- Timestamp:
- Jul 18, 2011 7:40:10 PM (13 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:
- 458c930
- Parents:
- d9341f2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_other_models.py
r7ef319e r64f0c5d 22 22 - hardSphereStructure 23 23 24 @ Note: We don't use matrix for 2D anymore so testEval2D can be ignored (JC) 24 25 25 26 """ … … 48 49 self.x_array = self.comp.evalDistribution(self.x) 49 50 self.y_array = self.comp.evalDistribution(self.y) 50 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 51 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 52 self.xy_matrix = self.comp.evalDistribution([qx_prime, qy_prime]) 51 52 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 53 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 54 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 53 55 54 56 def test1D(self): … … 67 69 def testEval_2D(self): 68 70 """ Test 2D model for a coreshell with evalDistribution""" 69 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 70 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 71 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 72 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 73 74 def testCriticalPoint(self): 75 """ Test coreshell at the critical point""" 76 self.assert_(numpy.isfinite(self.comp.run(0.0))) 71 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 72 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 73 74 # No more singular point 75 #def testCriticalPoint(self): 76 # """ Test coreshell at the critical point""" 77 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 77 78 78 79 class TestMultiShellModel(unittest.TestCase): … … 98 99 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 99 100 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 100 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])101 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 101 102 102 103 def test1D(self): … … 115 116 def testEval_2D(self): 116 117 """ Test 2D model for a MultiShell with evalDistribution""" 117 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 118 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 119 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 120 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 121 122 def testCriticalPoint(self): 123 """ Test multishell at the critical point""" 124 self.assert_(numpy.isfinite(self.comp.run(0.0))) 118 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 119 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 120 121 # No more singular point 122 #def testCriticalPoint(self): 123 # """ Test multishell at the critical point""" 124 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 125 125 126 126 class TestVesicleModel(unittest.TestCase): … … 142 142 self.x_array = self.comp.evalDistribution(self.x) 143 143 self.y_array = self.comp.evalDistribution(self.y) 144 qx_prime = numpy.reshape(self.x, [1,len(self.x)])145 qy_prime = numpy.reshape(self.y, [len(self.y),1])146 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])144 #qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 145 #qy_prime = numpy.reshape(self.y, [len(self.y),1]) 146 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 147 147 148 148 def test1D(self): … … 161 161 def testEval_2D(self): 162 162 """ Test 2D model for a Vesicle with evalDistribution""" 163 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 164 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 165 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 166 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 163 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 164 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 165 167 166 168 167 def testCriticalPoint(self): … … 191 190 self.x_array = self.comp.evalDistribution(self.x) 192 191 self.y_array = self.comp.evalDistribution(self.y) 193 qx_prime = numpy.reshape(self.x, [1,len(self.x)])194 qy_prime = numpy.reshape(self.y, [len(self.y),1])195 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])192 #qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 193 #qy_prime = numpy.reshape(self.y, [len(self.y),1]) 194 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 196 195 197 196 def test1D(self): … … 210 209 def testEval_2D(self): 211 210 """ Test 2D model for a BinaryHS with evalDistribution""" 212 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 213 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 214 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 215 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 216 217 def testCriticalPoint(self): 218 """ Test BinaryHS at the critical point""" 219 self.assert_(numpy.isfinite(self.comp.run(0.0))) 211 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 212 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 213 214 # No more singular point 215 #def testCriticalPoint(self): 216 # """ Test BinaryHS at the critical point""" 217 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 220 218 221 219 … … 243 241 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 244 242 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 245 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])243 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 246 244 247 245 self.q = 0.001 … … 266 264 def testEval_2D(self): 267 265 """ Test 2D model for a CoreShellCylinder with evalDistribution""" 268 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 269 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 270 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 271 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 272 273 def testCriticalPoint(self): 274 """ Test CoreShellCylinder at the critical point""" 275 self.assert_(numpy.isfinite(self.comp.run(0.0))) 266 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 267 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 268 269 # No more singular point 270 #def testCriticalPoint(self): 271 # """ Test CoreShellCylinder at the critical point""" 272 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 276 273 277 274 … … 287 284 self.comp.setParam("radius",30) 288 285 self.comp.setParam("length", 400) 289 self.comp.setParam("contrast",5.3e-6 ) 286 self.comp.setParam("sldCyl",6.3e-6 ) 287 self.comp.setParam("sldSolv",1e-6 ) 290 288 self.comp.setParam("Background", 0.01) 291 289 … … 296 294 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 297 295 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 298 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])296 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 299 297 300 298 self.q = 0.001 … … 319 317 def testEval_2D(self): 320 318 """ Test 2D model for a HollowCylinder with evalDistribution""" 321 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 322 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 323 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 324 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 325 326 def testCriticalPoint(self): 327 """ Test HollowCylinder at the critical point""" 328 self.assert_(numpy.isfinite(self.comp.run(0.0))) 319 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 320 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 321 322 # No more singular point 323 #def testCriticalPoint(self): 324 # """ Test HollowCylinder at the critical point""" 325 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 329 326 330 327 … … 337 334 #Give initial value to model 338 335 self.comp.setParam("scale", 1.0) 339 self.comp.setParam("contrast",5.3e-6 ) 336 self.comp.setParam("sldSolv",6.3e-6 ) 337 self.comp.setParam("sldCyl",1e-6 ) 340 338 self.comp.setParam("kuhn_length",100) 341 339 self.comp.setParam("length", 1000) … … 350 348 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 351 349 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 352 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])350 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 353 351 354 352 self.q = 0.001 … … 372 370 def testEval_2D(self): 373 371 """ Test 2D model for a FlexibleCylinder Model with evalDistribution""" 374 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 375 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 376 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 377 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 378 379 def testCriticalPoint(self): 380 """ Test FlexibleCylinder at the critical point""" 381 self.assert_(numpy.isfinite(self.comp.run(0.0))) 372 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 373 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 374 375 # No more singular point 376 #def testCriticalPoint(self): 377 # """ Test FlexibleCylinder at the critical point""" 378 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 382 379 383 380 … … 409 406 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 410 407 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 411 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])408 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 412 409 413 410 self.q = 0.001 … … 432 429 def testEval_2D(self): 433 430 """ Test 2D model for a StackedDisks Model with evalDistribution""" 434 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 435 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 436 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 437 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 438 439 def testCriticalPoint(self): 440 """ Test StackedDisks at the critical point""" 441 self.assert_(numpy.isfinite(self.comp.run(0.0))) 431 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 432 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 433 434 # No more singular point 435 #def testCriticalPoint(self): 436 # """ Test StackedDisks at the critical point""" 437 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 442 438 443 439 … … 453 449 self.comp.setParam("short_b", 75) 454 450 self.comp.setParam("long_c",400 ) 455 self.comp.setParam("contrast", 5.3e-006 ) 451 self.comp.setParam("sldPipe", 6.3e-006 ) 452 self.comp.setParam("sldSolv", 1e-006 ) 456 453 self.comp.setParam("scale",1.0 ) 457 454 … … 463 460 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 464 461 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 465 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])462 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 466 463 467 464 self.q = 0.001 … … 487 484 def testEval_2D(self): 488 485 """ Test 2D model for a Parallelepiped Model with evalDistribution""" 489 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 490 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 491 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 492 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 486 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 487 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 488 493 489 494 490 def testCriticalPoint(self): … … 506 502 self.comp.setParam("r_ratio",1.5) 507 503 self.comp.setParam("length",400.0) 508 self.comp.setParam("contrast",5.3e-006) 504 self.comp.setParam("sldCyl",4e-006) 505 self.comp.setParam("sldSolv",1e-006) 509 506 self.comp.setParam("background",0.0) 510 507 self.comp.setParam("cyl_theta",0.0) … … 519 516 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 520 517 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 521 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])518 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 522 519 523 520 self.q = 0.001 … … 528 525 def test1D(self): 529 526 """ Test 1D model for a EllipticalCylinder Model""" 530 self.assertAlmostEqual(self.comp.run(0.001), 2108.32, 1)527 self.assertAlmostEqual(self.comp.run(0.001), 675.504402, 4) 531 528 532 529 def test1D_2(self): … … 542 539 def testEval_2D(self): 543 540 """ Test 2D model for a EllipticalCylinder with evalDistribution""" 544 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 545 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 546 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 547 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 541 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 542 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 543 548 544 549 545 def testCriticalPoint(self): … … 561 557 self.comp.setParam("radius_a",20.0) 562 558 self.comp.setParam("radius_b",400.0) 563 self.comp.setParam("contrast",3e-006) 559 self.comp.setParam("sldEll",4e-006) 560 self.comp.setParam("sldSolv",1e-006) 564 561 self.comp.setParam("background",0.0) 565 562 self.comp.setParam("axis_theta",1.57) … … 573 570 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 574 571 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 575 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])572 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 576 573 577 574 self.q = 0.001 … … 595 592 def testEval_2D(self): 596 593 """ Test 2D model for a Ellipsoid Model with evalDistribution""" 597 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 598 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 599 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 600 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 594 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 595 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 596 601 597 602 598 def testCriticalPoint(self): … … 616 612 self.comp.setParam("equat_shell",250.0) 617 613 self.comp.setParam("polar_shell", 30.0) 618 self.comp.setParam("contrast",1e-006) 614 self.comp.setParam("sld_shell",1e-006) 615 self.comp.setParam("sld_core",2e-006) 619 616 self.comp.setParam("sld_solvent",6.3e-006) 620 617 self.comp.setParam("background",0.001) … … 629 626 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 630 627 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 631 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])628 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 632 629 633 630 self.q = 0.001 … … 638 635 def test1D(self): 639 636 """ Test 1D model for a CoreShellEllipsoid Model""" 640 self.assertAlmostEqual(self.comp.run(1.0), 0.00 2578943, 4)637 self.assertAlmostEqual(self.comp.run(1.0), 0.001894, 4) 641 638 642 639 def test1D_2(self): … … 652 649 def testEval_2D(self): 653 650 """ Test 2D model for a CoreShellEllipsoid with evalDistribution""" 654 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 655 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 656 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 657 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 651 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 652 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 653 658 654 659 655 def testCriticalPoint(self): … … 671 667 self.comp.setParam("semi_axisB", 100.0) 672 668 self.comp.setParam("semi_axisC",400.0 ) 673 self.comp.setParam("contrast",5.3e-6) 669 self.comp.setParam("sldSolv",6.3e-6) 670 self.comp.setParam("sldEll",1e-6) 674 671 self.comp.setParam("background",0.0) 675 672 self.comp.setParam("axis_theta", 1.0) … … 684 681 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 685 682 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 686 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])683 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 687 684 688 685 self.q = 0.001 … … 708 705 def testEval_2D(self): 709 706 """ Test 2D model for a TriaxialEllipsoid Model with evalDistribution""" 710 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 711 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 712 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 713 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 707 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 708 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 709 714 710 715 711 def testCriticalPoint(self): … … 736 732 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 737 733 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 738 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])734 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 739 735 740 736 def test1D(self): 741 737 """ Test 1D model for a Lamellar Model""" 742 self.assertAlmostEquals(self.comp.run(0.001), 902120)738 self.assertAlmostEquals(self.comp.run(0.001), 882289.54309, 3) 743 739 744 740 def test1D_2(self): 745 741 """ Test 2D model for a Lamellar Model""" 746 self.assertAlmostEquals(self.comp.run([0.001, 1.3]), 902120)742 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),882289.54309, 3) 747 743 748 744 def testEval_1D(self): … … 753 749 def testEval_2D(self): 754 750 """ Test 2D model for a Lamellar Model with evalDistribution""" 755 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 756 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 757 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 758 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 759 760 def testCriticalPoint(self): 761 """ Test Lamellar at the critical point""" 762 self.assert_(numpy.isfinite(self.comp.run(0.0))) 751 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 752 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 753 754 # No more singular point 755 #def testCriticalPoint(self): 756 # """ Test Lamellar at the critical point""" 757 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 763 758 764 759 class TestLamellarFFHGModel(unittest.TestCase): … … 783 778 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 784 779 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 785 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])780 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 786 781 787 782 788 783 def test1D(self): 789 784 """ Test 1D model for a LamellarFFHG Model""" 790 self.assertAlmostEquals(self.comp.run(0.001),65314 4)785 self.assertAlmostEquals(self.comp.run(0.001),653143.9209, 3) 791 786 792 787 def test1D_2(self): 793 788 """ Test 2D model for a LamellarFFHG Model""" 794 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),65314 4)789 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),653143.9209, 3) 795 790 796 791 def testEval_1D(self): … … 801 796 def testEval_2D(self): 802 797 """ Test 2D model for a LamellarFFHG Model with evalDistribution""" 803 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 804 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 805 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 806 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 807 808 def testCriticalPoint(self): 809 """ Test LamellarFFHG at the critical point""" 810 self.assert_(numpy.isfinite(self.comp.run(0.0))) 798 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 799 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 800 801 # No more singular point 802 #def testCriticalPoint(self): 803 # """ Test LamellarFFHG at the critical point""" 804 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 811 805 812 806 class TestLamellarPSModel(unittest.TestCase): … … 819 813 self.comp.setParam("spacing",400.0) 820 814 self.comp.setParam("delta",30.0) 821 self.comp.setParam("contrast",5.3e-006) 815 self.comp.setParam("sld_bi",6.3e-006) 816 self.comp.setParam("sld_sol",1e-006) 822 817 self.comp.setParam("n_plates",20.0) 823 818 self.comp.setParam("caille", 0.1) … … 831 826 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 832 827 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 833 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])828 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 834 829 835 830 836 831 def test1D(self): 837 832 """ Test 1D model for a LamellarPS Model""" 838 self.assertAlmostEquals(self.comp.run(0.001), 2 8526.8, 1)833 self.assertAlmostEquals(self.comp.run(0.001), 27899.30836, 1) 839 834 840 835 def test1D_2(self): 841 836 """ Test 2D model for a LamellarPS Model""" 842 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),2 8526.8, 1)837 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),27899.30836, 1) 843 838 844 839 def testEval_1D(self): … … 849 844 def testEval_2D(self): 850 845 """ Test 2D model for a LamellarPS Model with evalDistribution""" 851 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 852 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 853 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 854 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 855 856 def testCriticalPoint(self): 857 """ Test LamellarPS at the critical point""" 858 self.assert_(numpy.isfinite(self.comp.run(0.0))) 846 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 847 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 848 849 # No more singular point 850 #def testCriticalPoint(self): 851 # """ Test LamellarPS at the critical point""" 852 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 859 853 860 854 class TestLamellarPSHGModel(unittest.TestCase): … … 882 876 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 883 877 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 884 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])878 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 885 879 886 880 def test1D(self): 887 881 """ Test 1D model for a LamellarPSHG Model""" 888 self.assertAlmostEquals(self.comp.run(0.001),6 .83139e6, 3)882 self.assertAlmostEquals(self.comp.run(0.001),6831387.29466, 3) 889 883 890 884 def test1D_2(self): 891 885 """ Test 2D model for a LamellarPSHG Model""" 892 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),6 .83139e6,3)886 self.assertAlmostEquals(self.comp.run([0.001, 1.3]),6831387.29466,3) 893 887 894 888 def testEval_1D(self): … … 899 893 def testEval_2D(self): 900 894 """ Test 2D model for a LamellarPSHG Model with evalDistribution""" 901 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 902 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 903 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 904 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 905 906 def testCriticalPoint(self): 907 """ Test LamellarPSHG at the critical point""" 908 self.assert_(numpy.isfinite(self.comp.run(0.0))) 895 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 896 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 897 898 # No more singular point 899 #def testCriticalPoint(self): 900 # """ Test LamellarPSHG at the critical point""" 901 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 909 902 910 903 class TestSquareWellStructure(unittest.TestCase): … … 926 919 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 927 920 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 928 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])921 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 929 922 930 923 … … 944 937 def testEval_2D(self): 945 938 """ Test 2D model for a SquareWellStructure with evalDistribution""" 946 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 947 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 948 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 949 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 950 951 def testCriticalPoint(self): 952 """ Test SquareWellStructure at the critical point""" 953 self.assert_(numpy.isfinite(self.comp.run(0.0))) 939 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 940 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 941 942 # No more singular point 943 #def testCriticalPoint(self): 944 # """ Test SquareWellStructure at the critical point""" 945 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 954 946 955 947 class TestHardsphereStructure(unittest.TestCase): … … 968 960 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 969 961 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 970 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])962 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 971 963 972 964 … … 986 978 def testEval_2D(self): 987 979 """ Test 2D model for a HardsphereStructure with evalDistribution""" 988 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 989 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 990 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 991 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 992 993 def testCriticalPoint(self): 994 """ Test HardsphereStructure at the critical point""" 995 self.assert_(numpy.isfinite(self.comp.run(0.0))) 980 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 981 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 982 983 # No more singular point 984 #def testCriticalPoint(self): 985 # """ Test HardsphereStructure at the critical point""" 986 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 996 987 997 988 class TestStickyHSStructure(unittest.TestCase): … … 1013 1004 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1014 1005 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1015 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1006 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1016 1007 1017 1008 def test1D(self): … … 1030 1021 def testEval_2D(self): 1031 1022 """ Test 2D model for a StickyHSStructure with evalDistribution""" 1032 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1033 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1034 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1035 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1036 1037 def testCriticalPoint(self): 1038 """ Test StickyHSStructure at the critical point""" 1039 self.assert_(numpy.isfinite(self.comp.run(0.0))) 1023 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1024 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1025 1026 # No more singular point 1027 #def testCriticalPoint(self): 1028 # """ Test StickyHSStructure at the critical point""" 1029 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 1040 1030 1041 1031 class TestHayterMSAStructure(unittest.TestCase): … … 1059 1049 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1060 1050 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1061 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1051 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1062 1052 1063 1053 def test1D(self): … … 1076 1066 def testEval_2D(self): 1077 1067 """ Test 2D model for a HayterMSAStructure with evalDistribution""" 1078 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1079 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1080 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1081 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1068 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1069 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1070 1082 1071 1083 1072 def testCriticalPoint(self): … … 1109 1098 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1110 1099 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1111 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1112 1100 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1101 1113 1102 def test1D(self): 1114 1103 """ Test 1D model for a BEPolyelectrolyte""" … … 1126 1115 def testEval_2D(self): 1127 1116 """ Test 2D model for a BEPolyelectrolyte with evalDistribution""" 1128 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1129 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1130 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1131 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1117 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1118 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1119 1132 1120 1133 1121 def testCriticalPoint(self): … … 1153 1141 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1154 1142 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1155 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1143 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1156 1144 1157 1145 def test1D(self): 1158 1146 """ Test 1D model for a DABModel""" 1159 self.assertAlmostEqual(self.comp.run(0.001), 10.9681, 3)1147 self.assertAlmostEqual(self.comp.run(0.001),637957.9047, 3) 1160 1148 1161 1149 def test1D_2(self): 1162 1150 """ Test 2D model for a DABModel""" 1163 self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 10.9681, 3)1151 self.assertAlmostEqual(self.comp.run([0.001, 1.3]),637957.90473, 3) 1164 1152 1165 1153 def testEval_1D(self): … … 1170 1158 def testEval_2D(self): 1171 1159 """ Test 2D model for a DABModel with evalDistribution""" 1172 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1173 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1174 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1175 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1160 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1161 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1162 1176 1163 1177 1164 def testCriticalPoint(self): … … 1196 1183 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1197 1184 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1198 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1185 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1199 1186 1200 1187 def test1D(self): … … 1213 1200 def testEval_2D(self): 1214 1201 """ Test 2D model for a GuinierModel with evalDistribution""" 1215 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1216 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1217 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1218 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1202 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1203 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1204 1219 1205 1220 1206 def testCriticalPoint(self): … … 1240 1226 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1241 1227 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1242 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1228 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1243 1229 1244 1230 def test1D(self): … … 1257 1243 def testEval_2D(self): 1258 1244 """ Test 2D model for a DebyeModel with evalDistribution""" 1259 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1260 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1261 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1262 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1245 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1246 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1247 1263 1248 1264 1249 def testCriticalPoint(self): … … 1283 1268 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1284 1269 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1285 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1270 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1286 1271 1287 1272 def test1D(self): … … 1300 1285 def testEval_2D(self): 1301 1286 """ Test 2D model for a PorodModel with evalDistribution""" 1302 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1303 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1304 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1305 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1287 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1288 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1289 1306 1290 1307 1291 def testCreaticalPoint(self): … … 1328 1312 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1329 1313 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1330 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1314 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1331 1315 1332 1316 def test1D(self): … … 1345 1329 def testEval_2D(self): 1346 1330 """ Test 2D model for a PeakGauss Model with evalDistribution""" 1347 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1348 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1349 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1350 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1331 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1332 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1351 1333 1352 1334 def testCriticalPoint(self): … … 1372 1354 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1373 1355 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1374 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1356 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1375 1357 1376 1358 def test1D(self): … … 1389 1371 def testEval_2D(self): 1390 1372 """ Test 2D model for a PeakLorentz Model with evalDistribution""" 1391 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1392 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1393 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1394 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1373 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1374 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1375 1395 1376 1396 1377 def testCriticalPoint(self): … … 1398 1379 self.comp.setParam('B', 0.0) 1399 1380 self.assertRaises(ZeroDivisionError, self.comp.run, 10) 1400 self.assert_(numpy.isfinite(self.comp.run(0.0)))1381 #self.assert_(numpy.isfinite(self.comp.run(0.0))) 1401 1382 1402 1383 … … 1410 1391 self.comp.setParam('radius', 5.0) 1411 1392 self.comp.setParam('fractal_dim', 2.0) 1412 self.comp.setParam('cor r_length',100.0)1413 self.comp.setParam(' block_sld', 2.0e-6)1414 self.comp.setParam('s olvent_sld', 6.35e-6)1393 self.comp.setParam('cor_length',100.0) 1394 self.comp.setParam('sldBlock', 2.0e-6) 1395 self.comp.setParam('sldSolv', 6.35e-6) 1415 1396 self.comp.setParam('background',0.0) 1416 1397 … … 1422 1403 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1423 1404 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1424 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1405 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1425 1406 1426 1407 def test1D(self): … … 1439 1420 def testEval_2D(self): 1440 1421 """ Test 2D model for a Fractal Abs Model with evalDistribution""" 1441 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1442 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1443 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1444 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1445 1446 def testCriticalPoint(self): 1447 """ Test Fractal Abs at the critical point""" 1448 self.assert_(numpy.isfinite(self.comp.run(0.0))) 1422 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1423 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1424 1425 # No more singular point 1426 #def testCriticalPoint(self): 1427 # """ Test Fractal Abs at the critical point""" 1428 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 1449 1429 1450 1430 class TestFractalModel(unittest.TestCase): … … 1457 1437 self.comp.setParam('radius', 5.0) 1458 1438 self.comp.setParam('fractal_dim', 2.0) 1459 self.comp.setParam('cor r_length',100.0)1460 self.comp.setParam(' block_sld', 2.0e-6)1461 self.comp.setParam('s olvent_sld', 6.35e-6)1439 self.comp.setParam('cor_length',100.0) 1440 self.comp.setParam('sldBlock', 2.0e-6) 1441 self.comp.setParam('sldSolv', 6.35e-6) 1462 1442 self.comp.setParam('background',0.0) 1463 1443 … … 1469 1449 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1470 1450 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1471 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1451 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1472 1452 1473 1453 def test1D(self): … … 1486 1466 def testEval_2D(self): 1487 1467 """ Test 2D model for a Fractal Model with evalDistribution""" 1488 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1489 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1490 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1491 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1492 1493 def testCriticalPoint(self): 1494 """ Test Fractal at the critical point""" 1495 self.assert_(numpy.isfinite(self.comp.run(0.0))) 1468 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1469 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1470 1471 # No more singular point 1472 #def testCriticalPoint(self): 1473 # """ Test Fractal at the critical point""" 1474 # self.assert_(numpy.isfinite(self.comp.run(0.0))) 1496 1475 1497 1476 class TestLorentzModel(unittest.TestCase): … … 1512 1491 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1513 1492 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1514 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1493 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1515 1494 1516 1495 def test1D(self): … … 1529 1508 def testEval_2D(self): 1530 1509 """ Test 2D model for a Lorentz Model with evalDistribution""" 1531 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1532 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1533 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1534 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1510 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1511 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1512 1535 1513 1536 1514 def testCriticalPoint(self): … … 1555 1533 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1556 1534 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1557 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1535 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1558 1536 1559 1537 def test1D(self): … … 1572 1550 def testEval_2D(self): 1573 1551 """ Test 2D model for a PowerLawAbs Model with evalDistribution""" 1574 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1575 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1576 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1577 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1552 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1553 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1554 1578 1555 1579 1556 def testCriticalPoint(self): … … 1598 1575 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1599 1576 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1600 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1577 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1601 1578 1602 1579 def test1D(self): … … 1615 1592 def testEval_2D(self): 1616 1593 """ Test 2D model for a PowerLawModel with evalDistribution""" 1617 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1618 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1619 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1620 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1594 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1595 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1596 1621 1597 1622 1598 def testCriticalPoint(self): … … 1642 1618 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1643 1619 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1644 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1620 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1645 1621 1646 1622 def test1D(self): … … 1659 1635 def testEval_2D(self): 1660 1636 """ Test 2D model for a TeubnerStrey with evalDistribution""" 1661 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1662 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1663 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1664 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1637 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8) 1638 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1639 1665 1640 1666 1641 def testCriticalPoint(self): … … 1684 1659 qx_prime = numpy.reshape(self.x, [1,len(self.x)]) 1685 1660 qy_prime = numpy.reshape(self.y, [len(self.y),1]) 1686 self.xy_matrix = self.comp.evalDistribution([ qx_prime, qy_prime])1661 self.xy_matrix = self.comp.evalDistribution([self.x, self.y]) 1687 1662 1688 1663 def test1D(self): … … 1697 1672 def testEval_2D(self): 1698 1673 """ Test 2D model for a Line with evalDistribution""" 1699 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0][0],8) 1700 self.assertAlmostEquals(self.comp.runXY([0.4,1.57]),self.xy_matrix[1][0], 8) 1701 self.assertAlmostEquals(self.comp.runXY([1.3, 0.5]),self.xy_matrix[0][1],8) 1702 self.assertAlmostEquals(self.comp.runXY([1.3, 1.57]),self.xy_matrix[1][1],8) 1674 self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0], 8) 1675 self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8) 1676 1703 1677 1704 1678 def testCriticalPoint(self):
Note: See TracChangeset
for help on using the changeset viewer.