Changes in / [c44bb26a:fc6651c] in sasview
- Files:
-
- 2 added
- 3 deleted
- 66 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/installer_generator.py
r959eb01 ra1b8fee 4 4 exists in the current directory. Edit local_config.py according to your needs. 5 5 """ 6 from __future__ import print_function 7 6 8 import local_config 7 9 import os 8 10 import string 11 9 12 10 13 REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" … … 364 367 f.write(TEMPLATE) 365 368 f.close() 366 print "Generate Inno setup installer script complete"367 print "A new file %s.iss should be created.Please refresh your directory" % str(INSTALLER_FILE)369 print("Generate Inno setup installer script complete") 370 print("A new file %s.iss should be created.Please refresh your directory" % str(INSTALLER_FILE)) 368 371 369 372 if __name__ == "__main__": -
sasview/local_config.py
rea45bfe ra1b8fee 2 2 Application settings 3 3 """ 4 from __future__ import print_function 5 4 6 import time 5 7 import os … … 150 152 :TODO - Need method doc string 151 153 """ 152 print "%g: %s" % (time.clock(), message)154 print("%g: %s" % (time.clock(), message)) 153 155 154 156 if __EVT_DEBUG_2_FILE__: -
sasview/setup_exe.py
rf36e01f ra1b8fee 13 13 # be added to the distribution directory for that purpose. 14 14 # See for example the 'images' directory below. 15 from __future__ import print_function 15 16 16 17 import os … … 62 63 sys.argv.remove('--extrapath') 63 64 except: 64 print("Error processing extra python path needed to build SasView\n %s" % \65 65 print("Error processing extra python path needed to build SasView\n %s" % 66 sys.exc_value) 66 67 67 68 -
sasview/setup_mac.py
rcfa88ee ra1b8fee 11 11 12/05/2011: Needs macholib >= 1.4.3 and py2app >= 0.6.4 to create a 64-bit app 12 12 """ 13 from __future__ import print_function 14 13 15 from setuptools import setup 14 16 import periodictable.xsf … … 28 30 build_path = os.path.join(root, 'build','lib.'+platform) 29 31 sys.path.insert(0, build_path) 30 print "BUILDING PATH INSIDE", build_path32 print("BUILDING PATH INSIDE", build_path) 31 33 ICON = local_config.SetupIconFile_mac 32 34 EXTENSIONS_LIST = [] … … 70 72 # See if the documentation has been built, and if so include it. 71 73 doc_path = os.path.join(build_path, "doc") 72 print doc_path74 print(doc_path) 73 75 if os.path.exists(doc_path): 74 76 for dirpath, dirnames, filenames in os.walk(doc_path): -
sasview/wxcruft.py
r12e5cc8 ra1b8fee 1 from __future__ import print_function 2 1 3 import inspect 2 4 import wx … … 29 31 else: 30 32 tag = "" 31 print "NewId %d from %s(%d):%s%s"%(id, path, line, function, tag)33 print("NewId %d from %s(%d):%s%s"%(id, path, line, function, tag)) 32 34 return id 33 35 -
src/examples/data_generator/testdata_generator.py
r959eb01 ra1b8fee 1 from __future__ import print_function 2 1 3 """ 2 4 Generate two correlated sets of data … … 42 44 # Write line data set 43 45 fd = open(filename, 'w') 44 print "Creating ", filename46 print("Creating ", filename) 45 47 fd.write("#y=A*x+B\n#A=%g\n#B=%g\n" % (self.constant_a, self.constant_b)) 46 48 -
src/sas/sascalc/calculator/sas_gen.py
r7432acb ra1b8fee 3 3 SAS generic computation and sld file readers 4 4 """ 5 from __future__ import print_function 6 5 7 import sas.sascalc.calculator.core.sld2i as mod 6 8 from sas.sascalc.calculator.BaseComponent import BaseComponent … … 558 560 vol_pix = np.append(vol_pix, vol) 559 561 except: 560 print "Error: set the sld of %s to zero"% atom_name562 print("Error: set the sld of %s to zero"% atom_name) 561 563 sld_n = np.append(sld_n, 0.0) 562 564 sld_mx = np.append(sld_mx, 0) … … 609 611 Write 610 612 """ 611 print "Not implemented... "613 print("Not implemented... ") 612 614 613 615 class SLDReader(object): … … 1044 1046 from mpl_toolkits.mplot3d import Axes3D 1045 1047 current_dir = os.path.abspath(os.path.curdir) 1046 print current_dir1048 print(current_dir) 1047 1049 for i in range(6): 1048 1050 current_dir, _ = os.path.split(current_dir) -
src/sas/sascalc/data_util/calcthread.py
r7432acb ra1b8fee 4 4 # \brief Abstract class for defining calculation threads. 5 5 # 6 from __future__ import print_function 6 7 7 8 import thread … … 295 296 """ 296 297 def __init__(self, n=20000): 297 print thread.get_ident()298 print(thread.get_ident()) 298 299 self.starttime = clock() 299 300 self.done = False … … 307 308 self.work2.queue(n) 308 309 self.work3.queue(n) 309 print "Expect updates from Main every second and from thread every 2.5 seconds"310 print ""310 print("Expect updates from Main every second and from thread every 2.5 seconds") 311 print("") 311 312 self.work.ready(.5) 312 313 while not self.done: 313 314 sleep(1) 314 print 315 clock() - self.starttime) 315 print("Main thread %d at %.2f" % (thread.get_ident(), 316 clock() - self.starttime)) 316 317 317 318 def update(self, i=0): 318 print 319 clock() - self.starttime) 319 print("Update i=%d from thread %d at %.2f" % (i, thread.get_ident(), 320 clock() - self.starttime)) 320 321 self.work.ready(2.5) 321 322 322 323 def complete(self, total=0.0): 323 print 324 print("Complete total=%g from thread %d at %.2f" % (total, 324 325 thread.get_ident(), 325 clock() - self.starttime) 326 clock() - self.starttime)) 326 327 self.done = True -
src/sas/sascalc/data_util/formatnum.py
r9a5097c ra1b8fee 37 37 formatter.compact flag. 38 38 """ 39 from __future__ import division 39 from __future__ import division, print_function 40 40 41 41 import math -
src/sas/sascalc/data_util/registry.py
rb699768 ra1b8fee 6 6 and registers the built-in file extensions. 7 7 """ 8 from __future__ import print_function 8 9 9 10 import os.path -
src/sas/sascalc/dataloader/data_info.py
r7432acb ra1b8fee 16 16 ###################################################################### 17 17 18 from __future__ import print_function 18 19 19 20 #TODO: Keep track of data manipulation in the 'process' data structure. -
src/sas/sascalc/dataloader/readers/IgorReader.py
r959eb01 ra1b8fee 12 12 #copyright 2008, University of Tennessee 13 13 ############################################################################# 14 from __future__ import print_function 15 14 16 import os 15 17 -
src/sas/sascalc/dataloader/readers/associations.py
r959eb01 ra1b8fee 14 14 #copyright 2009, University of Tennessee 15 15 ############################################################################# 16 from __future__ import print_function 17 16 18 import os 17 19 import sys … … 71 73 logger.error(msg) 72 74 else: 73 print "Could not find reader association settings\n %s [%s]" % (__file__, os.getcwd())75 print("Could not find reader association settings\n %s [%s]" % (__file__, os.getcwd())) 74 76 75 77 -
src/sas/sascalc/dataloader/readers/red2d_reader.py
r959eb01 ra1b8fee 9 9 #copyright 2008, University of Tennessee 10 10 ###################################################################### 11 from __future__ import print_function 12 11 13 import os 12 14 import numpy as np … … 82 84 detector = Detector() 83 85 if len(output.detector) > 0: 84 print str(output.detector[0])86 print(str(output.detector[0])) 85 87 output.detector.append(detector) 86 88 -
src/sas/sascalc/fit/AbstractFitEngine.py
r7432acb ra1b8fee 1 from __future__ import print_function 1 2 2 3 import copy … … 627 628 """ 628 629 """ 629 print str(self)630 print(str(self)) -
src/sas/sascalc/fit/Loader.py
rac07a3a ra1b8fee 1 from __future__ import print_function 2 1 3 # class Loader to load any king of file 2 4 #import wx … … 54 56 self.dx = np.zeros(len(self.x)) 55 57 except: 56 print "READ ERROR", line58 print("READ ERROR", line) 57 59 # Sanity check 58 60 if not len(self.x) == len(self.dx): … … 80 82 load = Load() 81 83 load.set_filename("testdata_line.txt") 82 print load.get_filename()84 print(load.get_filename()) 83 85 load.set_values() 84 print load.get_values()86 print(load.get_values()) 85 87 86 88 -
src/sas/sascalc/fit/expression.py
r9a5097c ra1b8fee 43 43 Ideally, this interface will change 44 44 """ 45 from __future__ import print_function 46 45 47 import math 46 48 import re -
src/sas/sascalc/pr/fit/AbstractFitEngine.py
r7432acb ra1b8fee 1 from __future__ import print_function 1 2 2 3 import copy … … 630 631 """ 631 632 """ 632 print str(self)633 print(str(self)) -
src/sas/sascalc/pr/fit/Loader.py
rac07a3a ra1b8fee 1 from __future__ import print_function 2 1 3 # class Loader to load any king of file 2 4 #import wx … … 54 56 self.dx = np.zeros(len(self.x)) 55 57 except: 56 print "READ ERROR", line58 print("READ ERROR", line) 57 59 # Sanity check 58 60 if not len(self.x) == len(self.dx): … … 80 82 load = Load() 81 83 load.set_filename("testdata_line.txt") 82 print load.get_filename()84 print(load.get_filename()) 83 85 load.set_values() 84 print load.get_values()86 print(load.get_values()) 85 87 86 88 -
src/sas/sascalc/pr/fit/expression.py
r9a5097c ra1b8fee 1 from __future__ import print_function 2 1 3 # This program is public domain 2 4 """ -
src/sas/sascalc/pr/num_term.py
r7432acb ra1b8fee 1 from __future__ import print_function 2 1 3 import math 2 4 import numpy as np … … 197 199 # Testing estimator 198 200 est = NTermEstimator(invert) 199 print est.num_terms()201 print(est.num_terms()) -
src/sas/sascalc/simulation/analmodelpy/tests/signon.py
rd85c194 r9c3d784 17 17 from analmodelpy import analmodelpy as analmodelpymodule 18 18 19 print "copyright information:"20 print " ", analmodelpy.copyright()21 print " ", analmodelpymodule.copyright()19 print("copyright information:") 20 print(" ", analmodelpy.copyright()) 21 print(" ", analmodelpymodule.copyright()) 22 22 23 print 24 print "module information:"25 print " file:", analmodelpymodule.__file__26 print " doc:", analmodelpymodule.__doc__27 print " contents:", dir(analmodelpymodule)23 print() 24 print("module information:") 25 print(" file:", analmodelpymodule.__file__) 26 print(" doc:", analmodelpymodule.__doc__) 27 print(" contents:", dir(analmodelpymodule)) 28 28 29 print 30 print analmodelpymodule.hello()29 print() 30 print(analmodelpymodule.hello()) 31 31 32 32 # version -
src/sas/sascalc/simulation/analmodelpy/tests/testanal_model.py
rd85c194 ra1b8fee 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function 14 13 15 14 16 if __name__ == "__main__": … … 18 20 from SASsimulation import geoshapespy 19 21 20 print "copyright information:"21 print " ", analmodelpymodule.copyright()22 print("copyright information:") 23 print(" ", analmodelpymodule.copyright()) 22 24 23 print 24 print "module information:"25 print " file:", analmodelpymodule.__file__26 print " doc:", analmodelpymodule.__doc__27 print " contents:", dir(analmodelpymodule)25 print() 26 print("module information:") 27 print(" file:", analmodelpymodule.__file__) 28 print(" doc:", analmodelpymodule.__doc__) 29 print(" contents:", dir(analmodelpymodule)) 28 30 29 31 a = geoshapespy.new_sphere(1.0) -
src/sas/sascalc/simulation/geoshapespy/tests/testshapes.py
rd85c194 ra1b8fee 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function 14 13 15 14 16 if __name__ == "__main__": … … 16 18 from SASsimulation import geoshapespy 17 19 18 print 19 print "module information:"20 print " file:", geoshapespy.__file__21 print " doc:", geoshapespy.__doc__22 print " contents:", dir(geoshapespy)20 print() 21 print("module information:") 22 print(" file:", geoshapespy.__file__) 23 print(" doc:", geoshapespy.__doc__) 24 print(" contents:", dir(geoshapespy)) 23 25 24 26 sp = geoshapespy.new_sphere(10) -
src/sas/sascalc/simulation/iqPy/tests/signon.py
rd85c194 ra1b8fee 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function 14 13 15 14 16 if __name__ == "__main__": … … 17 19 from iqPy import iqPy as iqPymodule 18 20 19 print "copyright information:"20 print " ", iqPy.copyright()21 print " ", iqPymodule.copyright()21 print("copyright information:") 22 print(" ", iqPy.copyright()) 23 print(" ", iqPymodule.copyright()) 22 24 23 print 24 print "module information:"25 print " file:", iqPymodule.__file__26 print " doc:", iqPymodule.__doc__27 print " contents:", dir(iqPymodule)25 print() 26 print("module information:") 27 print(" file:", iqPymodule.__file__) 28 print(" doc:", iqPymodule.__doc__) 29 print(" contents:", dir(iqPymodule)) 28 30 29 print 31 print() 30 32 31 33 # version -
src/sas/sascalc/simulation/iqPy/tests/testiq.py
rd85c194 r9c3d784 17 17 iqPy.new_iq(10,0.01,0.4) 18 18 19 print "pass."19 print("pass.") 20 20 21 21 # version -
src/sas/sascalc/simulation/pointsmodelpy/tests/signon.py
rd85c194 ra1b8fee 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function 14 13 15 14 16 if __name__ == "__main__": … … 17 19 from pointsmodelpy import pointsmodelpy as pointsmodelpymodule 18 20 19 print "copyright information:"20 print " ", pointsmodelpy.copyright()21 print " ", pointsmodelpymodule.copyright()21 print("copyright information:") 22 print(" ", pointsmodelpy.copyright()) 23 print(" ", pointsmodelpymodule.copyright()) 22 24 23 print 24 print "module information:"25 print " file:", pointsmodelpymodule.__file__26 print " doc:", pointsmodelpymodule.__doc__27 print " contents:", dir(pointsmodelpymodule)25 print() 26 print("module information:") 27 print(" file:", pointsmodelpymodule.__file__) 28 print(" doc:", pointsmodelpymodule.__doc__) 29 print(" contents:", dir(pointsmodelpymodule)) 28 30 29 print 30 print pointsmodelpymodule.hello()31 print() 32 print(pointsmodelpymodule.hello()) 31 33 32 34 # version -
src/sas/sascalc/simulation/pointsmodelpy/tests/test2dui.py
r959eb01 ra1b8fee 7 7 # Imports: 8 8 #-------------------------------------------------------------------------------- 9 from __future__ import print_function 9 10 10 11 import wx … … 46 47 47 48 data = ImageData(value_grid, index_vals) 48 print value_grid, index_vals49 print(value_grid, index_vals) 49 50 50 51 # Create the index axes -
src/sas/sascalc/simulation/pointsmodelpy/tests/testcomplexmodel.py
r959eb01 ra1b8fee 1 from __future__ import print_function 2 1 3 from sasModeling.pointsmodelpy import pointsmodelpy 2 4 from sasModeling.iqPy import iqPy 3 5 from sasModeling.geoshapespy import geoshapespy 6 4 7 5 8 #First testing: a normal case, a lores model holds a sphere … … 61 64 iqPy.OutputIQ(iqcomplex,"testcomplex2.iq") 62 65 63 print "p(r) is saved in testcomplex2.pr"64 print "I(Q) is saved in testcomplex2.iq"65 print "pass"66 print("p(r) is saved in testcomplex2.pr") 67 print("I(Q) is saved in testcomplex2.iq") 68 print("pass") 66 69 67 70 #testing 3, insert one empty pdbmodel and one loresmodel … … 88 91 iqPy.OutputIQ(iqcomplex,"testcomplex3.iq") 89 92 90 print "p(r) is saved in testcomplex3.pr"91 print "I(Q) is saved in testcomplex3.iq"92 print "pass"93 print("p(r) is saved in testcomplex3.pr") 94 print("I(Q) is saved in testcomplex3.iq") 95 print("pass") 93 96 94 97 # Test 2D complex model … … 106 109 pointsmodelpy.get_complexpoints(complex,vpcomplex); 107 110 108 print pointsmodelpy.get_complex_iq_2D(complex,vpcomplex,0.1,0.1);109 print pointsmodelpy.get_complex_iq_2D(complex,vpcomplex,0.01,0.1);111 print(pointsmodelpy.get_complex_iq_2D(complex,vpcomplex,0.1,0.1)); 112 print(pointsmodelpy.get_complex_iq_2D(complex,vpcomplex,0.01,0.1)); 110 113 111 114 -
src/sas/sascalc/simulation/pointsmodelpy/tests/testlores.py
r959eb01 ra1b8fee 1 from __future__ import print_function 2 3 1 4 if __name__ == "__main__": 2 5 … … 10 13 # print " ", pointsmodelpymodule.copyright() 11 14 12 print 13 print "module information:"14 print " file:", pointsmodelpy.__file__15 print " doc:", pointsmodelpy.__doc__16 print " contents:", dir(pointsmodelpy)17 print " contents:", dir(geoshapespy)15 print() 16 print("module information:") 17 print(" file:", pointsmodelpy.__file__) 18 print(" doc:", pointsmodelpy.__doc__) 19 print(" contents:", dir(pointsmodelpy)) 20 print(" contents:", dir(geoshapespy)) 18 21 19 22 # a = geoshapespy.new_singlehelix(10,2,30,2) … … 46 49 pointsmodelpy.outputPDB(lm,vp,"modelpy.pseudo.pdb") 47 50 48 print "calculating distance distribution"51 print("calculating distance distribution") 49 52 rmax = pointsmodelpy.get_lores_pr(lm,vp) 50 print "finish calculating get_lores_pr, and rmax is:", rmax53 print("finish calculating get_lores_pr, and rmax is:", rmax) 51 54 pointsmodelpy.outputPR(lm,"testlores.pr") 52 55 pointsmodelpy.get_lores_iq(lm,iq) … … 54 57 iqPy.OutputIQ(iq, "testlores.iq") 55 58 56 print "Testing get I from a single q"59 print("Testing get I from a single q") 57 60 result = pointsmodelpy.get_lores_i(lm,0.1) 58 print "The I(0.1) is: %s" % str(result)61 print("The I(0.1) is: %s" % str(result)) 59 62 60 63 # version -
src/sas/sascalc/simulation/pointsmodelpy/tests/testlores2d.py
r959eb01 ra1b8fee 1 from __future__ import print_function 2 3 1 4 def test_lores2d(phi): 2 5 from sasModeling.pointsmodelpy import pointsmodelpy … … 45 48 value_grid = zeros((100,100),Float) 46 49 width, height = value_grid.shape 47 print width,height50 print(width,height) 48 51 49 52 I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002) 50 print I53 print(I) 51 54 52 55 Imax = 0 … … 86 89 value_grid = zeros((100,100),Float) 87 90 width, height = value_grid.shape 88 print width,height91 print(width,height) 89 92 90 93 I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002) 91 print I94 print(I) 92 95 93 96 Imax = 0 … … 109 112 if __name__ == "__main__": 110 113 111 print "start to test lores 2D"114 print("start to test lores 2D") 112 115 # test_lores2d(10) 113 116 value_grid = get2d_2() 114 print value_grid115 print "pass"117 print(value_grid) 118 print("pass") -
src/sas/sasgui/guiframe/config.py
rea45bfe ra1b8fee 2 2 Application settings 3 3 """ 4 from __future__ import print_function 5 4 6 import time 5 7 import os … … 150 152 :TODO - Need method doc string 151 153 """ 152 print "%g: %s" % (time.clock(), message)154 print("%g: %s" % (time.clock(), message)) 153 155 154 156 if __EVT_DEBUG_2_FILE__: -
src/sas/sasgui/guiframe/data_panel.py
r959eb01 ra1b8fee 11 11 This module provides Graphic interface for the data_manager module. 12 12 """ 13 from __future__ import print_function 14 13 15 import wx 14 16 from wx.build import build_options … … 514 516 self.parent.save_data2d(data, default_name) 515 517 else: 516 print "unable to save this type of data"518 print("unable to save this type of data") 517 519 518 520 def layout_data_list(self): … … 1497 1499 except: 1498 1500 # raise 1499 print "error", sys.exc_value1501 print("error", sys.exc_value) 1500 1502 1501 1503 app.MainLoop() -
src/sas/sasgui/guiframe/data_processor.py
r7432acb ra1b8fee 18 18 19 19 """ 20 from __future__ import print_function 21 20 22 import os 21 23 import sys … … 2035 2037 frame.Show(True) 2036 2038 except: 2037 print sys.exc_value2039 print(sys.exc_value) 2038 2040 2039 2041 app.MainLoop() -
src/sas/sasgui/guiframe/dummyapp.py
r959eb01 ra1b8fee 3 3 Allows the user to set an external data manager 4 4 """ 5 from __future__ import print_function 6 5 7 import sas.sasgui.guiframe.gui_manager as gui_manager 6 8 … … 32 34 plug_menu.Append(id, '&Do something') 33 35 def _on_do_something(event): 34 print "Do something"36 print("Do something") 35 37 wx.EVT_MENU(self.parent, id, _on_do_something) 36 38 -
src/sas/sasgui/guiframe/gui_manager.py
r38beeab r2f22db9 2129 2129 if "SAS_OPENCL" in line: 2130 2130 if sas_opencl: 2131 new_config_lines.append("SAS_OPENCL = \""+sas_opencl+"\"") 2131 new_config_lines.append("SAS_OPENCL = \"" + sas_opencl 2132 + "\"\n") 2132 2133 else: 2133 new_config_lines.append("SAS_OPENCL = None")2134 new_config_lines.append("SAS_OPENCL = \"None\"\n") 2134 2135 else: 2135 2136 new_config_lines.append(line) -
src/sas/sasgui/guiframe/gui_style.py
r959eb01 ra1b8fee 3 3 Provide the style for guiframe 4 4 """ 5 from __future__ import print_function 6 5 7 import wx 6 8 import os … … 79 81 if __name__ == "__main__": 80 82 81 print GUIFRAME.DEFAULT_STYLE82 print GUIFRAME.FLOATING_PANEL83 print GUIFRAME.SINGLE_APPLICATION83 print(GUIFRAME.DEFAULT_STYLE) 84 print(GUIFRAME.FLOATING_PANEL) 85 print(GUIFRAME.SINGLE_APPLICATION) 84 86 style = GUIFRAME.MULTIPLE_APPLICATIONS 85 87 style &= GUIFRAME.PLOTTING_ON 86 print style == GUIFRAME.PLOTTING_ON88 print(style == GUIFRAME.PLOTTING_ON) 87 89 style1 = GUIFRAME.MULTIPLE_APPLICATIONS 88 90 style1 &= (~GUIFRAME.MANAGER_ON) 89 print style1 == GUIFRAME.DEFAULT_STYLE90 print style191 print(style1 == GUIFRAME.DEFAULT_STYLE) 92 print(style1) -
src/sas/sasgui/guiframe/proxy.py
r463e7ffc ra1b8fee 1 1 #!/usr/bin/env python 2 2 # -*- coding: utf-8 -*- 3 from __future__ import print_function 4 3 5 import urllib2 4 6 import sys … … 157 159 response = c.connect() 158 160 if response is not None: 159 print 50 * '-'161 print(50 * '-') 160 162 content = json.loads(response.read().strip()) 161 163 pprint(content) -
src/sas/sasgui/perspectives/calculator/detector_editor.py
r959eb01 ra1b8fee 1 from __future__ import print_function 1 2 2 3 import wx … … 34 35 self.set_values() 35 36 except: 36 print "error", sys.exc_value37 print("error", sys.exc_value) 37 38 38 39 def _define_structure(self): -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r7432acb ra1b8fee 3 3 This module relies on guiframe manager. 4 4 """ 5 from __future__ import print_function 5 6 6 7 import wx … … 1998 1999 self.panel.set_volume_ctl_val(str(val)) 1999 2000 except: 2000 print "self.panel is not initialized yet"2001 print("self.panel is not initialized yet") 2001 2002 2002 2003 def set_omfpanel_default_shap(self, shape): -
src/sas/sasgui/perspectives/calculator/image_viewer.py
r7432acb ra1b8fee 1 from __future__ import print_function 2 1 3 import os 2 4 import sys … … 78 80 wx.PostEvent(parent, StatusEvent(status=err_msg, info="error")) 79 81 else: 80 print err_msg82 print(err_msg) 81 83 82 84 def choose_data_file(self, location=None): … … 301 303 info="error")) 302 304 else: 303 print err_msg305 print(err_msg) 304 306 return flag 305 307 … … 332 334 info="error")) 333 335 else: 334 print err_msg336 print(err_msg) 335 337 return flag 336 338 … … 361 363 info="error")) 362 364 else: 363 print err_msg365 print(err_msg) 364 366 365 367 self.OnClose(event) -
src/sas/sasgui/perspectives/calculator/model_editor.py
r7432acb ra1b8fee 23 23 #copyright 2009, University of Tennessee 24 24 ################################################################################ 25 from __future__ import print_function 26 25 27 import wx 26 28 import sys … … 871 873 # Put the cursor at appropriate position 872 874 length = len(label) 873 print length875 print(length) 874 876 if label[length-1] == ')': 875 877 length -= 1 -
src/sas/sasgui/perspectives/fitting/basepage.py
r463e7ffc ra1b8fee 2 2 Base Page for fitting 3 3 """ 4 from __future__ import print_function 5 4 6 import sys 5 7 import os … … 657 659 # It seems MAC needs wxCallAfter 658 660 if event.GetId() == GUIFRAME_ID.COPYEX_ID: 659 print "copy excel"661 print("copy excel") 660 662 wx.CallAfter(self.get_copy_excel) 661 663 elif event.GetId() == GUIFRAME_ID.COPYLAT_ID: 662 print "copy latex"664 print("copy latex") 663 665 wx.CallAfter(self.get_copy_latex) 664 666 else: … … 3368 3370 except Exception: 3369 3371 logger.error(traceback.format_exc()) 3370 print 3371 sys.exc_info()[1] 3372 print("Error in BasePage._paste_poly_help: %s" % \ 3373 sys.exc_info()[1]) 3372 3374 3373 3375 def _set_disp_cb(self, isarray, item): … … 3398 3400 Moveit; This method doesn't belong here 3399 3401 """ 3400 print "BasicPage.update_pinhole_smear was called: skipping"3402 print("BasicPage.update_pinhole_smear was called: skipping") 3401 3403 return 3402 3404 … … 3574 3576 # check model type to show sizer 3575 3577 if self.model is not None: 3576 print "_set_model_sizer_selection: disabled."3578 print("_set_model_sizer_selection: disabled.") 3577 3579 # self._set_model_sizer_selection(self.model) 3578 3580 -
src/sas/sasgui/perspectives/fitting/fitting.py
r426df2e ra1b8fee 11 11 #copyright 2009, University of Tennessee 12 12 ################################################################################ 13 from __future__ import print_function 14 13 15 import re 14 16 import sys … … 1253 1255 """ 1254 1256 """ 1255 print "update_fit result", result1257 print("update_fit result", result) 1256 1258 1257 1259 def _batch_fit_complete(self, result, pars, page_id, … … 2045 2047 res = (fn - gn) / en 2046 2048 except ValueError: 2047 print "Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))2049 print("Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))) 2048 2050 return 2049 2051 -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r984f3fc r72100ee 538 538 sin, cos, tan, asin, acos, atan: 539 539 Trigonometry functions and inverses, operating on radians. 540 sinh, cos , tanh, asinh, acosh, atanh:540 sinh, cosh, tanh, asinh, acosh, atanh: 541 541 Hyperbolic trigonometry functions. 542 542 atan2(y,x): -
src/sas/sasgui/perspectives/fitting/models.py
r463e7ffc ra1b8fee 2 2 Utilities to manage models 3 3 """ 4 from __future__ import print_function 5 4 6 import traceback 5 7 import os … … 141 143 type, value, tb = sys.exc_info() 142 144 if type is not None and issubclass(type, py_compile.PyCompileError): 143 print "Problem with", repr(value)145 print("Problem with", repr(value)) 144 146 raise type, value, tb 145 147 return 1 -
src/sas/sasgui/perspectives/pr/pr.py
r7432acb ra1b8fee 15 15 # Make sure the option of saving each curve is available 16 16 # Use the I(q) curve as input and compare the output to P(r) 17 from __future__ import print_function 17 18 18 19 import sys … … 230 231 out, cov = pr.pr_fit() 231 232 for i in range(len(out)): 232 print "%g +- %g" % (out[i], math.sqrt(cov[i][i]))233 print("%g +- %g" % (out[i], math.sqrt(cov[i][i]))) 233 234 234 235 # Show input P(r) … … 318 319 except: 319 320 err[i] = 1.0 320 print "Error getting error", value, x[i]321 print("Error getting error", value, x[i]) 321 322 322 323 new_plot = Data1D(x, y) -
src/sas/sasgui/perspectives/simulation/ShapeParameters.py
rd85c194 ra1b8fee 8 8 copyright 2009, University of Tennessee 9 9 """ 10 from __future__ import print_function 11 10 12 import wx 11 13 import sys … … 312 314 self.parent.GetSizer().Layout() 313 315 except: 314 print "TODO: move the Layout call of editShape up to the caller"316 print("TODO: move the Layout call of editShape up to the caller") 315 317 316 318 def _readCtrlFloat(self, ctrl): … … 392 394 self.current_shape.params[item[0]] = tmp 393 395 except: 394 print "Could not create"395 print sys.exc_value396 print("Could not create") 397 print(sys.exc_value) 396 398 397 399 def _onCreate(self, evt): … … 485 487 indices = self.shape_listbox.GetSelections() 486 488 if len(indices)>0: 487 print "NOT YET IMPLMENTED"488 print "renaming", self.shape_listbox.GetString(indices[0])489 489 print("NOT YET IMPLMENTED") 490 print("renaming", self.shape_listbox.GetString(indices[0])) 491 -
src/sas/sasgui/plottools/PlotPanel.py
r7432acb ra1b8fee 2 2 Plot panel. 3 3 """ 4 from __future__ import print_function 5 4 6 import logging 5 7 import traceback … … 38 40 def show_tree(obj, d=0): 39 41 """Handy function for displaying a tree of graph objects""" 40 print "%s%s" % ("-"*d, obj.__class__.__name__)42 print("%s%s" % ("-"*d, obj.__class__.__name__)) 41 43 if 'get_children' in dir(obj): 42 44 for a in obj.get_children(): show_tree(a, d + 1) … … 2014 2016 self.toolbar.copy_figure(self.canvas) 2015 2017 except: 2016 print "Error in copy Image"2018 print("Error in copy Image") 2017 2019 2018 2020 -
src/sas/sasgui/plottools/binder.py
r463e7ffc ra1b8fee 2 2 Extension to MPL to support the binding of artists to key/mouse events. 3 3 """ 4 from __future__ import print_function 5 4 6 import sys 5 7 import logging … … 63 65 ] 64 66 except: 65 print "bypassing scroll_event: wrong matplotlib version"67 print("bypassing scroll_event: wrong matplotlib version") 66 68 self._connections = [ 67 69 canvas.mpl_connect('motion_notify_event', self._onMotion), -
src/sas/sasgui/plottools/convert_units.py
r959eb01 ra1b8fee 3 3 This is a cleaned up version of unitConverter.py 4 4 """ 5 from __future__ import print_function 6 5 7 import re 6 8 import string … … 68 70 unit8 = "m/s^{4}" # x^2 (m/s^{4})^{2} 69 71 70 print "this unit1 %s ,its powerer %s , and value %s" % (unit1, 1, convert_unit(1, unit1))71 print "this unit2 %s ,its powerer %s , and value %s" % (unit2, 1, convert_unit(1, unit2))72 print "this unit3 %s ,its powerer %s , and value %s" % (unit3, 2, convert_unit(2, unit3))73 print "this unit4 %s ,its powerer %s , and value %s" % (unit4, -1, convert_unit(-1, unit4))74 print "this unit5 %s ,its powerer %s , and value %s" % (unit5, 2, convert_unit(2, unit5))75 print "this unit6 %s ,its powerer %s , and value %s" % (unit6, 2, convert_unit(2, unit6))76 print "this unit7 %s ,its powerer %s , and value %s" % (unit7, -1, convert_unit(-1, unit7))77 print "this unit8 %s ,its powerer %s , and value %s" % (unit8, 2, convert_unit(2, unit8))78 print "this unit9 %s ,its powerer %s , and value %s" % (unit9, 2, convert_unit(2, unit9))72 print("this unit1 %s ,its powerer %s , and value %s" % (unit1, 1, convert_unit(1, unit1))) 73 print("this unit2 %s ,its powerer %s , and value %s" % (unit2, 1, convert_unit(1, unit2))) 74 print("this unit3 %s ,its powerer %s , and value %s" % (unit3, 2, convert_unit(2, unit3))) 75 print("this unit4 %s ,its powerer %s , and value %s" % (unit4, -1, convert_unit(-1, unit4))) 76 print("this unit5 %s ,its powerer %s , and value %s" % (unit5, 2, convert_unit(2, unit5))) 77 print("this unit6 %s ,its powerer %s , and value %s" % (unit6, 2, convert_unit(2, unit6))) 78 print("this unit7 %s ,its powerer %s , and value %s" % (unit7, -1, convert_unit(-1, unit7))) 79 print("this unit8 %s ,its powerer %s , and value %s" % (unit8, 2, convert_unit(2, unit8))) 80 print("this unit9 %s ,its powerer %s , and value %s" % (unit9, 2, convert_unit(2, unit9))) -
src/sas/sasgui/plottools/fittings.py
rac07a3a ra1b8fee 14 14 15 15 """ 16 from __future__ import print_function 17 16 18 from scipy import optimize 17 19 … … 106 108 chisqr, out, cov = sasfit(line, [cstA, cstB], event.x, y, 0) 107 109 # print "Output parameters:", out 108 print "The right answer is [70.0, 1.0]"109 print chisqr, out, cov110 print("The right answer is [70.0, 1.0]") 111 print(chisqr, out, cov) -
src/sas/sasgui/plottools/plottable_interactor.py
r45dffa69 ra1b8fee 2 2 This module allows more interaction with the plot 3 3 """ 4 from __future__ import print_function 5 4 6 from BaseInteractor import _BaseInteractor 7 5 8 6 9 class PointInteractor(_BaseInteractor): … … 156 159 157 160 def clear(self): 158 print "plottable_interactor.clear()"161 print("plottable_interactor.clear()") 159 162 160 163 def _on_click(self, evt): -
test/fileconverter/test/utest_nxcansas_writer.py
rc476457 r17c9436 66 66 if os.path.isfile(self.write_file_1d): 67 67 os.remove(self.write_file_1d) 68 if os.path.isfile(self.write_file_2d): 69 os.remove(self.write_file_2d) -
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): -
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/testplugings.py
r959eb01 r17c9436 3 3 """ 4 4 5 import os 5 6 import unittest 6 7 from sas.sascalc.dataloader.loader import Loader, Registry … … 41 42 # Create module 42 43 import zipfile 43 z = zipfile.PyZipFile("plugins.zip", 'w') 44 f_name = "plugins.zip" 45 z = zipfile.PyZipFile(f_name, 'w') 44 46 z.writepy("../plugins", "") 45 47 z.close() 48 if os.path.isfile(f_name): 49 os.remove(f_name) 46 50 47 51 def testplugin_checksetup(self): -
test/sasdataloader/test/utest_abs_reader.py
rdd11014 rc551bb3 2 2 Unit tests for data manipulations 3 3 """ 4 from __future__ import print_function 4 5 5 6 import unittest … … 8 9 from sas.sascalc.dataloader.loader import Loader 9 10 from sas.sascalc.dataloader.readers.IgorReader import Reader as IgorReader 11 from sas.sascalc.dataloader.readers.abs_reader import Reader as AbsReader 12 from sas.sascalc.dataloader.readers.hfir1d_reader import Reader as HFIRReader 13 from sas.sascalc.dataloader.readers.danse_reader import Reader as DANSEReader 14 from sas.sascalc.dataloader.readers.cansas_reader import Reader as CANSASReader 15 10 16 from sas.sascalc.dataloader.data_info import Data1D 11 17 12 18 import os.path 13 19 20 14 21 class abs_reader(unittest.TestCase): 15 22 16 23 def setUp(self): 17 from sas.sascalc.dataloader.readers.abs_reader import Reader18 self.data = Reader().read("jan08002.ABS")19 24 reader = AbsReader() 25 self.data = reader.read("jan08002.ABS") 26 20 27 def test_abs_checkdata(self): 21 28 """ … … 61 68 def test_checkdata2(self): 62 69 self.assertEqual(self.data.dy[126], 1) 63 70 71 def test_generic_loader(self): 72 # the generic loader should work as well 73 data = Loader().load("jan08002.ABS") 74 self.assertEqual(data.meta_data['loader'], "IGOR 1D") 75 76 64 77 class hfir_reader(unittest.TestCase): 65 78 66 79 def setUp(self): 67 self.data = Loader().load("S2-30dq.d1d") 68 80 reader = HFIRReader() 81 self.data = reader.read("S2-30dq.d1d") 82 69 83 def test_hfir_checkdata(self): 70 84 """ … … 83 97 self.assertEqual(self.data.dy[1], 0.000315) 84 98 self.assertEqual(self.data.dx[1], 0.008249) 85 99 100 def test_generic_loader(self): 101 # the generic loader should work as well 102 data = Loader().load("S2-30dq.d1d") 103 self.assertEqual(data.meta_data['loader'], "HFIR 1D") 104 86 105 87 106 class igor_reader(unittest.TestCase): … … 137 156 138 157 def setUp(self): 139 self.data = Loader().load("MP_New.sans") 158 reader = DANSEReader() 159 self.data = reader.read("MP_New.sans") 140 160 141 161 def test_checkdata(self): … … 171 191 self.assertEqual(self.data.err_data[2], 2.06313) 172 192 193 def test_generic_loader(self): 194 # the generic loader should work as well 195 data = Loader().load("MP_New.sans") 196 self.assertEqual(data.meta_data['loader'], "DANSE") 197 173 198 174 199 class cansas_reader(unittest.TestCase): 175 200 176 201 def setUp(self): 202 reader = CANSASReader() 203 data = reader.read("cansas1d.xml") 204 self.data = data[0] 205 206 def test_generic_loader(self): 207 # the generic loader should work as well 177 208 data = Loader().load("cansas1d.xml") 178 self. data = data[0]179 209 self.assertEqual(data[0].meta_data['loader'], "CanSAS XML 1D") 210 180 211 def test_cansas_checkdata(self): 181 212 self.assertEqual(self.data.filename, "cansas1d.xml") … … 190 221 tests won't pass 191 222 """ 192 193 223 self.assertEqual(self.data.run[0], "1234") 194 224 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") … … 264 294 self.assertEqual(item.distance_unit,'mm') 265 295 266 if item.size.x ==50 \267 and item.distance ==11000.0 \268 and item.name =='source' \269 and item.type =='radius':296 if item.size.x == 50 \ 297 and item.distance == 11000.0 \ 298 and item.name == 'source' \ 299 and item.type == 'radius': 270 300 _found1 = True 271 elif item.size.x ==1.0 \272 and item.name =='sample' \273 and item.type =='radius':301 elif item.size.x == 1.0 \ 302 and item.name == 'sample' \ 303 and item.type == 'radius': 274 304 _found2 = True 275 305 276 if _found1 ==False or _found2==False:306 if _found1 == False or _found2 == False: 277 307 raise RuntimeError, "Could not find all data %s %s" % (_found1, _found2) 278 308 … … 309 339 self.assertTrue(item.date in ['04-Sep-2007 18:35:02', 310 340 '03-SEP-2006 11:42:47']) 311 print item.term341 print(item.term) 312 342 for t in item.term: 313 if t['name']=="ABS:DSTAND" \314 and t['unit'] =='mm' \315 and float(t['value']) ==1.0:343 if (t['name'] == "ABS:DSTAND" 344 and t['unit'] == 'mm' 345 and float(t['value']) == 1.0): 316 346 _found_term2 = True 317 elif t['name']=="radialstep" \318 and t['unit']=='mm' \319 and float(t['value'])==10.0:347 elif (t['name'] == "radialstep" 348 and t['unit'] == 'mm' 349 and float(t['value']) == 10.0): 320 350 _found_term1 = True 321 351 322 if _found_term1==False or _found_term2==False: 323 raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 324 325 326 352 if _found_term1 == False or _found_term2 == False: 353 raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 327 354 328 355 def test_writer(self): 329 from sas.sascalc.dataloader.readers.cansas_reader import Reader 330 r = Reader() 331 x = np.ones(5) 332 y = np.ones(5) 333 dy = np.ones(5) 334 356 r = CANSASReader() 357 335 358 filename = "write_test.xml" 336 359 r.write(filename, self.data) … … 339 362 self.assertEqual(self.data.filename, filename) 340 363 self._checkdata() 364 if os.path.isfile(filename): 365 os.remove(filename) 341 366 342 367 def test_units(self): … … 346 371 """ 347 372 filename = "cansas1d_units.xml" 348 data = Loader().load(filename)373 data = CANSASReader().read(filename) 349 374 self.data = data[0] 350 375 self.assertEqual(self.data.filename, filename) … … 357 382 """ 358 383 filename = "cansas1d_badunits.xml" 359 data = Loader().load(filename)384 data = CANSASReader().read(filename) 360 385 self.data = data[0] 361 386 self.assertEqual(self.data.filename, filename) … … 366 391 367 392 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 368 print self.data.errors393 print(self.data.errors) 369 394 self.assertEqual(len(self.data.errors), 1) 370 371 395 372 396 def test_slits(self): 373 397 """ … … 375 399 """ 376 400 filename = "cansas1d_slit.xml" 377 data = Loader().load(filename)401 data = CANSASReader().read(filename) 378 402 self.data = data[0] 379 403 self.assertEqual(self.data.filename, filename) … … 397 421 self.assertEqual(self.data.run_name['1234'], 'run name') 398 422 self.assertEqual(self.data.title, "Test title") 399 400 423 401 424 402 425 if __name__ == '__main__': -
test/sasdataloader/test/utest_cansas.py
r7432acb r1fc50fb2 46 46 self.schema_1_0 = "cansas1d_v1_0.xsd" 47 47 self.schema_1_1 = "cansas1d_v1_1.xsd" 48 48 self.write_1_0_filename = "isis_1_0_write_test.xml" 49 self.write_1_1_filename = "isis_1_1_write_test.xml" 49 50 50 51 def get_number_of_entries(self, dictionary, name, i): … … 56 57 return name 57 58 58 59 59 def test_invalid_xml(self): 60 60 """ … … 62 62 """ 63 63 invalid = StringIO.StringIO('<a><c></b></a>') 64 reader = XMLreader(invalid) 65 64 XMLreader(invalid) 66 65 67 66 def test_xml_validate(self): … … 82 81 self.assertFalse(xmlschema.validate(invalid)) 83 82 84 85 83 def test_real_xml(self): 86 84 reader = XMLreader(self.xml_valid, self.schema_1_0) … … 90 88 else: 91 89 self.assertFalse(valid) 92 93 90 94 91 def _check_data(self, data): … … 105 102 self.assertTrue(data.meta_data["xmlpreprocess"] is not None) 106 103 107 108 104 def _check_data_1_1(self, data): 109 105 spectrum = data.trans_spectrum[0] 110 106 self.assertTrue(len(spectrum.wavelength) == 138) 111 107 112 113 108 def test_cansas_xml(self): 114 filename = "isis_1_1_write_test.xml"115 109 xmlreader = XMLreader(self.isis_1_1, self.schema_1_1) 116 110 valid = xmlreader.validate_xml() 117 111 xmlreader.set_processing_instructions() 118 112 self.assertTrue(valid) 119 fo = open(self.isis_1_1)120 str = fo.read()121 113 reader_generic = Loader() 122 114 dataloader = reader_generic.load(self.isis_1_1) … … 128 120 self._check_data(cansasreader[i]) 129 121 self._check_data_1_1(cansasreader[i]) 130 reader_generic.save(filename, dataloader[i], None) 131 fo = open(filename) 132 str = fo.read() 122 reader_generic.save(self.write_1_1_filename, dataloader[i], None) 133 123 reader2 = Loader() 134 return_data = reader2.load(filename) 124 self.assertTrue(os.path.isfile(self.write_1_1_filename)) 125 return_data = reader2.load(self.write_1_1_filename) 135 126 written_data = return_data[0] 136 127 self._check_data(written_data) 137 128 if os.path.isfile(self.write_1_1_filename): 129 os.remove(self.write_1_1_filename) 138 130 139 131 def test_double_trans_spectra(self): … … 144 136 for item in data: 145 137 self._check_data(item) 146 147 138 148 139 def test_entry_name_recurse(self): … … 155 146 self.assertTrue(len(d) == 6) 156 147 157 158 148 def test_load_cansas_file(self): 159 valid = []160 149 reader1 = XMLreader(self.xml_valid, self.schema_1_0) 161 150 self.assertTrue(reader1.validate_xml()) … … 173 162 self.assertFalse(reader7.validate_xml()) 174 163 175 176 164 def test_invalid_cansas(self): 177 165 list = self.loader.load(self.cansas1d_notitle) … … 184 172 self.assertTrue(data.detector[0].distance == 4150) 185 173 186 187 174 def test_old_cansas_files(self): 188 175 reader1 = XMLreader(self.cansas1d, self.schema_1_0) 189 176 self.assertTrue(reader1.validate_xml()) 190 177 file_loader = Loader() 191 file 1 = file_loader.load(self.cansas1d)178 file_loader.load(self.cansas1d) 192 179 reader2 = XMLreader(self.cansas1d_units, self.schema_1_0) 193 180 self.assertTrue(reader2.validate_xml()) … … 197 184 self.assertTrue(reader4.validate_xml()) 198 185 199 200 186 def test_save_cansas_v1_0(self): 201 filename = "isis_1_0_write_test.xml"202 187 xmlreader = XMLreader(self.isis_1_0, self.schema_1_0) 203 188 valid = xmlreader.validate_xml() … … 210 195 self._check_data(dataloader[i]) 211 196 self._check_data(cansasreader[i]) 212 reader_generic.save( filename, dataloader[i], None)197 reader_generic.save(self.write_1_0_filename, dataloader[i], None) 213 198 reader2 = Reader() 214 return_data = reader2.read(filename) 199 self.assertTrue(os.path.isfile(self.write_1_0_filename)) 200 return_data = reader2.read(self.write_1_0_filename) 215 201 written_data = return_data[0] 216 xmlwrite = XMLreader(filename, self.schema_1_0)202 XMLreader(self.write_1_0_filename, self.schema_1_0) 217 203 valid = xmlreader.validate_xml() 218 204 self.assertTrue(valid) 219 205 self._check_data(written_data) 220 206 if os.path.isfile(self.write_1_0_filename): 207 os.remove(self.write_1_0_filename) 221 208 222 209 def test_processing_instructions(self): … … 224 211 valid = reader.validate_xml() 225 212 if valid: 226 # #find the processing instructions and make into a dictionary213 # find the processing instructions and make into a dictionary 227 214 dic = self.get_processing_instructions(reader) 228 215 self.assertTrue(dic == {'xml-stylesheet': \ … … 232 219 xmldoc = minidom.parseString(xml) 233 220 234 # #take the processing instructions and put them back in221 # take the processing instructions and put them back in 235 222 xmldoc = self.set_processing_instructions(xmldoc, dic) 236 xml_output = xmldoc.toprettyxml() 237 223 xmldoc.toprettyxml() 238 224 239 225 def set_processing_instructions(self, minidom_object, dic): … … 243 229 minidom_object.insertBefore(pi, xmlroot) 244 230 return minidom_object 245 246 231 247 232 def get_processing_instructions(self, xml_reader_object): -
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.