Changeset 88d2e70 in sasview for test/sasinvariant
- Timestamp:
- Oct 11, 2018 2:03:40 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
- Children:
- 7c4bb4d
- Parents:
- e090ba90
- Location:
- test/sasinvariant/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sasinvariant/test/utest_data_handling.py
rf53d684 r88d2e70 45 45 46 46 # Test results 47 self.assertAlmostEqual s(p[0], 1.0, 5)48 self.assertAlmostEqual s(p[1], 0.0, 5)47 self.assertAlmostEqual(p[0], 1.0, 5) 48 self.assertAlmostEqual(p[1], 0.0, 5) 49 49 50 50 def test_fit_linear_data_with_noise(self): … … 74 74 75 75 # Test results 76 self.assertAlmostEqual s(p[0], 1.0, 5)77 self.assertAlmostEqual s(p[1], 0.0, 5)76 self.assertAlmostEqual(p[0], 1.0, 5) 77 self.assertAlmostEqual(p[1], 0.0, 5) 78 78 79 79 def test_fit_linear_data_with_noise_and_fixed_par(self): … … 506 506 for i in range(len(self.data.x)): 507 507 value = math.fabs(test_y[i]-self.data.y[i])/self.data.y[i] 508 self.assert _(value < 0.001)508 self.assertTrue(value < 0.001) 509 509 510 510 class TestDataExtraLowSlitGuinier(unittest.TestCase): … … 553 553 554 554 test_y = inv._low_extrapolation_function.evaluate_model(x=self.data.x[:inv._low_extrapolation_npts]) 555 self.assert _(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts]))555 self.assertTrue(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts])) 556 556 557 557 for i in range(inv._low_extrapolation_npts): 558 558 value = math.fabs(test_y[i]-self.data.y[i])/self.data.y[i] 559 self.assert _(value < 0.001)559 self.assertTrue(value < 0.001) 560 560 561 561 def test_low_data(self): … … 589 589 npts = inv._low_extrapolation_npts) 590 590 test_y = data_in_range.y 591 self.assert _(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts]))591 self.assertTrue(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts])) 592 592 for i in range(inv._low_extrapolation_npts): 593 593 value = math.fabs(test_y[i]-self.data.y[i])/self.data.y[i] 594 self.assert _(value < 0.001)594 self.assertTrue(value < 0.001) 595 595 596 596 … … 642 642 643 643 test_y = inv._high_extrapolation_function.evaluate_model(x=self.data.x[start: ]) 644 self.assert _(len(test_y) == len(self.data.y[start:]))644 self.assertTrue(len(test_y) == len(self.data.y[start:])) 645 645 646 646 for i in range(len(self.data.x[start:])): 647 647 value = math.fabs(test_y[i]-self.data.y[start+i])/self.data.y[start+i] 648 self.assert _(value < 0.001)648 self.assertTrue(value < 0.001) 649 649 650 650 def test_high_data(self): … … 677 677 npts = inv._high_extrapolation_npts) 678 678 test_y = data_in_range.y 679 self.assert _(len(test_y) == len(self.data.y[start:]))679 self.assertTrue(len(test_y) == len(self.data.y[start:])) 680 680 temp = self.data.y[start:] 681 681 682 682 for i in range(len(self.data.x[start:])): 683 683 value = math.fabs(test_y[i]- temp[i])/temp[i] 684 self.assert _(value < 0.001)684 self.assertTrue(value < 0.001) -
test/sasinvariant/test/utest_use_cases.py
rf53d684 r88d2e70 39 39 40 40 # Test results 41 self.assertAlmostEqual s(p[0], 2.3983,3)42 self.assertAlmostEqual s(p[1], 0.87833,3)41 self.assertAlmostEqual(p[0], 2.3983,3) 42 self.assertAlmostEqual(p[1], 0.87833,3) 43 43 44 44 def test_fit_line_data_fixed(self): … … 54 54 55 55 # Test results 56 self.assertAlmostEqual s(p[0], 4)57 self.assertAlmostEqual s(p[1], -4.0676,3)56 self.assertAlmostEqual(p[0], 4) 57 self.assertAlmostEqual(p[1], -4.0676,3) 58 58 59 59 … … 78 78 79 79 # Test results 80 self.assertAlmostEqual s(p[0], 2.4727,3)81 self.assertAlmostEqual s(p[1], 0.6,3)80 self.assertAlmostEqual(p[0], 2.4727,3) 81 self.assertAlmostEqual(p[1], 0.6,3) 82 82 83 83 def test_fit_line_data_fixed_no_weight(self): … … 93 93 94 94 # Test results 95 self.assertAlmostEqual s(p[0], 4)96 self.assertAlmostEqual s(p[1], -7.8,3)95 self.assertAlmostEqual(p[0], 4) 96 self.assertAlmostEqual(p[1], -7.8,3) 97 97 98 98 … … 132 132 133 133 # Test results 134 self.assertAlmostEqual s(qstar, 7.48959e-5,2)135 self.assertAlmostEqual s(v, 0.005644689, 4)136 self.assertAlmostEqual s(s , 941.7452, 3)134 self.assertAlmostEqual(qstar, 7.48959e-5,2) 135 self.assertAlmostEqual(v, 0.005644689, 4) 136 self.assertAlmostEqual(s , 941.7452, 3) 137 137 138 138 def test_use_case_2(self): … … 153 153 s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2) 154 154 # Test results 155 self.assertAlmostEqual s(qstar, 7.48959e-5,2)156 self.assertAlmostEqual s(v, 0.005644689, 1)157 self.assertAlmostEqual s(s , 941.7452, 3)155 self.assertAlmostEqual(qstar, 7.48959e-5,2) 156 self.assertAlmostEqual(v, 0.005644689, 1) 157 self.assertAlmostEqual(s , 941.7452, 3) 158 158 159 159 def test_use_case_3(self): … … 190 190 191 191 # Test results 192 self.assertAlmostEqual s(qstar, 7.49e-5, 1)193 self.assertAlmostEqual s(v, 0.005648401, 4)194 self.assertAlmostEqual s(s , 941.7452, 3)192 self.assertAlmostEqual(qstar, 7.49e-5, 1) 193 self.assertAlmostEqual(v, 0.005648401, 4) 194 self.assertAlmostEqual(s , 941.7452, 3) 195 195 196 196 def test_use_case_4(self): … … 218 218 219 219 # Test results 220 self.assertAlmostEqual s(qstar, 7.49e-5,2)221 self.assertAlmostEqual s(v, 0.005952674, 3)222 self.assertAlmostEqual s(s , 941.7452, 3)220 self.assertAlmostEqual(qstar, 7.49e-5,2) 221 self.assertAlmostEqual(v, 0.005952674, 3) 222 self.assertAlmostEqual(s , 941.7452, 3) 223 223 224 224 def test_use_case_5(self): … … 247 247 248 248 # Test results 249 self.assertAlmostEqual s(qstar, 7.88981e-5,2)250 self.assertAlmostEqual s(v, 0.005952674, 3)251 self.assertAlmostEqual s(s , 941.7452, 3)249 self.assertAlmostEqual(qstar, 7.88981e-5,2) 250 self.assertAlmostEqual(v, 0.005952674, 3) 251 self.assertAlmostEqual(s , 941.7452, 3) 252 252 253 253 def test_use_case_6(self): … … 273 273 274 274 # Test results 275 self.assertAlmostEqual s(qstar, 7.49e-5,2)276 self.assertAlmostEqual s(v, 0.005952674, 3)277 self.assertAlmostEqual s(s , 941.7452, 3)275 self.assertAlmostEqual(qstar, 7.49e-5,2) 276 self.assertAlmostEqual(v, 0.005952674, 3) 277 self.assertAlmostEqual(s , 941.7452, 3) 278 278 279 279 … … 297 297 s = inv.get_surface(contrast=2.6e-6, porod_const=2) 298 298 # Test results 299 self.assertAlmostEqual s(qstar, 1.361677e-3, 4)300 self.assertAlmostEqual s(v, 0.115352622, 2)301 self.assertAlmostEqual s(s , 941.7452, 3 )299 self.assertAlmostEqual(qstar, 1.361677e-3, 4) 300 self.assertAlmostEqual(v, 0.115352622, 2) 301 self.assertAlmostEqual(s , 941.7452, 3 ) 302 302 303 303 def test_use_case_2(self): … … 315 315 s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2) 316 316 # Test results 317 self.assertAlmostEqual s(qstar, 1.361677e-3, 4)318 self.assertAlmostEqual s(v, 0.115352622, 2)319 self.assertAlmostEqual s(s , 941.7452, 3 )317 self.assertAlmostEqual(qstar, 1.361677e-3, 4) 318 self.assertAlmostEqual(v, 0.115352622, 2) 319 self.assertAlmostEqual(s , 941.7452, 3 ) 320 320 321 321 def test_use_case_3(self): … … 336 336 337 337 # Test results 338 self.assertAlmostEqual s(qstar, 0.00138756,2)339 self.assertAlmostEqual s(v, 0.117226896,2)340 self.assertAlmostEqual s(s ,941.7452, 3)338 self.assertAlmostEqual(qstar, 0.00138756,2) 339 self.assertAlmostEqual(v, 0.117226896,2) 340 self.assertAlmostEqual(s ,941.7452, 3) 341 341 342 342 def test_use_case_4(self): … … 354 354 355 355 # Test results 356 self.assertAlmostEqual s(qstar, 0.0045773,2)356 self.assertAlmostEqual(qstar, 0.0045773,2) 357 357 358 358 def test_use_case_5(self): … … 374 374 375 375 # Test results 376 self.assertAlmostEqual s(qstar, 0.00460319,3)376 self.assertAlmostEqual(qstar, 0.00460319,3) 377 377 378 378
Note: See TracChangeset
for help on using the changeset viewer.