Changeset 339ce67 in sasview for sansmodels/src/sans/models/test/utest_extra_models.py
- Timestamp:
- Oct 12, 2010 6:22:08 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:
- 20f00bed
- Parents:
- aaad3098
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_extra_models.py
r35aface r339ce67 1 1 """ 2 Unit tests for extra models,PolymerexclVolume, RPA10Model 2 Unit tests for extra models,PolymerexclVolume, RPA10Model 3 The reference values are calculated on IGOR/NIST package(Oct.,2010) 4 @author: JHJ Cho / UTK 3 5 """ 4 6 import unittest 5 7 class TestPolymerExclVolume(unittest.TestCase): 6 8 """ 7 9 Unit tests for PolymerexclVolume (non-shape) function 8 10 """ 9 11 def setUp(self): … … 17 19 self.assertAlmostEqual(self.model.runXY(0.41959), 0.000261302, 6) 18 20 19 class Test PolymerExclVolume(unittest.TestCase):21 class TestRPA10Case(unittest.TestCase): 20 22 """ 21 23 Unit tests for RPA10Model (non-shape) function 22 24 """ 23 25 def setUp(self): … … 83 85 # case 9 84 86 self.assertAlmostEqual(self.model9.run(0.001), 0.00839376, 6) 85 self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6) 87 self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6) 88 89 class TestBarBell(unittest.TestCase): 90 """ 91 Unit tests for BarBell function 92 """ 93 def setUp(self): 94 from sans.models.BarBellModel import BarBellModel 95 self.model= BarBellModel() 86 96 97 def test1D(self): 98 # the values are from Igor pro calculation 99 self.assertAlmostEqual(self.model.run(0.001), 2864.7, 1) 100 self.assertAlmostEqual(self.model.run(0.215268), 0.526351, 4) 101 self.assertAlmostEqual(self.model.runXY(0.414467), 0.0685892, 6) 102 103 class TestCappedCylinder(unittest.TestCase): 104 """ 105 Unit tests for CappedCylinder function 106 """ 107 def setUp(self): 108 from sans.models.CappedCylinderModel import CappedCylinderModel 109 self.model= CappedCylinderModel() 110 111 def test1D(self): 112 # the values are from Igor pro calculation 113 # the different digits are due to precision of q values 114 self.assertAlmostEqual(self.model.run(0.001), 1424.72, 2) 115 self.assertAlmostEqual(self.model.run(0.215268), 0.360736, 4) 116 self.assertAlmostEqual(self.model.runXY(0.414467), 0.110283, 5) 117 118 class TestLamellarParaCrystal(unittest.TestCase): 119 """ 120 Unit tests for LamellarParaCystal function 121 """ 122 def setUp(self): 123 from sans.models.LamellarPCrystalModel import LamellarPCrystalModel 124 self.model= LamellarPCrystalModel() 125 126 def test1D(self): 127 self.model.setParam("pd_spacing", 0.2) 128 # the values are from Igor pro calculation 129 # the different digits are due to precision of q values 130 self.assertAlmostEqual(self.model.run(0.001), 21829.3, 1) 131 self.assertAlmostEqual(self.model.run(0.215268), 0.00487686, 6) 132 self.assertAlmostEqual(self.model.runXY(0.414467), 0.00062029, 6) 133 134 135 class TestSCParaCrystal(unittest.TestCase): 136 """ 137 Unit tests for Simple Cubic ParaCrystal Model function 138 """ 139 def setUp(self): 140 from sans.models.SCCrystalModel import SCCrystalModel 141 self.model= SCCrystalModel() 142 143 def test1D(self): 144 # the values are from Igor pro calculation 145 # the different digits are due to precision of q values 146 self.assertAlmostEqual(self.model.run(0.001), 10.3038, 4) 147 self.assertAlmostEqual(self.model.run(0.215268), 0.00714905, 6) 148 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000313289, 6) 149 150 class TestFCParaCrystal(unittest.TestCase): 151 """ 152 Unit tests for Face Centered Cubic ParaCrystal Model function 153 """ 154 def setUp(self): 155 from sans.models.FCCrystalModel import FCCrystalModel 156 self.model= FCCrystalModel() 157 158 def test1D(self): 159 self.model.setParam("d_factor", 0.05) 160 # the values are from Igor pro calculation 161 # the different digits are due to precision of q values 162 self.assertAlmostEqual(self.model.run(0.001), 0.121017, 6) 163 self.assertAlmostEqual(self.model.run(0.215268), 0.0107218, 6) 164 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000443282, 6) 165 166 class TestBCParaCrystal(unittest.TestCase): 167 """ 168 Unit tests for Body Centered Cubic ParaCrystal Model function 169 """ 170 def setUp(self): 171 from sans.models.BCCrystalModel import BCCrystalModel 172 self.model= BCCrystalModel() 173 174 def test1D(self): 175 # the values are from Igor pro calculation 176 # the different digits are due to precision of q values 177 self.assertAlmostEqual(self.model.run(0.001), 1.77267, 4) 178 self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6) 179 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6) 180 87 181 if __name__ == '__main__': 88 182 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.