Changeset 5e903e8b in sasview for test/pr_inversion
- Timestamp:
- May 2, 2017 8:07:40 AM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- e123eb9
- Parents:
- b290a9e (diff), 658dd57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- test/pr_inversion
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pr_inversion/test/utest_invertor.py
rac07a3a raaf5e49 6 6 # Disable "too many methods" complaint 7 7 # pylint: disable-msg=R0904 8 9 10 import unittest, math, numpy 8 from __future__ import print_function 9 10 11 import os 12 import unittest 13 import math 14 import numpy 11 15 from sas.sascalc.pr.invertor import Invertor 12 16 17 13 18 class TestFiguresOfMerit(unittest.TestCase): 14 19 … … 235 240 self.assertTrue(chi2/51.0<10.0) 236 241 except: 237 print "chi2 =", chi2/51.0242 print("chi2 =", chi2/51.0) 238 243 raise 239 244 … … 263 268 self.assertTrue(self.invertor.chi2/len(x)<200.00) 264 269 except: 265 print "Chi2(I(q)) =", self.invertor.chi2/len(x)270 print("Chi2(I(q)) =", self.invertor.chi2/len(x)) 266 271 raise 267 272 … … 297 302 self.assertTrue(chi2/51.0<50.0) 298 303 except: 299 print "chi2(P(r)) =", chi2/51.0304 print("chi2(P(r)) =", chi2/51.0) 300 305 raise 301 306 … … 341 346 self.assertTrue(self.invertor.chi2>0) 342 347 except: 343 print "Chi2 =", self.invertor.chi2348 print("Chi2 =", self.invertor.chi2) 344 349 raise 345 350 … … 365 370 self.assertTrue(self.invertor.chi2>0) 366 371 except: 367 print "Chi2 =", self.invertor.chi2372 print("Chi2 =", self.invertor.chi2) 368 373 raise 369 374 … … 416 421 417 422 # Save 418 self.invertor.to_file("test_output.txt") 423 f_name = "test_output.txt" 424 self.invertor.to_file(f_name) 419 425 420 426 # Load 421 self.invertor.from_file( "test_output.txt")427 self.invertor.from_file(f_name) 422 428 self.assertEqual(self.invertor.d_max, 160.0) 423 429 self.assertEqual(self.invertor.alpha, 0.0007) 424 430 self.assertEqual(self.invertor.chi2, 836.797) 425 431 self.assertAlmostEqual(self.invertor.pr(self.invertor.out, 10.0), 903.31577041, 4) 432 if os.path.isfile(f_name): 433 os.remove(f_name) 426 434 427 435 def test_qmin(self):
Note: See TracChangeset
for help on using the changeset viewer.