Changeset aaf5e49 in sasview
- Timestamp:
- May 1, 2017 12:42:59 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:
- 7b15990
- Parents:
- a1b8fee
- Location:
- test
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pr_inversion/test/utest_invertor.py
r17c9436 raaf5e49 6 6 # Disable "too many methods" complaint 7 7 # pylint: disable-msg=R0904 8 8 from __future__ import print_function 9 9 10 10 … … 240 240 self.assertTrue(chi2/51.0<10.0) 241 241 except: 242 print "chi2 =", chi2/51.0242 print("chi2 =", chi2/51.0) 243 243 raise 244 244 … … 268 268 self.assertTrue(self.invertor.chi2/len(x)<200.00) 269 269 except: 270 print "Chi2(I(q)) =", self.invertor.chi2/len(x)270 print("Chi2(I(q)) =", self.invertor.chi2/len(x)) 271 271 raise 272 272 … … 302 302 self.assertTrue(chi2/51.0<50.0) 303 303 except: 304 print "chi2(P(r)) =", chi2/51.0304 print("chi2(P(r)) =", chi2/51.0) 305 305 raise 306 306 … … 346 346 self.assertTrue(self.invertor.chi2>0) 347 347 except: 348 print "Chi2 =", self.invertor.chi2348 print("Chi2 =", self.invertor.chi2) 349 349 raise 350 350 … … 370 370 self.assertTrue(self.invertor.chi2>0) 371 371 except: 372 print "Chi2 =", self.invertor.chi2372 print("Chi2 =", self.invertor.chi2) 373 373 raise 374 374 -
test/run_one.py
raaad4c95 raaf5e49 1 1 #!/usr/bin/env python 2 from __future__ import print_function 2 3 3 4 import os … … 24 25 #print "\n".join(sys.path) 25 26 test_path,test_file = splitpath(abspath(sys.argv[1])) 26 print "=== testing:",sys.argv[1]27 print("=== testing:",sys.argv[1]) 27 28 #print test_path, test_file 28 29 sys.argv = [sys.argv[0]] -
test/sasdataloader/plugins/test_reader.py
r959eb01 raaf5e49 8 8 copyright 2008, University of Tennessee 9 9 """ 10 from __future__ import print_function 11 10 12 import os 11 13 import numpy as np … … 59 61 reader = Reader() 60 62 output = reader.read("../test/test_data.test") 61 print output.x63 print(output.x) 62 64 63 65 -
test/sasdataloader/test/sequence_tests.py
r959eb01 raaf5e49 1 from __future__ import print_function 2 1 3 from DataLoader.loader import Loader 2 4 from DataLoader.readers.IgorReader import Reader as igor_reader … … 8 10 out2 = Loader().load("MAR07232_rest.ASC") 9 11 if len(out2.detector)>1: 10 print "Consecutive reads using Loader failed"12 print("Consecutive reads using Loader failed") 11 13 12 14 def consecutive_reader(): … … 14 16 out2 = igor_reader().read("MAR07232_rest.ASC") 15 17 if len(out2.detector)>1: 16 print "Consecutive reads using Readers failed"17 print out118 print out218 print("Consecutive reads using Readers failed") 19 print(out1) 20 print(out2) 19 21 20 22 def single_abs(): … … 29 31 single_igor() 30 32 single_abs() 31 print "Test passed"33 print("Test passed") -
test/sasdataloader/test/utest_abs_reader.py
r17c9436 raaf5e49 2 2 Unit tests for data manipulations 3 3 """ 4 from __future__ import print_function 4 5 5 6 import unittest … … 309 310 self.assertTrue(item.date in ['04-Sep-2007 18:35:02', 310 311 '03-SEP-2006 11:42:47']) 311 print item.term312 print(item.term) 312 313 for t in item.term: 313 314 if t['name']=="ABS:DSTAND" \ … … 368 369 369 370 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 370 print self.data.errors371 print(self.data.errors) 371 372 self.assertEqual(len(self.data.errors), 1) 372 373 -
test/sasrealspace/test/early_test.py
r959eb01 raaf5e49 1 from __future__ import print_function 1 2 2 3 import VolumeCanvas … … 30 31 t_0 = time.time() 31 32 value_1 = 1.0e8*canvas.getIq(0.1) 32 print "density = 0.1: output=%g time=%g" % (value_1, time.time()-t_0)33 print("density = 0.1: output=%g time=%g" % (value_1, time.time()-t_0)) 33 34 34 35 t_0 = time.time() 35 36 canvas.setParam('lores_density', 1) 36 37 value_1 = 1.0e8*canvas.getIq(0.1) 37 print "density = 1000: output=%g time=%g" % (value_1, time.time()-t_0)38 print("density = 1000: output=%g time=%g" % (value_1, time.time()-t_0)) 38 39 39 40 t_0 = time.time() 40 41 canvas.setParam('lores_density', 0.01) 41 42 value_1 = 1.0e8*canvas.getIq(0.1) 42 print "density = 0.00001: output=%g time=%g" % (value_1, time.time()-t_0)43 print 43 print("density = 0.00001: output=%g time=%g" % (value_1, time.time()-t_0)) 44 print() 44 45 45 46 … … 63 64 #ana_1 = form_factor(q, radius) 64 65 65 print "q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1)66 print("q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1)) 66 67 67 68 def test_2(): … … 73 74 shell_vol = 4.0/3.0*math.pi*outer_radius*outer_radius*outer_radius - core_vol 74 75 shell_sld = -1.0*core_vol/shell_vol 75 print "Shell SLD", shell_sld76 print("Shell SLD", shell_sld) 76 77 77 78 … … 126 127 ana_1 = sphere.run(q) 127 128 128 print "q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1)129 print("q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1)) 129 130 out.write( "%g %g %g\n" % (q, sim_1, ana_1)) 130 131 … … 168 169 #ana_1 = form_factor(q, radius) 169 170 170 print "q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1)171 print("q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1)) 171 172 172 173 def test_5(): … … 193 194 ana = ana.runXY([0.1, 0.1]) 194 195 sim = model.getIq2D(0.1, 0.1) 195 print ana, sim, sim/ana, ana/sim196 print(ana, sim, sim/ana, ana/sim) 196 197 197 198 def test_6(): … … 232 233 233 234 234 print model.npts235 print(model.npts) 235 236 for i in range(40): 236 237 qmax = 0.5 … … 240 241 anaY = ana.runXY([0, qmax*i/40.0]) 241 242 simY = model.getIq2D(0, qmax*i/40.0) 242 print anaX, simX, simX/anaX, '|', anaY, simY, simY/anaY243 print(anaX, simX, simX/anaX, '|', anaY, simY, simY/anaY) 243 244 244 245 def test_7(): 245 246 from sas.models.CoreShellModel import CoreShellModel 246 print "Testing core-shell"247 print("Testing core-shell") 247 248 radius = 15 248 249 thickness = 5 … … 287 288 ana_val = ana.runXY([q, 0.2]) 288 289 sim_val, err = canvas.getIq2DError(q, 0.2) 289 print ana_val, sim_val, sim_val/ana_val, err, (sim_val-ana_val)/err290 print(ana_val, sim_val, sim_val/ana_val, err, (sim_val-ana_val)/err) 290 291 291 292 -
test/sasrealspace/test/sim_validation.py
rac07a3a raaf5e49 5 5 @license: This software is provided as part of the DANSE project 6 6 """ 7 from __future__ import print_function 8 7 9 import math, time, pylab 8 10 9 11 try: 10 12 import VolumeCanvas 11 print "Testing local version"13 print("Testing local version") 12 14 except: 13 print "Testing installed version"15 print("Testing installed version") 14 16 import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas 15 17 … … 250 252 ana = validator.run_ana(q) 251 253 sim, err = validator.run_sim(q) 252 print 253 (sim-ana), sim/ana, str(math.fabs(sim-ana)>err)) 254 print("q=%-g ana=%-g sim=%-g err=%-g diff=%-g (%-g) %s" % (q, ana, sim, err, 255 (sim-ana), sim/ana, str(math.fabs(sim-ana)>err))) 254 256 output.write("%g %g %g %g\n" % (q, ana, sim, err)) 255 257 output.close() … … 278 280 ana = validator.run_ana2D(q*math.cos(phi), q*math.sin(phi)) 279 281 sim, err = validator.run_sim2D(q*math.cos(phi), q*math.sin(phi)) 280 print 281 (sim-ana), sim/ana, str(math.fabs(sim-ana)>err)) 282 print("q=%-g ana=%-g sim=%-g err=%-g diff=%-g (%-g) %s" % (q, ana, sim, err, 283 (sim-ana), sim/ana, str(math.fabs(sim-ana)>err))) 282 284 output.write("%g %g %g %g\n" % (q, ana, sim, err)) 283 print "Time elapsed: ", time.time()-t_0285 print("Time elapsed: ", time.time()-t_0) 284 286 output.close() 285 287 … … 306 308 for d in d_list: 307 309 sim, err = validator.run_sim(q, density=d) 308 print 310 print("d=%-g ana=%-g sim=%-g err=%-g diff=%-g (%g) %s" % \ 309 311 (d, ana, sim, err, (sim-ana), (sim-ana)/ana, 310 str(math.fabs(sim-ana)>err)) 312 str(math.fabs(sim-ana)>err))) 311 313 output.write("%g %g %g %g \n" % (d, ana, sim, err)) 312 314 output.close() -
test/sasrealspace/test/utest_oriented.py
r959eb01 raaf5e49 3 3 @copyright: University of Tennessee, for the DANSE project 4 4 """ 5 from __future__ import print_function 5 6 6 7 import unittest, math, sys … … 16 17 try: 17 18 import VolumeCanvas 18 print "Testing local version"19 print("Testing local version") 19 20 except: 20 print sys.exc_value21 print(sys.exc_value) 21 22 #testing the version that is working on 22 print "Testing installed version"23 print("Testing installed version") 23 24 import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas 24 25 … … 241 242 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 242 243 except: 243 print "Error", ana_val, sim_val, sim_val/ana_val244 print("Error", ana_val, sim_val, sim_val/ana_val) 244 245 raise sys.exc_type, sys.exc_value 245 246 … … 395 396 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 396 397 except: 397 print "Error", ana_val, sim_val, sim_val/ana_val398 print("Error", ana_val, sim_val, sim_val/ana_val) 398 399 raise sys.exc_type, sys.exc_value 399 400 … … 407 408 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 408 409 except: 409 print "Error", ana_val, sim_val, sim_val/ana_val410 print("Error", ana_val, sim_val, sim_val/ana_val) 410 411 raise sys.exc_type, sys.exc_value 411 412 … … 419 420 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 420 421 except: 421 print "Error", ana_val, sim_val, sim_val/ana_val422 print("Error", ana_val, sim_val, sim_val/ana_val) 422 423 raise sys.exc_type, sys.exc_value 423 424 … … 431 432 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 432 433 except: 433 print "Error", ana_val, sim_val, sim_val/ana_val434 print("Error", ana_val, sim_val, sim_val/ana_val) 434 435 raise sys.exc_type, sys.exc_value 435 436 -
test/sasrealspace/test/utest_realspace.py
r45dffa69 raaf5e49 3 3 @author: Mathieu Doucet / UTK 4 4 """ 5 from __future__ import print_function 5 6 6 7 import unittest, math, time … … 15 16 try: 16 17 import VolumeCanvas 17 print "Testing local version"18 print("Testing local version") 18 19 except: 19 20 import sys 20 print sys.exc_value21 print(sys.exc_value) 21 22 #testing the version that is working on 22 print "Testing installed version"23 print("Testing installed version") 23 24 import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas 24 25 -
test/utest_sasview.py
r959eb01 raaf5e49 1 1 #!/usr/bin/env python 2 from __future__ import print_function 3 2 4 import os 3 5 import subprocess … … 80 82 if has_failed: 81 83 failed += 1 82 print "Result for %s (%s): FAILED" % (module_name, module_dir)83 print std_out84 print("Result for %s (%s): FAILED" % (module_name, module_dir)) 85 print(std_out) 84 86 else: 85 87 passed += 1 86 print "Result for %s: SUCCESS" % module_name88 print("Result for %s: SUCCESS" % module_name) 87 89 88 print "\n----------------------------------------------"90 print("\n----------------------------------------------") 89 91 if n_tests == 0: 90 print "No tests."92 print("No tests.") 91 93 else: 92 print "Results by test modules:"93 print " PASSED: %d" % passed94 print("Results by test modules:") 95 print(" PASSED: %d" % passed) 94 96 ratio = 100.0*failed/(failed+passed) 95 print " FAILED: %d (%.0f%%)" % (failed,ratio)97 print(" FAILED: %d (%.0f%%)" % (failed,ratio)) 96 98 97 print "Results by tests:"98 print " Tests run: %d" % n_tests99 print " Tests failed: %d" % n_failures100 print " Test errors: %d" % n_errors101 print "----------------------------------------------"99 print("Results by tests:") 100 print(" Tests run: %d" % n_tests) 101 print(" Tests failed: %d" % n_failures) 102 print(" Test errors: %d" % n_errors) 103 print("----------------------------------------------") 102 104 103 105 return failed
Note: See TracChangeset
for help on using the changeset viewer.