Changeset 8f20419d in sasview for sansmodels/src/sans/models/test/utest_extra_models.py
- Timestamp:
- Oct 14, 2010 2:30:23 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:
- 29100cb
- Parents:
- 4cc8285c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_extra_models.py
r339ce67 r8f20419d 178 178 self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6) 179 179 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6) 180 180 181 182 class TestGuinierPorod(unittest.TestCase): 183 """ 184 Unit tests for GuinierPorod Model function 185 """ 186 def setUp(self): 187 from sans.models.GuinierPorodModel import GuinierPorodModel 188 self.model= GuinierPorodModel() 189 190 def test1D(self): 191 # the values are from Igor pro calculation 192 # the different digits are due to precision of q values 193 self.assertAlmostEqual(self.model.run(0.001), 995.112, 3) 194 self.assertAlmostEqual(self.model.run(0.105363), 0.162904, 5) 195 self.assertAlmostEqual(self.model.runXY(0.441623), 0.100854, 6) 196 197 class TestGaussLorentzGel(unittest.TestCase): 198 """ 199 Unit tests for GuinierPorod Model function 200 """ 201 def setUp(self): 202 from sans.models.GaussLorentzGelModel import GaussLorentzGelModel 203 self.model= GaussLorentzGelModel() 204 205 def test1D(self): 206 # the values are from Igor pro calculation 207 # the different digits are due to precision of q values 208 self.assertAlmostEqual(self.model.run(0.001), 149.481, 3) 209 self.assertAlmostEqual(self.model.run(0.105363), 9.1903, 4) 210 self.assertAlmostEqual(self.model.runXY(0.441623), 0.632811, 5) 211 212 213 class TestTwoPowerLaw(unittest.TestCase): 214 """ 215 Unit tests for TwoPowerLaw Model function 216 """ 217 def setUp(self): 218 from sans.models.TwoPowerLawModel import TwoPowerLawModel 219 self.model= TwoPowerLawModel() 220 221 def test1D(self): 222 # the values are from Igor pro calculation 223 # the different digits are due to precision of q values 224 self.assertEqual(self.model.run(0.001), 1000) 225 self.assertAlmostEqual(self.model.run(0.150141), 0.125945, 5) 226 self.assertAlmostEqual(self.model.runXY(0.442528), 0.00166884, 7) 227 228 class TestTwoLorentzian(unittest.TestCase): 229 """ 230 Unit tests for TwoLorentzian Model function 231 """ 232 def setUp(self): 233 from sans.models.TwoLorentzianModel import TwoLorentzianModel 234 self.model= TwoLorentzianModel() 235 236 def test1D(self): 237 # the values are from Igor pro calculation 238 # the different digits are due to precision of q values 239 self.assertAlmostEqual(self.model.run(0.001), 11.0899, 3) 240 self.assertAlmostEqual(self.model.run(0.150141), 0.410245, 5) 241 self.assertAlmostEqual(self.model.runXY(0.442528), 0.148699, 6) 242 243 244 class TestCorrLengthLaw(unittest.TestCase): 245 """ 246 Unit tests for CorrLength Model function 247 """ 248 def setUp(self): 249 from sans.models.CorrLengthModel import CorrLengthModel 250 self.model= CorrLengthModel() 251 252 def test1D(self): 253 # the values are from Igor pro calculation 254 # the different digits are due to precision of q values 255 self.assertAlmostEqual(self.model.run(0.001), 1010.08, 1) 256 self.assertAlmostEqual(self.model.run(0.150141), 0.274645, 5) 257 self.assertAlmostEqual(self.model.runXY(0.442528), 0.120396, 6) 258 259 260 class TestBroadPeak(unittest.TestCase): 261 """ 262 Unit tests for BroadPeak Model function 263 """ 264 def setUp(self): 265 from sans.models.BroadPeakModel import BroadPeakModel 266 self.model= BroadPeakModel() 267 268 def test1D(self): 269 # the values are from Igor pro calculation 270 # the different digits are due to precision of q values 271 self.assertAlmostEqual(self.model.run(0.001), 10000.5, 1) 272 self.assertAlmostEqual(self.model.run(0.1501412), 1.47557, 5) 273 self.assertAlmostEqual(self.model.runXY(0.4425284), 0.134093, 6) 274 275 class TestFractalCoreShell(unittest.TestCase): 276 """ 277 Unit tests for FractalCoreShell Model function 278 """ 279 def setUp(self): 280 from sans.models.FractalCoreShellModel import FractalCoreShellModel 281 self.model= FractalCoreShellModel() 282 283 def test1D(self): 284 #self.model.setParam('radius.width', 2.0) 285 # the values are from Igor pro calculation 286 # the different digits are due to precision of q values 287 self.assertAlmostEqual(self.model.run(0.001), 273.742, 3) 288 self.assertAlmostEqual(self.model.run(0.1501412), 0.040079, 6) 289 self.assertAlmostEqual(self.model.runXY(0.4425284), 0.00141167, 6) 290 181 291 if __name__ == '__main__': 182 292 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.