Changeset a55fac1 in sasview for sansmodels/src/sans/models/test
- Timestamp:
- Jun 10, 2008 9:27:07 AM (17 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:
- 38fc601
- Parents:
- 06290c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_nonshape.py
r6b8399b ra55fac1 42 42 self.model.setParam('rg', 1.0) 43 43 44 value = self._func(2.0, 1.0, 1.0)*self._func(2.0, 1.0, 2.0) 45 self.assertEqual(self.model.runXY([0.0,0.0]), 2.0*2.0) 44 #value = self._func(2.0, 1.0, 1.0)*self._func(2.0, 1.0, 2.0) 45 value = self._func(2.0, 1.0, math.sqrt(5.0)) 46 #self.assertEqual(self.model.runXY([0.0,0.0]), 2.0*2.0) 47 self.assertEqual(self.model.runXY([0.0,0.0]), 2.0) 46 48 self.assertEqual(self.model.runXY([1.0,2.0]), value) 47 49 … … 55 57 phi = math.atan2(y, x) 56 58 57 value = self._func(2.0, 1.0, x)*self._func(2.0, 1.0, y) 59 #value = self._func(2.0, 1.0, x)*self._func(2.0, 1.0, y) 60 value = self._func(2.0, 1.0, r) 58 61 59 62 #self.assertEqual(self.model.run([r, phi]), value) … … 83 86 84 87 def test2D(self): 85 value = self._func(2.0, 1.0)*self._func(2.0, 2.0) 86 self.assertEqual(self.model.runXY([1.0,2.0]), value) 87 88 def test2Dphi(self): 89 x = 1.0 90 y = 2.0 91 r = math.sqrt(x**2 + y**2) 92 phi = math.atan2(y, x) 93 94 value = self._func(2.0, 1.0)*self._func(2.0, 2.0) 88 #value = self._func(2.0, 1.0)*self._func(2.0, 2.0) 89 value = self._func(2.0, math.sqrt(5.0)) 90 self.assertEqual(self.model.runXY([1.0,2.0]), value) 91 92 def test2Dphi(self): 93 x = 1.0 94 y = 2.0 95 r = math.sqrt(x**2 + y**2) 96 phi = math.atan2(y, x) 97 98 #value = self._func(2.0, 1.0)*self._func(2.0, 2.0) 99 value = self._func(2.0, r) 95 100 self.assertAlmostEquals(self.model.run([r, phi]), value,1) 96 101 … … 127 132 128 133 def test2D(self): 129 value = self._func(50.0, 1.0, 0.001, 1.0)*self._func(50.0, 1.0, 0.001, 2.0) 134 #value = self._func(50.0, 1.0, 0.001, 1.0)*self._func(50.0, 1.0, 0.001, 2.0) 135 value = self._func(50.0, 1.0, 0.001, math.sqrt(5.0)) 130 136 self.assertEqual(self.model.runXY([1.0,2.0]), value) 131 137 … … 172 178 self.model.setParam('background', 1.0) 173 179 174 value = self._func(100.0, 50.0, 1.0, 1.0)*self._func(100.0, 50.0, 1.0, 2.0) 180 #value = self._func(100.0, 50.0, 1.0, 1.0)*self._func(100.0, 50.0, 1.0, 2.0) 181 value = self._func(100.0, 50.0, 1.0, math.sqrt(5.0)) 175 182 self.assertEqual(self.model.runXY([1.0,2.0]), value) 176 183 … … 220 227 221 228 def test2D(self): 222 value = self._func(self.scale, self.length, self.back, 1.0)*self._func(self.scale, self.length, self.back, 2.0) 229 #value = self._func(self.scale, self.length, self.back, 1.0)*self._func(self.scale, self.length, self.back, 2.0) 230 value = self._func(self.scale, self.length, self.back, math.sqrt(5.0)) 223 231 self.assertEqual(self.model.runXY([1.0,2.0]), value) 224 232 … … 272 280 self.model.setParam('background', 1.0) 273 281 274 value = self._func(math.exp(-6), 4.0, 1.0, 1.0)\ 275 *self._func(math.exp(-6), 4.0, 1.0, 2.0) 282 #value = self._func(math.exp(-6), 4.0, 1.0, 1.0)\ 283 #*self._func(math.exp(-6), 4.0, 1.0, 2.0) 284 value = self._func(math.exp(-6), 4.0, 1.0, math.sqrt(5.0)) 276 285 277 286 self.assertEqual(self.model.runXY([1.0,2.0]), value) … … 332 341 self.model.setParam('scale', 0.1) 333 342 self.model.setParam('background', 0.1) 334 value = self._func(0.1,-30.0,5000.0,0.1, 1.0)\ 335 *self._func(0.1,-30.0,5000.0,0.1, 2.0) 343 #value = self._func(0.1,-30.0,5000.0,0.1, 1.0)\ 344 #*self._func(0.1,-30.0,5000.0,0.1, 2.0) 345 value = self._func(0.1,-30.0,5000.0,0.1, math.sqrt(5.0)) 336 346 337 347 self.assertEqual(self.model.runXY([1.0,2.0]), value) … … 348 358 phi = math.atan2(y, x) 349 359 350 value = self._func(0.1,-30.0,5000.0,0.1, x)\ 351 *self._func(0.1,-30.0,5000.0,0.1, y) 360 #value = self._func(0.1,-30.0,5000.0,0.1, x)\ 361 #*self._func(0.1,-30.0,5000.0,0.1, y) 362 value = self._func(0.1,-30.0,5000.0,0.1, r) 352 363 self.assertAlmostEquals(self.model.run([r, phi]), value,1) 353 364 … … 415 426 416 427 def test2D(self): 417 self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(1.0)*self._func(2.0), 8) 418 419 def test2Dphi(self): 420 421 x = 1.0 422 y = 2.0 423 r = math.sqrt(x**2 + y**2) 424 phi = math.atan2(y, x) 425 426 self.assertAlmostEquals(self.model.run([r, phi]), self._func(x)*self._func(y), 8) 428 #self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(1.0)*self._func(2.0), 8) 429 self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(math.sqrt(1.0+2.0**2)), 8) 430 431 def test2Dphi(self): 432 433 x = 1.0 434 y = 2.0 435 r = math.sqrt(x**2 + y**2) 436 phi = math.atan2(y, x) 437 438 self.assertAlmostEquals(self.model.run([r, phi]), self._func(r), 8) 427 439 428 440 class TestFractalModel(unittest.TestCase): … … 493 505 iq_y = self._func(y) 494 506 495 self.assertEqual(self.model.run([r, phi]), iq_x*iq_y) 496 self.assertEqual(self.model.runXY([x,y]), iq_x*iq_y) 507 #self.assertEqual(self.model.run([r, phi]), iq_x*iq_y) 508 self.assertEqual(self.model.run([r, phi]), self.model.run(r)) 509 #self.assertEqual(self.model.runXY([x,y]), iq_x*iq_y) 510 self.assertEqual(self.model.runXY([x,y]), self.model.run(r)) 497 511 498 512 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.