Changeset c00a797a in sasview for test/sasrealspace
- Timestamp:
- May 1, 2017 10:23:44 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:
- 658dd57, c551bb3, 0cc77d8
- Parents:
- b636dfc5 (diff), aaf5e49 (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. - git-author:
- Paul Kienzle <pkienzle@…> (05/01/17 10:23:44)
- git-committer:
- GitHub <noreply@…> (05/01/17 10:23:44)
- Location:
- test/sasrealspace/test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.