Changes in / [914c49d5:6e6dd4c] in sasview
- Files:
-
- 3 added
- 65 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/installer_generator.py
ra1b8fee r959eb01 4 4 exists in the current directory. Edit local_config.py according to your needs. 5 5 """ 6 from __future__ import print_function7 8 6 import local_config 9 7 import os 10 8 import string 11 12 9 13 10 REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" … … 367 364 f.write(TEMPLATE) 368 365 f.close() 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))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) 371 368 372 369 if __name__ == "__main__": -
sasview/local_config.py
ra1b8fee rea45bfe 2 2 Application settings 3 3 """ 4 from __future__ import print_function5 6 4 import time 7 5 import os … … 152 150 :TODO - Need method doc string 153 151 """ 154 print ("%g: %s" % (time.clock(), message))152 print "%g: %s" % (time.clock(), message) 155 153 156 154 if __EVT_DEBUG_2_FILE__: -
sasview/setup_exe.py
ra1b8fee rf36e01f 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_function16 15 17 16 import os … … 63 62 sys.argv.remove('--extrapath') 64 63 except: 65 print("Error processing extra python path needed to build SasView\n %s" % 66 sys.exc_value)64 print("Error processing extra python path needed to build SasView\n %s" % \ 65 sys.exc_value) 67 66 68 67 -
sasview/setup_mac.py
ra1b8fee rcfa88ee 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_function14 15 13 from setuptools import setup 16 14 import periodictable.xsf … … 30 28 build_path = os.path.join(root, 'build','lib.'+platform) 31 29 sys.path.insert(0, build_path) 32 print ("BUILDING PATH INSIDE", build_path)30 print "BUILDING PATH INSIDE", build_path 33 31 ICON = local_config.SetupIconFile_mac 34 32 EXTENSIONS_LIST = [] … … 72 70 # See if the documentation has been built, and if so include it. 73 71 doc_path = os.path.join(build_path, "doc") 74 print (doc_path)72 print doc_path 75 73 if os.path.exists(doc_path): 76 74 for dirpath, dirnames, filenames in os.walk(doc_path): -
sasview/wxcruft.py
ra1b8fee r12e5cc8 1 from __future__ import print_function2 3 1 import inspect 4 2 import wx … … 31 29 else: 32 30 tag = "" 33 print ("NewId %d from %s(%d):%s%s"%(id, path, line, function, tag))31 print "NewId %d from %s(%d):%s%s"%(id, path, line, function, tag) 34 32 return id 35 33 -
src/examples/data_generator/testdata_generator.py
ra1b8fee r959eb01 1 from __future__ import print_function2 3 1 """ 4 2 Generate two correlated sets of data … … 44 42 # Write line data set 45 43 fd = open(filename, 'w') 46 print ("Creating ", filename)44 print "Creating ", filename 47 45 fd.write("#y=A*x+B\n#A=%g\n#B=%g\n" % (self.constant_a, self.constant_b)) 48 46 -
src/sas/sascalc/calculator/sas_gen.py
ra1b8fee r7432acb 3 3 SAS generic computation and sld file readers 4 4 """ 5 from __future__ import print_function6 7 5 import sas.sascalc.calculator.core.sld2i as mod 8 6 from sas.sascalc.calculator.BaseComponent import BaseComponent … … 560 558 vol_pix = np.append(vol_pix, vol) 561 559 except: 562 print ("Error: set the sld of %s to zero"% atom_name)560 print "Error: set the sld of %s to zero"% atom_name 563 561 sld_n = np.append(sld_n, 0.0) 564 562 sld_mx = np.append(sld_mx, 0) … … 611 609 Write 612 610 """ 613 print ("Not implemented... ")611 print "Not implemented... " 614 612 615 613 class SLDReader(object): … … 1046 1044 from mpl_toolkits.mplot3d import Axes3D 1047 1045 current_dir = os.path.abspath(os.path.curdir) 1048 print (current_dir)1046 print current_dir 1049 1047 for i in range(6): 1050 1048 current_dir, _ = os.path.split(current_dir) -
src/sas/sascalc/data_util/calcthread.py
ra1b8fee r7432acb 4 4 # \brief Abstract class for defining calculation threads. 5 5 # 6 from __future__ import print_function7 6 8 7 import thread … … 296 295 """ 297 296 def __init__(self, n=20000): 298 print (thread.get_ident())297 print thread.get_ident() 299 298 self.starttime = clock() 300 299 self.done = False … … 308 307 self.work2.queue(n) 309 308 self.work3.queue(n) 310 print ("Expect updates from Main every second and from thread every 2.5 seconds")311 print ("")309 print "Expect updates from Main every second and from thread every 2.5 seconds" 310 print "" 312 311 self.work.ready(.5) 313 312 while not self.done: 314 313 sleep(1) 315 print ("Main thread %d at %.2f" % (thread.get_ident(),316 clock() - self.starttime) )314 print "Main thread %d at %.2f" % (thread.get_ident(), 315 clock() - self.starttime) 317 316 318 317 def update(self, i=0): 319 print ("Update i=%d from thread %d at %.2f" % (i, thread.get_ident(),320 clock() - self.starttime) )318 print "Update i=%d from thread %d at %.2f" % (i, thread.get_ident(), 319 clock() - self.starttime) 321 320 self.work.ready(2.5) 322 321 323 322 def complete(self, total=0.0): 324 print ("Complete total=%g from thread %d at %.2f" % (total,323 print "Complete total=%g from thread %d at %.2f" % (total, 325 324 thread.get_ident(), 326 clock() - self.starttime) )325 clock() - self.starttime) 327 326 self.done = True -
src/sas/sascalc/data_util/formatnum.py
ra1b8fee r9a5097c 37 37 formatter.compact flag. 38 38 """ 39 from __future__ import division , print_function39 from __future__ import division 40 40 41 41 import math -
src/sas/sascalc/data_util/registry.py
ra1b8fee rb699768 6 6 and registers the built-in file extensions. 7 7 """ 8 from __future__ import print_function9 8 10 9 import os.path -
src/sas/sascalc/dataloader/data_info.py
ra1b8fee r7432acb 16 16 ###################################################################### 17 17 18 from __future__ import print_function19 18 20 19 #TODO: Keep track of data manipulation in the 'process' data structure. -
src/sas/sascalc/dataloader/readers/IgorReader.py
ra1b8fee r959eb01 12 12 #copyright 2008, University of Tennessee 13 13 ############################################################################# 14 from __future__ import print_function15 16 14 import os 17 15 -
src/sas/sascalc/dataloader/readers/associations.py
ra1b8fee r959eb01 14 14 #copyright 2009, University of Tennessee 15 15 ############################################################################# 16 from __future__ import print_function17 18 16 import os 19 17 import sys … … 73 71 logger.error(msg) 74 72 else: 75 print ("Could not find reader association settings\n %s [%s]" % (__file__, os.getcwd()))73 print "Could not find reader association settings\n %s [%s]" % (__file__, os.getcwd()) 76 74 77 75 -
src/sas/sascalc/dataloader/readers/red2d_reader.py
ra1b8fee r959eb01 9 9 #copyright 2008, University of Tennessee 10 10 ###################################################################### 11 from __future__ import print_function12 13 11 import os 14 12 import numpy as np … … 84 82 detector = Detector() 85 83 if len(output.detector) > 0: 86 print (str(output.detector[0]))84 print str(output.detector[0]) 87 85 output.detector.append(detector) 88 86 -
src/sas/sascalc/fit/AbstractFitEngine.py
ra1b8fee r7432acb 1 from __future__ import print_function2 1 3 2 import copy … … 628 627 """ 629 628 """ 630 print (str(self))629 print str(self) -
src/sas/sascalc/fit/Loader.py
ra1b8fee rac07a3a 1 from __future__ import print_function2 3 1 # class Loader to load any king of file 4 2 #import wx … … 56 54 self.dx = np.zeros(len(self.x)) 57 55 except: 58 print ("READ ERROR", line)56 print "READ ERROR", line 59 57 # Sanity check 60 58 if not len(self.x) == len(self.dx): … … 82 80 load = Load() 83 81 load.set_filename("testdata_line.txt") 84 print (load.get_filename())82 print load.get_filename() 85 83 load.set_values() 86 print (load.get_values())84 print load.get_values() 87 85 88 86 -
src/sas/sascalc/fit/expression.py
ra1b8fee r9a5097c 43 43 Ideally, this interface will change 44 44 """ 45 from __future__ import print_function46 47 45 import math 48 46 import re -
src/sas/sascalc/pr/fit/AbstractFitEngine.py
ra1b8fee r7432acb 1 from __future__ import print_function2 1 3 2 import copy … … 631 630 """ 632 631 """ 633 print (str(self))632 print str(self) -
src/sas/sascalc/pr/fit/Loader.py
ra1b8fee rac07a3a 1 from __future__ import print_function2 3 1 # class Loader to load any king of file 4 2 #import wx … … 56 54 self.dx = np.zeros(len(self.x)) 57 55 except: 58 print ("READ ERROR", line)56 print "READ ERROR", line 59 57 # Sanity check 60 58 if not len(self.x) == len(self.dx): … … 82 80 load = Load() 83 81 load.set_filename("testdata_line.txt") 84 print (load.get_filename())82 print load.get_filename() 85 83 load.set_values() 86 print (load.get_values())84 print load.get_values() 87 85 88 86 -
src/sas/sascalc/pr/fit/expression.py
ra1b8fee r9a5097c 1 from __future__ import print_function2 3 1 # This program is public domain 4 2 """ -
src/sas/sascalc/pr/num_term.py
ra1b8fee r7432acb 1 from __future__ import print_function2 3 1 import math 4 2 import numpy as np … … 199 197 # Testing estimator 200 198 est = NTermEstimator(invert) 201 print (est.num_terms())199 print est.num_terms() -
src/sas/sascalc/simulation/analmodelpy/tests/signon.py
r9c3d784 rd85c194 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
ra1b8fee rd85c194 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function14 15 13 16 14 if __name__ == "__main__": … … 20 18 from SASsimulation import geoshapespy 21 19 22 print ("copyright information:")23 print (" ", analmodelpymodule.copyright())20 print "copyright information:" 21 print " ", analmodelpymodule.copyright() 24 22 25 print ()26 print ("module information:")27 print (" file:", analmodelpymodule.__file__)28 print (" doc:", analmodelpymodule.__doc__)29 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) 30 28 31 29 a = geoshapespy.new_sphere(1.0) -
src/sas/sascalc/simulation/geoshapespy/tests/testshapes.py
ra1b8fee rd85c194 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function14 15 13 16 14 if __name__ == "__main__": … … 18 16 from SASsimulation import geoshapespy 19 17 20 print ()21 print ("module information:")22 print (" file:", geoshapespy.__file__)23 print (" doc:", geoshapespy.__doc__)24 print (" contents:", dir(geoshapespy))18 print 19 print "module information:" 20 print " file:", geoshapespy.__file__ 21 print " doc:", geoshapespy.__doc__ 22 print " contents:", dir(geoshapespy) 25 23 26 24 sp = geoshapespy.new_sphere(10) -
src/sas/sascalc/simulation/iqPy/tests/signon.py
ra1b8fee rd85c194 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function14 15 13 16 14 if __name__ == "__main__": … … 19 17 from iqPy import iqPy as iqPymodule 20 18 21 print ("copyright information:")22 print (" ", iqPy.copyright())23 print (" ", iqPymodule.copyright())19 print "copyright information:" 20 print " ", iqPy.copyright() 21 print " ", iqPymodule.copyright() 24 22 25 print ()26 print ("module information:")27 print (" file:", iqPymodule.__file__)28 print (" doc:", iqPymodule.__doc__)29 print (" contents:", dir(iqPymodule))23 print 24 print "module information:" 25 print " file:", iqPymodule.__file__ 26 print " doc:", iqPymodule.__doc__ 27 print " contents:", dir(iqPymodule) 30 28 31 print ()29 print 32 30 33 31 # version -
src/sas/sascalc/simulation/iqPy/tests/testiq.py
r9c3d784 rd85c194 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
ra1b8fee rd85c194 11 11 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 12 # 13 from __future__ import print_function14 15 13 16 14 if __name__ == "__main__": … … 19 17 from pointsmodelpy import pointsmodelpy as pointsmodelpymodule 20 18 21 print ("copyright information:")22 print (" ", pointsmodelpy.copyright())23 print (" ", pointsmodelpymodule.copyright())19 print "copyright information:" 20 print " ", pointsmodelpy.copyright() 21 print " ", pointsmodelpymodule.copyright() 24 22 25 print ()26 print ("module information:")27 print (" file:", pointsmodelpymodule.__file__)28 print (" doc:", pointsmodelpymodule.__doc__)29 print (" contents:", dir(pointsmodelpymodule))23 print 24 print "module information:" 25 print " file:", pointsmodelpymodule.__file__ 26 print " doc:", pointsmodelpymodule.__doc__ 27 print " contents:", dir(pointsmodelpymodule) 30 28 31 print ()32 print (pointsmodelpymodule.hello())29 print 30 print pointsmodelpymodule.hello() 33 31 34 32 # version -
src/sas/sascalc/simulation/pointsmodelpy/tests/test2dui.py
ra1b8fee r959eb01 7 7 # Imports: 8 8 #-------------------------------------------------------------------------------- 9 from __future__ import print_function10 9 11 10 import wx … … 47 46 48 47 data = ImageData(value_grid, index_vals) 49 print (value_grid, index_vals)48 print value_grid, index_vals 50 49 51 50 # Create the index axes -
src/sas/sascalc/simulation/pointsmodelpy/tests/testcomplexmodel.py
ra1b8fee r959eb01 1 from __future__ import print_function2 3 1 from sasModeling.pointsmodelpy import pointsmodelpy 4 2 from sasModeling.iqPy import iqPy 5 3 from sasModeling.geoshapespy import geoshapespy 6 7 4 8 5 #First testing: a normal case, a lores model holds a sphere … … 64 61 iqPy.OutputIQ(iqcomplex,"testcomplex2.iq") 65 62 66 print ("p(r) is saved in testcomplex2.pr")67 print ("I(Q) is saved in testcomplex2.iq")68 print ("pass")63 print "p(r) is saved in testcomplex2.pr" 64 print "I(Q) is saved in testcomplex2.iq" 65 print "pass" 69 66 70 67 #testing 3, insert one empty pdbmodel and one loresmodel … … 91 88 iqPy.OutputIQ(iqcomplex,"testcomplex3.iq") 92 89 93 print ("p(r) is saved in testcomplex3.pr")94 print ("I(Q) is saved in testcomplex3.iq")95 print ("pass")90 print "p(r) is saved in testcomplex3.pr" 91 print "I(Q) is saved in testcomplex3.iq" 92 print "pass" 96 93 97 94 # Test 2D complex model … … 109 106 pointsmodelpy.get_complexpoints(complex,vpcomplex); 110 107 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));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); 113 110 114 111 -
src/sas/sascalc/simulation/pointsmodelpy/tests/testlores.py
ra1b8fee r959eb01 1 from __future__ import print_function2 3 4 1 if __name__ == "__main__": 5 2 … … 13 10 # print " ", pointsmodelpymodule.copyright() 14 11 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))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) 21 18 22 19 # a = geoshapespy.new_singlehelix(10,2,30,2) … … 49 46 pointsmodelpy.outputPDB(lm,vp,"modelpy.pseudo.pdb") 50 47 51 print ("calculating distance distribution")48 print "calculating distance distribution" 52 49 rmax = pointsmodelpy.get_lores_pr(lm,vp) 53 print ("finish calculating get_lores_pr, and rmax is:", rmax)50 print "finish calculating get_lores_pr, and rmax is:", rmax 54 51 pointsmodelpy.outputPR(lm,"testlores.pr") 55 52 pointsmodelpy.get_lores_iq(lm,iq) … … 57 54 iqPy.OutputIQ(iq, "testlores.iq") 58 55 59 print ("Testing get I from a single q")56 print "Testing get I from a single q" 60 57 result = pointsmodelpy.get_lores_i(lm,0.1) 61 print ("The I(0.1) is: %s" % str(result))58 print "The I(0.1) is: %s" % str(result) 62 59 63 60 # version -
src/sas/sascalc/simulation/pointsmodelpy/tests/testlores2d.py
ra1b8fee r959eb01 1 from __future__ import print_function2 3 4 1 def test_lores2d(phi): 5 2 from sasModeling.pointsmodelpy import pointsmodelpy … … 48 45 value_grid = zeros((100,100),Float) 49 46 width, height = value_grid.shape 50 print (width,height)47 print width,height 51 48 52 49 I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002) 53 print (I)50 print I 54 51 55 52 Imax = 0 … … 89 86 value_grid = zeros((100,100),Float) 90 87 width, height = value_grid.shape 91 print (width,height)88 print width,height 92 89 93 90 I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002) 94 print (I)91 print I 95 92 96 93 Imax = 0 … … 112 109 if __name__ == "__main__": 113 110 114 print ("start to test lores 2D")111 print "start to test lores 2D" 115 112 # test_lores2d(10) 116 113 value_grid = get2d_2() 117 print (value_grid)118 print ("pass")114 print value_grid 115 print "pass" -
src/sas/sasgui/guiframe/config.py
ra1b8fee rea45bfe 2 2 Application settings 3 3 """ 4 from __future__ import print_function5 6 4 import time 7 5 import os … … 152 150 :TODO - Need method doc string 153 151 """ 154 print ("%g: %s" % (time.clock(), message))152 print "%g: %s" % (time.clock(), message) 155 153 156 154 if __EVT_DEBUG_2_FILE__: -
src/sas/sasgui/guiframe/data_panel.py
ra1b8fee r959eb01 11 11 This module provides Graphic interface for the data_manager module. 12 12 """ 13 from __future__ import print_function14 15 13 import wx 16 14 from wx.build import build_options … … 516 514 self.parent.save_data2d(data, default_name) 517 515 else: 518 print ("unable to save this type of data")516 print "unable to save this type of data" 519 517 520 518 def layout_data_list(self): … … 1499 1497 except: 1500 1498 # raise 1501 print ("error", sys.exc_value)1499 print "error", sys.exc_value 1502 1500 1503 1501 app.MainLoop() -
src/sas/sasgui/guiframe/data_processor.py
ra1b8fee r7432acb 18 18 19 19 """ 20 from __future__ import print_function21 22 20 import os 23 21 import sys … … 2037 2035 frame.Show(True) 2038 2036 except: 2039 print (sys.exc_value)2037 print sys.exc_value 2040 2038 2041 2039 app.MainLoop() -
src/sas/sasgui/guiframe/dummyapp.py
ra1b8fee r959eb01 3 3 Allows the user to set an external data manager 4 4 """ 5 from __future__ import print_function6 7 5 import sas.sasgui.guiframe.gui_manager as gui_manager 8 6 … … 34 32 plug_menu.Append(id, '&Do something') 35 33 def _on_do_something(event): 36 print ("Do something")34 print "Do something" 37 35 wx.EVT_MENU(self.parent, id, _on_do_something) 38 36 -
src/sas/sasgui/guiframe/gui_style.py
ra1b8fee r959eb01 3 3 Provide the style for guiframe 4 4 """ 5 from __future__ import print_function6 7 5 import wx 8 6 import os … … 81 79 if __name__ == "__main__": 82 80 83 print (GUIFRAME.DEFAULT_STYLE)84 print (GUIFRAME.FLOATING_PANEL)85 print (GUIFRAME.SINGLE_APPLICATION)81 print GUIFRAME.DEFAULT_STYLE 82 print GUIFRAME.FLOATING_PANEL 83 print GUIFRAME.SINGLE_APPLICATION 86 84 style = GUIFRAME.MULTIPLE_APPLICATIONS 87 85 style &= GUIFRAME.PLOTTING_ON 88 print (style == GUIFRAME.PLOTTING_ON)86 print style == GUIFRAME.PLOTTING_ON 89 87 style1 = GUIFRAME.MULTIPLE_APPLICATIONS 90 88 style1 &= (~GUIFRAME.MANAGER_ON) 91 print (style1 == GUIFRAME.DEFAULT_STYLE)92 print (style1)89 print style1 == GUIFRAME.DEFAULT_STYLE 90 print style1 -
src/sas/sasgui/guiframe/proxy.py
ra1b8fee r463e7ffc 1 1 #!/usr/bin/env python 2 2 # -*- coding: utf-8 -*- 3 from __future__ import print_function4 5 3 import urllib2 6 4 import sys … … 159 157 response = c.connect() 160 158 if response is not None: 161 print (50 * '-')159 print 50 * '-' 162 160 content = json.loads(response.read().strip()) 163 161 pprint(content) -
src/sas/sasgui/perspectives/calculator/detector_editor.py
ra1b8fee r959eb01 1 from __future__ import print_function2 1 3 2 import wx … … 35 34 self.set_values() 36 35 except: 37 print ("error", sys.exc_value)36 print "error", sys.exc_value 38 37 39 38 def _define_structure(self): -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
ra1b8fee r7432acb 3 3 This module relies on guiframe manager. 4 4 """ 5 from __future__ import print_function6 5 7 6 import wx … … 1999 1998 self.panel.set_volume_ctl_val(str(val)) 2000 1999 except: 2001 print ("self.panel is not initialized yet")2000 print "self.panel is not initialized yet" 2002 2001 2003 2002 def set_omfpanel_default_shap(self, shape): -
src/sas/sasgui/perspectives/calculator/image_viewer.py
ra1b8fee r7432acb 1 from __future__ import print_function2 3 1 import os 4 2 import sys … … 80 78 wx.PostEvent(parent, StatusEvent(status=err_msg, info="error")) 81 79 else: 82 print (err_msg)80 print err_msg 83 81 84 82 def choose_data_file(self, location=None): … … 303 301 info="error")) 304 302 else: 305 print (err_msg)303 print err_msg 306 304 return flag 307 305 … … 334 332 info="error")) 335 333 else: 336 print (err_msg)334 print err_msg 337 335 return flag 338 336 … … 363 361 info="error")) 364 362 else: 365 print (err_msg)363 print err_msg 366 364 367 365 self.OnClose(event) -
src/sas/sasgui/perspectives/calculator/model_editor.py
ra1b8fee r7432acb 23 23 #copyright 2009, University of Tennessee 24 24 ################################################################################ 25 from __future__ import print_function26 27 25 import wx 28 26 import sys … … 873 871 # Put the cursor at appropriate position 874 872 length = len(label) 875 print (length)873 print length 876 874 if label[length-1] == ')': 877 875 length -= 1 -
src/sas/sasgui/perspectives/fitting/basepage.py
ra1b8fee rac0578c 2 2 Base Page for fitting 3 3 """ 4 from __future__ import print_function5 6 4 import sys 7 5 import os … … 659 657 # It seems MAC needs wxCallAfter 660 658 if event.GetId() == GUIFRAME_ID.COPYEX_ID: 661 print ("copy excel")659 print "copy excel" 662 660 wx.CallAfter(self.get_copy_excel) 663 661 elif event.GetId() == GUIFRAME_ID.COPYLAT_ID: 664 print ("copy latex")662 print "copy latex" 665 663 wx.CallAfter(self.get_copy_latex) 666 664 else: … … 3370 3368 except Exception: 3371 3369 logger.error(traceback.format_exc()) 3372 print ("Error in BasePage._paste_poly_help: %s" % \3373 sys.exc_info()[1] )3370 print "Error in BasePage._paste_poly_help: %s" % \ 3371 sys.exc_info()[1] 3374 3372 3375 3373 def _set_disp_cb(self, isarray, item): … … 3400 3398 Moveit; This method doesn't belong here 3401 3399 """ 3402 print ("BasicPage.update_pinhole_smear was called: skipping")3400 print "BasicPage.update_pinhole_smear was called: skipping" 3403 3401 return 3404 3402 … … 3576 3574 # check model type to show sizer 3577 3575 if self.model is not None: 3578 print ("_set_model_sizer_selection: disabled.")3576 print "_set_model_sizer_selection: disabled." 3579 3577 # self._set_model_sizer_selection(self.model) 3580 3578 -
src/sas/sasgui/perspectives/fitting/fitting.py
ra1b8fee r7432acb 11 11 #copyright 2009, University of Tennessee 12 12 ################################################################################ 13 from __future__ import print_function14 15 13 import re 16 14 import sys … … 1255 1253 """ 1256 1254 """ 1257 print ("update_fit result", result)1255 print "update_fit result", result 1258 1256 1259 1257 def _batch_fit_complete(self, result, pars, page_id, … … 2048 2046 res = (fn - gn) / en 2049 2047 except ValueError: 2050 print ("Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en)))2048 print "Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en)) 2051 2049 return 2052 2050 -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r72100ee r984f3fc 538 538 sin, cos, tan, asin, acos, atan: 539 539 Trigonometry functions and inverses, operating on radians. 540 sinh, cos h, tanh, asinh, acosh, atanh:540 sinh, cos, tanh, asinh, acosh, atanh: 541 541 Hyperbolic trigonometry functions. 542 542 atan2(y,x): -
src/sas/sasgui/perspectives/fitting/models.py
ra1b8fee r463e7ffc 2 2 Utilities to manage models 3 3 """ 4 from __future__ import print_function5 6 4 import traceback 7 5 import os … … 143 141 type, value, tb = sys.exc_info() 144 142 if type is not None and issubclass(type, py_compile.PyCompileError): 145 print ("Problem with", repr(value))143 print "Problem with", repr(value) 146 144 raise type, value, tb 147 145 return 1 -
src/sas/sasgui/perspectives/pr/pr.py
ra1b8fee r7432acb 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_function18 17 19 18 import sys … … 231 230 out, cov = pr.pr_fit() 232 231 for i in range(len(out)): 233 print ("%g +- %g" % (out[i], math.sqrt(cov[i][i])))232 print "%g +- %g" % (out[i], math.sqrt(cov[i][i])) 234 233 235 234 # Show input P(r) … … 319 318 except: 320 319 err[i] = 1.0 321 print ("Error getting error", value, x[i])320 print "Error getting error", value, x[i] 322 321 323 322 new_plot = Data1D(x, y) -
src/sas/sasgui/perspectives/simulation/ShapeParameters.py
ra1b8fee rd85c194 8 8 copyright 2009, University of Tennessee 9 9 """ 10 from __future__ import print_function11 12 10 import wx 13 11 import sys … … 314 312 self.parent.GetSizer().Layout() 315 313 except: 316 print ("TODO: move the Layout call of editShape up to the caller")314 print "TODO: move the Layout call of editShape up to the caller" 317 315 318 316 def _readCtrlFloat(self, ctrl): … … 394 392 self.current_shape.params[item[0]] = tmp 395 393 except: 396 print ("Could not create")397 print (sys.exc_value)394 print "Could not create" 395 print sys.exc_value 398 396 399 397 def _onCreate(self, evt): … … 487 485 indices = self.shape_listbox.GetSelections() 488 486 if len(indices)>0: 489 print ("NOT YET IMPLMENTED")490 print ("renaming", self.shape_listbox.GetString(indices[0]))491 487 print "NOT YET IMPLMENTED" 488 print "renaming", self.shape_listbox.GetString(indices[0]) 489 -
src/sas/sasgui/plottools/PlotPanel.py
ra1b8fee r7432acb 2 2 Plot panel. 3 3 """ 4 from __future__ import print_function5 6 4 import logging 7 5 import traceback … … 40 38 def show_tree(obj, d=0): 41 39 """Handy function for displaying a tree of graph objects""" 42 print ("%s%s" % ("-"*d, obj.__class__.__name__))40 print "%s%s" % ("-"*d, obj.__class__.__name__) 43 41 if 'get_children' in dir(obj): 44 42 for a in obj.get_children(): show_tree(a, d + 1) … … 2016 2014 self.toolbar.copy_figure(self.canvas) 2017 2015 except: 2018 print ("Error in copy Image")2016 print "Error in copy Image" 2019 2017 2020 2018 -
src/sas/sasgui/plottools/binder.py
ra1b8fee r463e7ffc 2 2 Extension to MPL to support the binding of artists to key/mouse events. 3 3 """ 4 from __future__ import print_function5 6 4 import sys 7 5 import logging … … 65 63 ] 66 64 except: 67 print ("bypassing scroll_event: wrong matplotlib version")65 print "bypassing scroll_event: wrong matplotlib version" 68 66 self._connections = [ 69 67 canvas.mpl_connect('motion_notify_event', self._onMotion), -
src/sas/sasgui/plottools/convert_units.py
ra1b8fee r959eb01 3 3 This is a cleaned up version of unitConverter.py 4 4 """ 5 from __future__ import print_function6 7 5 import re 8 6 import string … … 70 68 unit8 = "m/s^{4}" # x^2 (m/s^{4})^{2} 71 69 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)))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)) -
src/sas/sasgui/plottools/fittings.py
ra1b8fee rac07a3a 14 14 15 15 """ 16 from __future__ import print_function17 18 16 from scipy import optimize 19 17 … … 108 106 chisqr, out, cov = sasfit(line, [cstA, cstB], event.x, y, 0) 109 107 # print "Output parameters:", out 110 print ("The right answer is [70.0, 1.0]")111 print (chisqr, out, cov)108 print "The right answer is [70.0, 1.0]" 109 print chisqr, out, cov -
src/sas/sasgui/plottools/plottable_interactor.py
ra1b8fee r45dffa69 2 2 This module allows more interaction with the plot 3 3 """ 4 from __future__ import print_function5 6 4 from BaseInteractor import _BaseInteractor 7 8 5 9 6 class PointInteractor(_BaseInteractor): … … 159 156 160 157 def clear(self): 161 print ("plottable_interactor.clear()")158 print "plottable_interactor.clear()" 162 159 163 160 def _on_click(self, evt): -
test/fileconverter/test/utest_nxcansas_writer.py
r17c9436 rc476457 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
raaf5e49 rac07a3a 6 6 # Disable "too many methods" complaint 7 7 # pylint: disable-msg=R0904 8 from __future__ import print_function 9 10 11 import os 12 import unittest 13 import math 14 import numpy 8 9 10 import unittest, math, numpy 15 11 from sas.sascalc.pr.invertor import Invertor 16 17 12 18 13 class TestFiguresOfMerit(unittest.TestCase): 19 14 … … 240 235 self.assertTrue(chi2/51.0<10.0) 241 236 except: 242 print ("chi2 =", chi2/51.0)237 print "chi2 =", chi2/51.0 243 238 raise 244 239 … … 268 263 self.assertTrue(self.invertor.chi2/len(x)<200.00) 269 264 except: 270 print ("Chi2(I(q)) =", self.invertor.chi2/len(x))265 print "Chi2(I(q)) =", self.invertor.chi2/len(x) 271 266 raise 272 267 … … 302 297 self.assertTrue(chi2/51.0<50.0) 303 298 except: 304 print ("chi2(P(r)) =", chi2/51.0)299 print "chi2(P(r)) =", chi2/51.0 305 300 raise 306 301 … … 346 341 self.assertTrue(self.invertor.chi2>0) 347 342 except: 348 print ("Chi2 =", self.invertor.chi2)343 print "Chi2 =", self.invertor.chi2 349 344 raise 350 345 … … 370 365 self.assertTrue(self.invertor.chi2>0) 371 366 except: 372 print ("Chi2 =", self.invertor.chi2)367 print "Chi2 =", self.invertor.chi2 373 368 raise 374 369 … … 421 416 422 417 # Save 423 f_name = "test_output.txt" 424 self.invertor.to_file(f_name) 418 self.invertor.to_file("test_output.txt") 425 419 426 420 # Load 427 self.invertor.from_file( f_name)421 self.invertor.from_file("test_output.txt") 428 422 self.assertEqual(self.invertor.d_max, 160.0) 429 423 self.assertEqual(self.invertor.alpha, 0.0007) 430 424 self.assertEqual(self.invertor.chi2, 836.797) 431 425 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)434 426 435 427 def test_qmin(self): -
test/run_one.py
raaf5e49 raaad4c95 1 1 #!/usr/bin/env python 2 from __future__ import print_function3 2 4 3 import os … … 25 24 #print "\n".join(sys.path) 26 25 test_path,test_file = splitpath(abspath(sys.argv[1])) 27 print ("=== testing:",sys.argv[1])26 print "=== testing:",sys.argv[1] 28 27 #print test_path, test_file 29 28 sys.argv = [sys.argv[0]] -
test/sasdataloader/plugins/test_reader.py
raaf5e49 r959eb01 8 8 copyright 2008, University of Tennessee 9 9 """ 10 from __future__ import print_function11 12 10 import os 13 11 import numpy as np … … 61 59 reader = Reader() 62 60 output = reader.read("../test/test_data.test") 63 print (output.x)61 print output.x 64 62 65 63 -
test/sasdataloader/test/sequence_tests.py
raaf5e49 r959eb01 1 from __future__ import print_function2 3 1 from DataLoader.loader import Loader 4 2 from DataLoader.readers.IgorReader import Reader as igor_reader … … 10 8 out2 = Loader().load("MAR07232_rest.ASC") 11 9 if len(out2.detector)>1: 12 print ("Consecutive reads using Loader failed")10 print "Consecutive reads using Loader failed" 13 11 14 12 def consecutive_reader(): … … 16 14 out2 = igor_reader().read("MAR07232_rest.ASC") 17 15 if len(out2.detector)>1: 18 print ("Consecutive reads using Readers failed")19 print (out1)20 print (out2)16 print "Consecutive reads using Readers failed" 17 print out1 18 print out2 21 19 22 20 def single_abs(): … … 31 29 single_igor() 32 30 single_abs() 33 print ("Test passed")31 print "Test passed" -
test/sasdataloader/test/testplugings.py
r17c9436 r959eb01 3 3 """ 4 4 5 import os6 5 import unittest 7 6 from sas.sascalc.dataloader.loader import Loader, Registry … … 42 41 # Create module 43 42 import zipfile 44 f_name = "plugins.zip" 45 z = zipfile.PyZipFile(f_name, 'w') 43 z = zipfile.PyZipFile("plugins.zip", 'w') 46 44 z.writepy("../plugins", "") 47 45 z.close() 48 if os.path.isfile(f_name):49 os.remove(f_name)50 46 51 47 def testplugin_checksetup(self): -
test/sasdataloader/test/utest_abs_reader.py
rc551bb3 rdd11014 2 2 Unit tests for data manipulations 3 3 """ 4 from __future__ import print_function5 4 6 5 import unittest … … 9 8 from sas.sascalc.dataloader.loader import Loader 10 9 from sas.sascalc.dataloader.readers.IgorReader import Reader as IgorReader 11 from sas.sascalc.dataloader.readers.abs_reader import Reader as AbsReader12 from sas.sascalc.dataloader.readers.hfir1d_reader import Reader as HFIRReader13 from sas.sascalc.dataloader.readers.danse_reader import Reader as DANSEReader14 from sas.sascalc.dataloader.readers.cansas_reader import Reader as CANSASReader15 16 10 from sas.sascalc.dataloader.data_info import Data1D 17 11 18 12 import os.path 19 13 20 21 14 class abs_reader(unittest.TestCase): 22 15 23 16 def setUp(self): 24 reader = AbsReader()25 self.data = reader.read("jan08002.ABS")26 17 from sas.sascalc.dataloader.readers.abs_reader import Reader 18 self.data = Reader().read("jan08002.ABS") 19 27 20 def test_abs_checkdata(self): 28 21 """ … … 68 61 def test_checkdata2(self): 69 62 self.assertEqual(self.data.dy[126], 1) 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 63 77 64 class hfir_reader(unittest.TestCase): 78 65 79 66 def setUp(self): 80 reader = HFIRReader() 81 self.data = reader.read("S2-30dq.d1d") 82 67 self.data = Loader().load("S2-30dq.d1d") 68 83 69 def test_hfir_checkdata(self): 84 70 """ … … 97 83 self.assertEqual(self.data.dy[1], 0.000315) 98 84 self.assertEqual(self.data.dx[1], 0.008249) 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 85 105 86 106 87 class igor_reader(unittest.TestCase): … … 156 137 157 138 def setUp(self): 158 reader = DANSEReader() 159 self.data = reader.read("MP_New.sans") 139 self.data = Loader().load("MP_New.sans") 160 140 161 141 def test_checkdata(self): … … 191 171 self.assertEqual(self.data.err_data[2], 2.06313) 192 172 193 def test_generic_loader(self):194 # the generic loader should work as well195 data = Loader().load("MP_New.sans")196 self.assertEqual(data.meta_data['loader'], "DANSE")197 198 173 199 174 class cansas_reader(unittest.TestCase): 200 175 201 176 def setUp(self): 202 reader = CANSASReader() 203 data = reader.read("cansas1d.xml") 177 data = Loader().load("cansas1d.xml") 204 178 self.data = data[0] 205 206 def test_generic_loader(self): 207 # the generic loader should work as well 208 data = Loader().load("cansas1d.xml") 209 self.assertEqual(data[0].meta_data['loader'], "CanSAS XML 1D") 210 179 211 180 def test_cansas_checkdata(self): 212 181 self.assertEqual(self.data.filename, "cansas1d.xml") … … 221 190 tests won't pass 222 191 """ 192 223 193 self.assertEqual(self.data.run[0], "1234") 224 194 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") … … 294 264 self.assertEqual(item.distance_unit,'mm') 295 265 296 if item.size.x ==50 \297 and item.distance ==11000.0 \298 and item.name =='source' \299 and item.type =='radius':266 if item.size.x==50 \ 267 and item.distance==11000.0 \ 268 and item.name=='source' \ 269 and item.type=='radius': 300 270 _found1 = True 301 elif item.size.x ==1.0 \302 and item.name =='sample' \303 and item.type =='radius':271 elif item.size.x==1.0 \ 272 and item.name=='sample' \ 273 and item.type=='radius': 304 274 _found2 = True 305 275 306 if _found1 == False or _found2 ==False:276 if _found1==False or _found2==False: 307 277 raise RuntimeError, "Could not find all data %s %s" % (_found1, _found2) 308 278 … … 339 309 self.assertTrue(item.date in ['04-Sep-2007 18:35:02', 340 310 '03-SEP-2006 11:42:47']) 341 print (item.term)311 print item.term 342 312 for t in item.term: 343 if (t['name'] == "ABS:DSTAND"344 and t['unit'] == 'mm'345 and float(t['value']) == 1.0):313 if t['name']=="ABS:DSTAND" \ 314 and t['unit']=='mm' \ 315 and float(t['value'])==1.0: 346 316 _found_term2 = True 347 elif (t['name'] == "radialstep"348 and t['unit'] == 'mm'349 and float(t['value']) == 10.0):317 elif t['name']=="radialstep" \ 318 and t['unit']=='mm' \ 319 and float(t['value'])==10.0: 350 320 _found_term1 = True 351 321 352 if _found_term1 == False or _found_term2 == False: 353 raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 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 354 327 355 328 def test_writer(self): 356 r = CANSASReader() 357 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 358 335 filename = "write_test.xml" 359 336 r.write(filename, self.data) … … 362 339 self.assertEqual(self.data.filename, filename) 363 340 self._checkdata() 364 if os.path.isfile(filename):365 os.remove(filename)366 341 367 342 def test_units(self): … … 371 346 """ 372 347 filename = "cansas1d_units.xml" 373 data = CANSASReader().read(filename)348 data = Loader().load(filename) 374 349 self.data = data[0] 375 350 self.assertEqual(self.data.filename, filename) … … 382 357 """ 383 358 filename = "cansas1d_badunits.xml" 384 data = CANSASReader().read(filename)359 data = Loader().load(filename) 385 360 self.data = data[0] 386 361 self.assertEqual(self.data.filename, filename) … … 391 366 392 367 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 393 print (self.data.errors)368 print self.data.errors 394 369 self.assertEqual(len(self.data.errors), 1) 395 370 371 396 372 def test_slits(self): 397 373 """ … … 399 375 """ 400 376 filename = "cansas1d_slit.xml" 401 data = CANSASReader().read(filename)377 data = Loader().load(filename) 402 378 self.data = data[0] 403 379 self.assertEqual(self.data.filename, filename) … … 421 397 self.assertEqual(self.data.run_name['1234'], 'run name') 422 398 self.assertEqual(self.data.title, "Test title") 423 399 400 424 401 425 402 if __name__ == '__main__': -
test/sasdataloader/test/utest_cansas.py
r1fc50fb2 r7432acb 46 46 self.schema_1_0 = "cansas1d_v1_0.xsd" 47 47 self.schema_1_1 = "cansas1d_v1_1.xsd" 48 self.write_1_0_filename = "isis_1_0_write_test.xml" 49 self.write_1_1_filename = "isis_1_1_write_test.xml" 48 50 49 51 50 def get_number_of_entries(self, dictionary, name, i): … … 57 56 return name 58 57 58 59 59 def test_invalid_xml(self): 60 60 """ … … 62 62 """ 63 63 invalid = StringIO.StringIO('<a><c></b></a>') 64 XMLreader(invalid) 64 reader = XMLreader(invalid) 65 65 66 66 67 def test_xml_validate(self): … … 81 82 self.assertFalse(xmlschema.validate(invalid)) 82 83 84 83 85 def test_real_xml(self): 84 86 reader = XMLreader(self.xml_valid, self.schema_1_0) … … 88 90 else: 89 91 self.assertFalse(valid) 92 90 93 91 94 def _check_data(self, data): … … 102 105 self.assertTrue(data.meta_data["xmlpreprocess"] is not None) 103 106 107 104 108 def _check_data_1_1(self, data): 105 109 spectrum = data.trans_spectrum[0] 106 110 self.assertTrue(len(spectrum.wavelength) == 138) 107 111 112 108 113 def test_cansas_xml(self): 114 filename = "isis_1_1_write_test.xml" 109 115 xmlreader = XMLreader(self.isis_1_1, self.schema_1_1) 110 116 valid = xmlreader.validate_xml() 111 117 xmlreader.set_processing_instructions() 112 118 self.assertTrue(valid) 119 fo = open(self.isis_1_1) 120 str = fo.read() 113 121 reader_generic = Loader() 114 122 dataloader = reader_generic.load(self.isis_1_1) … … 120 128 self._check_data(cansasreader[i]) 121 129 self._check_data_1_1(cansasreader[i]) 122 reader_generic.save(self.write_1_1_filename, dataloader[i], None) 130 reader_generic.save(filename, dataloader[i], None) 131 fo = open(filename) 132 str = fo.read() 123 133 reader2 = Loader() 124 self.assertTrue(os.path.isfile(self.write_1_1_filename)) 125 return_data = reader2.load(self.write_1_1_filename) 134 return_data = reader2.load(filename) 126 135 written_data = return_data[0] 127 136 self._check_data(written_data) 128 if os.path.isfile(self.write_1_1_filename): 129 os.remove(self.write_1_1_filename) 137 130 138 131 139 def test_double_trans_spectra(self): … … 136 144 for item in data: 137 145 self._check_data(item) 146 138 147 139 148 def test_entry_name_recurse(self): … … 146 155 self.assertTrue(len(d) == 6) 147 156 157 148 158 def test_load_cansas_file(self): 159 valid = [] 149 160 reader1 = XMLreader(self.xml_valid, self.schema_1_0) 150 161 self.assertTrue(reader1.validate_xml()) … … 162 173 self.assertFalse(reader7.validate_xml()) 163 174 175 164 176 def test_invalid_cansas(self): 165 177 list = self.loader.load(self.cansas1d_notitle) … … 172 184 self.assertTrue(data.detector[0].distance == 4150) 173 185 186 174 187 def test_old_cansas_files(self): 175 188 reader1 = XMLreader(self.cansas1d, self.schema_1_0) 176 189 self.assertTrue(reader1.validate_xml()) 177 190 file_loader = Loader() 178 file _loader.load(self.cansas1d)191 file1 = file_loader.load(self.cansas1d) 179 192 reader2 = XMLreader(self.cansas1d_units, self.schema_1_0) 180 193 self.assertTrue(reader2.validate_xml()) … … 184 197 self.assertTrue(reader4.validate_xml()) 185 198 199 186 200 def test_save_cansas_v1_0(self): 201 filename = "isis_1_0_write_test.xml" 187 202 xmlreader = XMLreader(self.isis_1_0, self.schema_1_0) 188 203 valid = xmlreader.validate_xml() … … 195 210 self._check_data(dataloader[i]) 196 211 self._check_data(cansasreader[i]) 197 reader_generic.save( self.write_1_0_filename, dataloader[i], None)212 reader_generic.save(filename, dataloader[i], None) 198 213 reader2 = Reader() 199 self.assertTrue(os.path.isfile(self.write_1_0_filename)) 200 return_data = reader2.read(self.write_1_0_filename) 214 return_data = reader2.read(filename) 201 215 written_data = return_data[0] 202 XMLreader(self.write_1_0_filename, self.schema_1_0)216 xmlwrite = XMLreader(filename, self.schema_1_0) 203 217 valid = xmlreader.validate_xml() 204 218 self.assertTrue(valid) 205 219 self._check_data(written_data) 206 if os.path.isfile(self.write_1_0_filename): 207 os.remove(self.write_1_0_filename) 220 208 221 209 222 def test_processing_instructions(self): … … 211 224 valid = reader.validate_xml() 212 225 if valid: 213 # find the processing instructions and make into a dictionary226 ## find the processing instructions and make into a dictionary 214 227 dic = self.get_processing_instructions(reader) 215 228 self.assertTrue(dic == {'xml-stylesheet': \ … … 219 232 xmldoc = minidom.parseString(xml) 220 233 221 # take the processing instructions and put them back in234 ## take the processing instructions and put them back in 222 235 xmldoc = self.set_processing_instructions(xmldoc, dic) 223 xmldoc.toprettyxml() 236 xml_output = xmldoc.toprettyxml() 237 224 238 225 239 def set_processing_instructions(self, minidom_object, dic): … … 229 243 minidom_object.insertBefore(pi, xmlroot) 230 244 return minidom_object 245 231 246 232 247 def get_processing_instructions(self, xml_reader_object): -
test/sasrealspace/test/early_test.py
raaf5e49 r959eb01 1 from __future__ import print_function2 1 3 2 import VolumeCanvas … … 31 30 t_0 = time.time() 32 31 value_1 = 1.0e8*canvas.getIq(0.1) 33 print ("density = 0.1: output=%g time=%g" % (value_1, time.time()-t_0))32 print "density = 0.1: output=%g time=%g" % (value_1, time.time()-t_0) 34 33 35 34 t_0 = time.time() 36 35 canvas.setParam('lores_density', 1) 37 36 value_1 = 1.0e8*canvas.getIq(0.1) 38 print ("density = 1000: output=%g time=%g" % (value_1, time.time()-t_0))37 print "density = 1000: output=%g time=%g" % (value_1, time.time()-t_0) 39 38 40 39 t_0 = time.time() 41 40 canvas.setParam('lores_density', 0.01) 42 41 value_1 = 1.0e8*canvas.getIq(0.1) 43 print ("density = 0.00001: output=%g time=%g" % (value_1, time.time()-t_0))44 print ()42 print "density = 0.00001: output=%g time=%g" % (value_1, time.time()-t_0) 43 print 45 44 46 45 … … 64 63 #ana_1 = form_factor(q, radius) 65 64 66 print ("q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1))65 print "q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1) 67 66 68 67 def test_2(): … … 74 73 shell_vol = 4.0/3.0*math.pi*outer_radius*outer_radius*outer_radius - core_vol 75 74 shell_sld = -1.0*core_vol/shell_vol 76 print ("Shell SLD", shell_sld)75 print "Shell SLD", shell_sld 77 76 78 77 … … 127 126 ana_1 = sphere.run(q) 128 127 129 print ("q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1))128 print "q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1) 130 129 out.write( "%g %g %g\n" % (q, sim_1, ana_1)) 131 130 … … 169 168 #ana_1 = form_factor(q, radius) 170 169 171 print ("q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1))170 print "q=%g sim=%g ana=%g ratio=%g" % (q, sim_1, ana_1, sim_1/ana_1) 172 171 173 172 def test_5(): … … 194 193 ana = ana.runXY([0.1, 0.1]) 195 194 sim = model.getIq2D(0.1, 0.1) 196 print (ana, sim, sim/ana, ana/sim)195 print ana, sim, sim/ana, ana/sim 197 196 198 197 def test_6(): … … 233 232 234 233 235 print (model.npts)234 print model.npts 236 235 for i in range(40): 237 236 qmax = 0.5 … … 241 240 anaY = ana.runXY([0, qmax*i/40.0]) 242 241 simY = model.getIq2D(0, qmax*i/40.0) 243 print (anaX, simX, simX/anaX, '|', anaY, simY, simY/anaY)242 print anaX, simX, simX/anaX, '|', anaY, simY, simY/anaY 244 243 245 244 def test_7(): 246 245 from sas.models.CoreShellModel import CoreShellModel 247 print ("Testing core-shell")246 print "Testing core-shell" 248 247 radius = 15 249 248 thickness = 5 … … 288 287 ana_val = ana.runXY([q, 0.2]) 289 288 sim_val, err = canvas.getIq2DError(q, 0.2) 290 print (ana_val, sim_val, sim_val/ana_val, err, (sim_val-ana_val)/err)289 print ana_val, sim_val, sim_val/ana_val, err, (sim_val-ana_val)/err 291 290 292 291 -
test/sasrealspace/test/sim_validation.py
raaf5e49 rac07a3a 5 5 @license: This software is provided as part of the DANSE project 6 6 """ 7 from __future__ import print_function8 9 7 import math, time, pylab 10 8 11 9 try: 12 10 import VolumeCanvas 13 print ("Testing local version")11 print "Testing local version" 14 12 except: 15 print ("Testing installed version")13 print "Testing installed version" 16 14 import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas 17 15 … … 252 250 ana = validator.run_ana(q) 253 251 sim, err = validator.run_sim(q) 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)) )252 print "q=%-g ana=%-g sim=%-g err=%-g diff=%-g (%-g) %s" % (q, ana, sim, err, 253 (sim-ana), sim/ana, str(math.fabs(sim-ana)>err)) 256 254 output.write("%g %g %g %g\n" % (q, ana, sim, err)) 257 255 output.close() … … 280 278 ana = validator.run_ana2D(q*math.cos(phi), q*math.sin(phi)) 281 279 sim, err = validator.run_sim2D(q*math.cos(phi), q*math.sin(phi)) 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)) )280 print "q=%-g ana=%-g sim=%-g err=%-g diff=%-g (%-g) %s" % (q, ana, sim, err, 281 (sim-ana), sim/ana, str(math.fabs(sim-ana)>err)) 284 282 output.write("%g %g %g %g\n" % (q, ana, sim, err)) 285 print ("Time elapsed: ", time.time()-t_0)283 print "Time elapsed: ", time.time()-t_0 286 284 output.close() 287 285 … … 308 306 for d in d_list: 309 307 sim, err = validator.run_sim(q, density=d) 310 print ("d=%-g ana=%-g sim=%-g err=%-g diff=%-g (%g) %s" % \308 print "d=%-g ana=%-g sim=%-g err=%-g diff=%-g (%g) %s" % \ 311 309 (d, ana, sim, err, (sim-ana), (sim-ana)/ana, 312 str(math.fabs(sim-ana)>err)) )310 str(math.fabs(sim-ana)>err)) 313 311 output.write("%g %g %g %g \n" % (d, ana, sim, err)) 314 312 output.close() -
test/sasrealspace/test/utest_oriented.py
raaf5e49 r959eb01 3 3 @copyright: University of Tennessee, for the DANSE project 4 4 """ 5 from __future__ import print_function6 5 7 6 import unittest, math, sys … … 17 16 try: 18 17 import VolumeCanvas 19 print ("Testing local version")18 print "Testing local version" 20 19 except: 21 print (sys.exc_value)20 print sys.exc_value 22 21 #testing the version that is working on 23 print ("Testing installed version")22 print "Testing installed version" 24 23 import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas 25 24 … … 242 241 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 243 242 except: 244 print ("Error", ana_val, sim_val, sim_val/ana_val)243 print "Error", ana_val, sim_val, sim_val/ana_val 245 244 raise sys.exc_type, sys.exc_value 246 245 … … 396 395 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 397 396 except: 398 print ("Error", ana_val, sim_val, sim_val/ana_val)397 print "Error", ana_val, sim_val, sim_val/ana_val 399 398 raise sys.exc_type, sys.exc_value 400 399 … … 408 407 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 409 408 except: 410 print ("Error", ana_val, sim_val, sim_val/ana_val)409 print "Error", ana_val, sim_val, sim_val/ana_val 411 410 raise sys.exc_type, sys.exc_value 412 411 … … 420 419 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 421 420 except: 422 print ("Error", ana_val, sim_val, sim_val/ana_val)421 print "Error", ana_val, sim_val, sim_val/ana_val 423 422 raise sys.exc_type, sys.exc_value 424 423 … … 432 431 self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 ) 433 432 except: 434 print ("Error", ana_val, sim_val, sim_val/ana_val)433 print "Error", ana_val, sim_val, sim_val/ana_val 435 434 raise sys.exc_type, sys.exc_value 436 435 -
test/sasrealspace/test/utest_realspace.py
raaf5e49 r45dffa69 3 3 @author: Mathieu Doucet / UTK 4 4 """ 5 from __future__ import print_function6 5 7 6 import unittest, math, time … … 16 15 try: 17 16 import VolumeCanvas 18 print ("Testing local version")17 print "Testing local version" 19 18 except: 20 19 import sys 21 print (sys.exc_value)20 print sys.exc_value 22 21 #testing the version that is working on 23 print ("Testing installed version")22 print "Testing installed version" 24 23 import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas 25 24 -
test/utest_sasview.py
raaf5e49 r959eb01 1 1 #!/usr/bin/env python 2 from __future__ import print_function3 4 2 import os 5 3 import subprocess … … 82 80 if has_failed: 83 81 failed += 1 84 print ("Result for %s (%s): FAILED" % (module_name, module_dir))85 print (std_out)82 print "Result for %s (%s): FAILED" % (module_name, module_dir) 83 print std_out 86 84 else: 87 85 passed += 1 88 print ("Result for %s: SUCCESS" % module_name)86 print "Result for %s: SUCCESS" % module_name 89 87 90 print ("\n----------------------------------------------")88 print "\n----------------------------------------------" 91 89 if n_tests == 0: 92 print ("No tests.")90 print "No tests." 93 91 else: 94 print ("Results by test modules:")95 print (" PASSED: %d" % passed)92 print "Results by test modules:" 93 print " PASSED: %d" % passed 96 94 ratio = 100.0*failed/(failed+passed) 97 print (" FAILED: %d (%.0f%%)" % (failed,ratio))95 print " FAILED: %d (%.0f%%)" % (failed,ratio) 98 96 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 ("----------------------------------------------")97 print "Results by tests:" 98 print " Tests run: %d" % n_tests 99 print " Tests failed: %d" % n_failures 100 print " Test errors: %d" % n_errors 101 print "----------------------------------------------" 104 102 105 103 return failed
Note: See TracChangeset
for help on using the changeset viewer.