Changeset 5e903e8b in sasview for test/pr_inversion


Ignore:
Timestamp:
May 2, 2017 8:07:40 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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.
Message:

Merge branch 'master' into log_binning

Location:
test/pr_inversion
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • test/pr_inversion/test/utest_invertor.py

    rac07a3a raaf5e49  
    66# Disable "too many methods" complaint  
    77# pylint: disable-msg=R0904  
    8  
    9  
    10 import unittest, math, numpy 
     8from __future__ import print_function 
     9 
     10 
     11import os 
     12import unittest 
     13import math 
     14import numpy 
    1115from sas.sascalc.pr.invertor import Invertor 
    12          
     16 
     17 
    1318class TestFiguresOfMerit(unittest.TestCase): 
    1419             
     
    235240            self.assertTrue(chi2/51.0<10.0) 
    236241        except: 
    237             print "chi2 =", chi2/51.0 
     242            print("chi2 =", chi2/51.0) 
    238243            raise 
    239244         
     
    263268            self.assertTrue(self.invertor.chi2/len(x)<200.00) 
    264269        except: 
    265             print "Chi2(I(q)) =", self.invertor.chi2/len(x) 
     270            print("Chi2(I(q)) =", self.invertor.chi2/len(x)) 
    266271            raise 
    267272         
     
    297302            self.assertTrue(chi2/51.0<50.0) 
    298303        except: 
    299             print "chi2(P(r)) =", chi2/51.0 
     304            print("chi2(P(r)) =", chi2/51.0) 
    300305            raise 
    301306         
     
    341346            self.assertTrue(self.invertor.chi2>0) 
    342347        except: 
    343             print "Chi2 =", self.invertor.chi2 
     348            print("Chi2 =", self.invertor.chi2) 
    344349            raise 
    345350                             
     
    365370            self.assertTrue(self.invertor.chi2>0) 
    366371        except: 
    367             print "Chi2 =", self.invertor.chi2 
     372            print("Chi2 =", self.invertor.chi2) 
    368373            raise 
    369374         
     
    416421         
    417422        # Save 
    418         self.invertor.to_file("test_output.txt") 
     423        f_name = "test_output.txt" 
     424        self.invertor.to_file(f_name) 
    419425     
    420426        # Load 
    421         self.invertor.from_file("test_output.txt") 
     427        self.invertor.from_file(f_name) 
    422428        self.assertEqual(self.invertor.d_max, 160.0) 
    423429        self.assertEqual(self.invertor.alpha, 0.0007) 
    424430        self.assertEqual(self.invertor.chi2, 836.797) 
    425431        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) 
    426434         
    427435    def test_qmin(self): 
Note: See TracChangeset for help on using the changeset viewer.