- Timestamp:
- May 2, 2017 8:07:09 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 6fab3a0
- Parents:
- a9f9ca4 (diff), 658dd57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 3 added
- 51 edited
Legend:
- Unmodified
- Added
- Removed
-
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
r49165488 r2f22db9 77 77 # clean all these module variables and put them into a config class 78 78 # that can be passed by sasview.py. 79 logger. info(sys.executable)80 logger. info(str(sys.argv))79 logger.debug(sys.executable) 80 logger.debug(str(sys.argv)) 81 81 from sas import sasview as sasview 82 82 app_path = os.path.dirname(sasview.__file__) 83 logger. info("Using application path: %s", app_path)83 logger.debug("Using application path: %s", app_path) 84 84 return app_path 85 85 … … 109 109 if fObj is not None: 110 110 fObj.close() 111 logger. info("GuiManager loaded %s/%s" % (path, file))111 logger.debug("GuiManager loaded %s/%s" % (path, file)) 112 112 return config_module 113 113 … … 126 126 # Didn't find local config, load the default 127 127 import sas.sasgui.guiframe.config as config 128 logger. info("using default local_config")128 logger.debug("using default local_config") 129 129 else: 130 logger. info("found local_config in %s" % os.getcwd())130 logger.debug("found local_config in %s" % os.getcwd()) 131 131 else: 132 logger. info("found local_config in %s" % PATH_APP)132 logger.debug("found local_config in %s" % PATH_APP) 133 133 134 134 from sas.sasgui.guiframe.customdir import SetupCustom … … 139 139 if custom_config is None: 140 140 msgConfig = "Custom_config file was not imported" 141 logger. info(msgConfig)141 logger.debug(msgConfig) 142 142 else: 143 logger. info("using custom_config in %s" % os.getcwd())143 logger.debug("using custom_config in %s" % os.getcwd()) 144 144 else: 145 logger. info("using custom_config from %s" % c_conf_dir)145 logger.debug("using custom_config from %s" % c_conf_dir) 146 146 147 147 # read some constants from config … … 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) … … 2156 2157 if response is not None: 2157 2158 try: 2158 #2159 2159 content = response.read().strip() 2160 logger.info("Connected to www.sasview.org. Latest version: %s" 2161 % (content)) 2160 logger.info("Connected to www.sasview.org. Latest version: %s", content) 2162 2161 version_info = json.loads(content) 2163 2162 except: -
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/calculator/sld_panel.py
r7432acb r2d220dd 60 60 # Object that receive status event 61 61 self.base = base 62 self.wavelength = WAVELENGTH 62 self.neutron_wavelength = WAVELENGTH 63 self.xray_source_input = WAVELENGTH 63 64 self.parent = parent 64 65 #layout attribute … … 67 68 self.compound = "" 68 69 self.density = "" 69 self.wavelength_ctl = None 70 self.neutron_wavelength_ctl = None 71 self.xray_source_input_ctl = None 72 self.xray_cbox = None 70 73 self.neutron_sld_real_ctl = None 71 74 self.neutron_sld_im_ctl = None 72 self.mo_ka_sld_real_ctl = None 73 self.mo_ka_sld_im_ctl = None 74 self.cu_ka_sld_real_ctl = None 75 self.cu_ka_sld_im_ctl = None 75 self.xray_sld_real_ctl = None 76 self.xray_sld_im_ctl = None 76 77 self.neutron_abs_ctl = None 77 78 self.neutron_inc_ctl = None 78 79 self.neutron_length_ctl = None 79 80 self.button_calculate = None 81 self.xray_source = None 80 82 #Draw the panel 81 83 self._do_layout() 82 84 self.SetAutoLayout(True) 83 85 self.Layout() 86 self.fill_xray_cbox() 84 87 85 88 def _do_layout(self): … … 108 111 self.density_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 109 112 unit_density_txt = wx.StaticText(self, -1, unit_density) 110 wavelength_txt = wx.StaticText(self, -1, 'Wavelength ') 111 self.wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 112 self.wavelength_ctl.SetValue(str(self.wavelength)) 113 unit_a_txt = wx.StaticText(self, -1, unit_a) 113 neutron_wavelength_txt = wx.StaticText(self, -1, 'Neutron wavelength') 114 self.neutron_wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 115 self.neutron_wavelength_ctl.SetValue(str(self.neutron_wavelength)) 116 self.xray_source_input_txt = wx.StaticText(self, -1, 'X-ray wavelength') 117 self.xray_source_input_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 118 self.xray_source_input_ctl.SetValue(str(self.xray_source_input)) 119 neutron_unit_a_txt = wx.StaticText(self, -1, unit_a) 120 121 self.xray_cbox = wx.ComboBox(self, -1, size=(70, 20), style=wx.CB_READONLY) 122 xray_cbox_tip = "Select an element, wavelength or energy" 123 self.xray_cbox.SetToolTipString(xray_cbox_tip) 124 wx.EVT_COMBOBOX(self.xray_cbox, -1, self.on_select_xray) 125 114 126 iy = 0 115 127 ix = 0 … … 131 143 iy += 1 132 144 ix = 0 133 sizer_input.Add(wavelength_txt, (iy, ix), (1, 1), 134 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 135 ix += 1 136 sizer_input.Add(self.wavelength_ctl, (iy, ix), (1, 1), 137 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 138 ix += 1 139 sizer_input.Add(unit_a_txt, (iy, ix), (1, 1), 145 sizer_input.Add(neutron_wavelength_txt, (iy, ix), (1, 1), 146 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 147 ix += 1 148 sizer_input.Add(self.neutron_wavelength_ctl, (iy, ix), (1, 1), 149 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 150 ix += 1 151 sizer_input.Add(neutron_unit_a_txt, (iy, ix), (1, 1), 152 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 153 iy += 1 154 ix = 0 155 sizer_input.Add(self.xray_source_input_txt, (iy, ix), (1, 1), 156 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 157 ix += 1 158 sizer_input.Add(self.xray_source_input_ctl, (iy, ix), (1, 1), 159 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 160 ix += 1 161 sizer_input.Add(self.xray_cbox, (iy, ix), (1, 1), 140 162 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 141 163 boxsizer1.Add(sizer_input) … … 151 173 size=(_BOX_WIDTH, -1)) 152 174 self.neutron_sld_real_ctl.SetEditable(False) 153 self.neutron_sld_real_ctl.SetToolTipString("Neutron SLD real .")175 self.neutron_sld_real_ctl.SetToolTipString("Neutron SLD real") 154 176 self.neutron_sld_im_ctl = wx.TextCtrl(self, -1, 155 177 size=(_BOX_WIDTH, -1)) 156 178 self.neutron_sld_im_ctl.SetEditable(False) 157 self.neutron_sld_im_ctl.SetToolTipString("Neutron SLD imaginary .")179 self.neutron_sld_im_ctl.SetToolTipString("Neutron SLD imaginary") 158 180 neutron_sld_units_txt = wx.StaticText(self, -1, unit_sld) 159 181 160 cu_ka_sld_txt = wx.StaticText(self, -1, 'Cu KaSLD')161 self. cu_ka_sld_real_ctl = wx.TextCtrl(self, -1,182 xray_sld_txt = wx.StaticText(self, -1, 'X-ray SLD') 183 self.xray_sld_real_ctl = wx.TextCtrl(self, -1, 162 184 size=(_BOX_WIDTH, -1)) 163 self. cu_ka_sld_real_ctl.SetEditable(False)164 self. cu_ka_sld_real_ctl.SetToolTipString("Cu Ka SLD real.")165 self. cu_ka_sld_im_ctl = wx.TextCtrl(self, -1,185 self.xray_sld_real_ctl.SetEditable(False) 186 self.xray_sld_real_ctl.SetToolTipString("X-ray SLD real") 187 self.xray_sld_im_ctl = wx.TextCtrl(self, -1, 166 188 size=(_BOX_WIDTH, -1)) 167 self.cu_ka_sld_im_ctl.SetEditable(False) 168 self.cu_ka_sld_im_ctl.SetToolTipString("Cu Ka SLD imaginary.") 169 cu_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld) 170 171 mo_ka_sld_txt = wx.StaticText(self, -1, 'Mo Ka SLD') 172 self.mo_ka_sld_real_ctl = wx.TextCtrl(self, -1, 173 size=(_BOX_WIDTH, -1)) 174 self.mo_ka_sld_real_ctl.SetEditable(False) 175 self.mo_ka_sld_real_ctl.SetToolTipString("Mo Ka SLD real.") 176 self.mo_ka_sld_im_ctl = wx.TextCtrl(self, -1, 177 size=(_BOX_WIDTH, -1)) 178 self.mo_ka_sld_im_ctl.SetEditable(False) 179 self.mo_ka_sld_im_ctl.SetToolTipString("Mo Ka SLD imaginary.") 180 mo_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld) 189 self.xray_sld_im_ctl.SetEditable(False) 190 self.xray_sld_im_ctl.SetToolTipString("X-ray SLD imaginary") 191 xray_sld_units_txt = wx.StaticText(self, -1, unit_sld) 181 192 182 193 neutron_inc_txt = wx.StaticText(self, -1, 'Neutron Inc. Xs') … … 219 230 iy += 1 220 231 ix = 0 221 sizer_output.Add( cu_ka_sld_txt, (iy, ix), (1, 1),222 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 223 ix += 1 224 sizer_output.Add(self. cu_ka_sld_real_ctl, (iy, ix), (1, 1),232 sizer_output.Add(xray_sld_txt, (iy, ix), (1, 1), 233 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 234 ix += 1 235 sizer_output.Add(self.xray_sld_real_ctl, (iy, ix), (1, 1), 225 236 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 226 237 ix += 1 … … 228 239 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 229 240 ix += 1 230 sizer_output.Add(self. cu_ka_sld_im_ctl,241 sizer_output.Add(self.xray_sld_im_ctl, 231 242 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 232 243 ix += 1 233 sizer_output.Add(cu_ka_sld_units_txt, 234 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 235 iy += 1 236 ix = 0 237 sizer_output.Add(mo_ka_sld_txt, (iy, ix), (1, 1), 238 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 239 ix += 1 240 sizer_output.Add(self.mo_ka_sld_real_ctl, (iy, ix), (1, 1), 241 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 242 ix += 1 243 sizer_output.Add(wx.StaticText(self, -1, i_complex), 244 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 245 ix += 1 246 sizer_output.Add(self.mo_ka_sld_im_ctl, 247 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 248 ix += 1 249 sizer_output.Add(mo_ka_sld_units_txt, 244 sizer_output.Add(xray_sld_units_txt, 250 245 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 251 246 iy += 1 … … 310 305 self.SetSizer(vbox) 311 306 307 def fill_xray_cbox(self): 308 """ 309 fill the x-ray combobox with the sources 310 """ 311 source_list = ['[A]', '[keV]', 'Element'] 312 for source in source_list: 313 pos = self.xray_cbox.Append(str(source)) 314 self.xray_cbox.SetClientData(pos, str(source.strip())) 315 self.xray_cbox.SetSelection(0) 316 self.xray_source = source_list[0] 317 318 def on_select_xray(self, event=None): 319 """ 320 On Selecting a source 321 """ 322 item = event.GetEventObject() 323 self.xray_source = item.GetValue().strip() 324 325 if self.xray_source == "[A]": 326 self.xray_source_input_txt.SetLabel("X-ray wavelength") 327 elif self.xray_source == "[keV]": 328 self.xray_source_input_txt.SetLabel("X-ray energy") 329 elif self.xray_source == "Element": 330 self.xray_source_input_txt.SetLabel("X-ray source") 331 312 332 def on_help(self, event): 313 333 """ … … 363 383 msg += "Error for Density value :expect float" 364 384 365 self.wavelength = self.wavelength_ctl.GetValue() 366 if str(self.wavelength).lstrip().rstrip() == "": 367 self.wavelength = WAVELENGTH 368 self.wavelength_ctl.SetValue(str(WAVELENGTH)) 369 self.wavelength_ctl.SetBackgroundColour(wx.WHITE) 370 self.wavelength_ctl.Refresh() 385 self.neutron_wavelength = self.neutron_wavelength_ctl.GetValue() 386 self.xray_source_input = self.xray_source_input_ctl.GetValue() 387 388 if str(self.neutron_wavelength).lstrip().rstrip() == "": 389 self.neutron_wavelength = WAVELENGTH 390 self.neutron_wavelength_ctl.SetValue(str(WAVELENGTH)) 391 self.neutron_wavelength_ctl.SetBackgroundColour(wx.WHITE) 392 self.neutron_wavelength_ctl.Refresh() 371 393 msg += "Default value for wavelength is 6.0" 372 394 else: 373 if check_float(self. wavelength_ctl):374 self. wavelength = float(self.wavelength)395 if check_float(self.neutron_wavelength_ctl): 396 self.neutron_wavelength = float(self.neutron_wavelength) 375 397 else: 376 398 flag = False 377 399 msg += "Error for wavelength value :expect float" 400 401 if str(self.xray_source_input).lstrip().rstrip() == "": 402 self.xray_source_input = WAVELENGTH 403 self.xray_source_input_ctl.SetValue(str(WAVELENGTH)) 404 self.xray_source_input_ctl.SetBackgroundColour(wx.WHITE) 405 self.xray_source_input_ctl.Refresh() 406 msg += "Default value for wavelength is 6.0" 407 else: 408 if (self.xray_source == '[A]') or (self.xray_source == '[keV]'): 409 if check_float(self.xray_source_input_ctl): 410 self.xray_source_input = float(self.xray_source_input) 411 else: 412 flag = False 413 msg += "Error for wavelength value :expect float" 414 elif (self.xray_source == 'Element'): 415 try: 416 import periodictable 417 exec("periodictable." + self.xray_source_input) 418 except AttributeError: 419 flag = False 420 msg += "X-ray element supplied isn't in the database" 421 422 378 423 379 424 self.compound = self.compound_ctl.GetValue().lstrip().rstrip() … … 410 455 return xray_sld_from_atoms(atom, density=density, energy=energy) 411 456 412 413 457 def calculateSld(self, event): 414 458 """ … … 430 474 length = neutron_scattering(compound=self.compound, 431 475 density=self.density, 432 wavelength=self.wavelength) 433 cu_real, cu_im = self.calculate_sld_helper(element="Cu", 434 density=self.density, 435 molecule_formula=self.sld_formula) 436 mo_real, mo_im = self.calculate_sld_helper(element="Mo", 437 density=self.density, 438 molecule_formula=self.sld_formula) 476 wavelength=self.neutron_wavelength) 477 if self.xray_source == "[A]": 478 energy = xray_energy(self.xray_source_input) 479 xray_real, xray_im = xray_sld_from_atoms(self.sld_formula.atoms, 480 density=self.density, 481 energy=energy) 482 elif self.xray_source == "[keV]": 483 xray_real, xray_im = xray_sld_from_atoms(self.sld_formula.atoms, 484 density=self.density, 485 energy=self.xray_source_input) 486 elif self.xray_source == "Element": 487 xray_real, xray_im = self.calculate_sld_helper(element=self.xray_source_input, 488 density=self.density, 489 molecule_formula=self.sld_formula) 439 490 # set neutron sld values 440 491 val = format_number(sld_real * _SCALE) … … 443 494 self.neutron_sld_im_ctl.SetValue(val) 444 495 # Compute the Cu SLD 445 self.cu_ka_sld_real_ctl.SetValue(format_number(cu_real * _SCALE)) 446 val = format_number(math.fabs(cu_im) * _SCALE) 447 self.cu_ka_sld_im_ctl.SetValue(val) 448 # Compute the Mo SLD 449 self.mo_ka_sld_real_ctl.SetValue(format_number(mo_real * _SCALE)) 450 val = format_number(math.fabs(mo_im) * _SCALE) 451 self.mo_ka_sld_im_ctl.SetValue(val) 496 self.xray_sld_real_ctl.SetValue(format_number(xray_real * _SCALE)) 497 val = format_number(math.fabs(xray_im) * _SCALE) 498 self.xray_sld_im_ctl.SetValue(val) 452 499 # set incoherence and absorption 453 500 self.neutron_inc_ctl.SetValue(format_number(incoh)) … … 456 503 self.neutron_length_ctl.SetValue(format_number(length)) 457 504 # display wavelength 458 self.wavelength_ctl.SetValue(str(self.wavelength)) 505 #self.wavelength_ctl.SetValue(str(self.wavelength)) 506 #self.wavelength_ctl.SetValue(str(self.wavelength)) 459 507 except: 460 508 if self.base is not None: … … 470 518 self.neutron_sld_real_ctl.SetValue("") 471 519 self.neutron_sld_im_ctl.SetValue("") 472 self.mo_ka_sld_real_ctl.SetValue("") 473 self.mo_ka_sld_im_ctl.SetValue("") 474 self.cu_ka_sld_real_ctl.SetValue("") 475 self.cu_ka_sld_im_ctl.SetValue("") 520 self.xray_sld_real_ctl.SetValue("") 521 self.xray_sld_im_ctl.SetValue("") 476 522 self.neutron_abs_ctl.SetValue("") 477 523 self.neutron_inc_ctl.SetValue("") -
src/sas/sasgui/perspectives/fitting/basepage.py
r9c0f3c17 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
r7432acb 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, … … 2046 2048 res = (fn - gn) / en 2047 2049 except ValueError: 2048 print "Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))2050 print("Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))) 2049 2051 return 2050 2052 -
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): -
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r5295cf5 r9d93c37 636 636 637 637 Example: radius [2 : 5] , radius [10 : 25] 638 639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 640 641 .. note:: This help document was last changed by Steve King, 10Oct2016 638 639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 640 641 Combined Batch Fit Mode 642 ----------------------- 643 644 Batch mode does not allow for multiple models. In other words in batch mode 645 all the data sets must be fit with single model and set of parameter. At times 646 there may be a shape change occuring in the series that requires changing the 647 model part way through the series. In this case set up two batch fit pages 648 following the instructions in :ref:`Batch Fit Mode`. However *be careful!* each 649 time a batch fit panel runs fit it will overwrite the table of values. 650 651 However there may be occassion when one wants to run these two (or more) batch 652 fits and then plot one of the common parameters (e.g. radius of shere and 653 eventually cylinder). In this case the Combined Batch Fit can be used. 654 Similarly to the Simultaneous Fit page a new page will appear. In this case, 655 instead of a check box for each fitpage model there will be a check box for each 656 batchpage. Clicking the Fit button will run each batch fit *in sequence*. 657 658 .. image:: combine_batch_page.png 659 660 The batch table will then pop up at the end as before with the following 661 caveats: 662 663 .. note:: 664 The order matters. The parameters in the table will be taken from the model 665 used in the first batch page of the list. Any parameters from the 666 second and on batch pages that have the same name as a parameter in the first 667 will show up allowing for plotting of that parameter across the models. 668 .. note:: 669 a corralary of the above is that currently models created as a sum|multiply 670 model will not work as desired because the generated model parameters have a 671 p#_ appended to the beginning and thus radius and p1_radius will not be 672 recognized as the same parameter. 673 674 .. image:: combine_batch_grid.png 675 676 In this case the series is a time series. Unfortunately the time is not listed 677 in the file but the file name contains the information. A column can be added 678 manually, in this case called time. Clicking on the top of a column will select 679 it. Clicking next on the Add button next to the x or y row will add the cell 680 information to use in a plot. The axis labels will be automatically populated 681 from the top row information. Units can be specified as well using text and a 682 subset of in line Latex. Once this is set up, in this case using the peak 683 position from the two different models for the y axis and time on the x axis, 684 one clicks the Plot button. 685 686 .. image:: combine_batch_plot.png 687 688 Note the discontinuity in the peak position. This 689 is due to the fact that the Guassian fit is actually pretty bad and is not 690 actually finding the peak. 691 692 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 693 694 .. note:: This help document was last changed by Paul Butler, 06April2017 -
src/sas/sasgui/perspectives/fitting/simfitpage.py
r959eb01 ra9f9ca4 1 1 """ 2 Simultaneous fit page2 Simultaneous or Batch fit page 3 3 """ 4 # Note that this is used for both Simultaneous/Constrained fit AND for 5 # combined batch fit. This is done through setting of the batch_on parameter. 6 # There are the a half dozen or so places where an if statement is used as in 7 # if not batch_on: 8 # xxxx 9 # else: 10 # xxxx 11 # This is just wrong but dont have time to fix this go. Proper approach would be 12 # to strip all parts of the code that depend on batch_on and create the top 13 # level class from which a contrained/simultaneous fit page and a combined 14 # batch page inherit. 15 # 16 # 04/09/2017 --PDB 17 4 18 import sys 5 19 from collections import namedtuple … … 400 414 # General Help button 401 415 self.btHelp = wx.Button(self, wx.ID_HELP, 'HELP') 402 self.btHelp.SetToolTipString("Simultaneous/Constrained Fitting help.") 416 if self.batch_on: 417 self.btHelp.SetToolTipString("Combined Batch Fitting help.") 418 else: 419 self.btHelp.SetToolTipString("Simultaneous/Constrained Fitting help.") 403 420 self.btHelp.Bind(wx.EVT_BUTTON, self._on_help) 404 421 … … 527 544 """ 528 545 _TreeLocation = "user/sasgui/perspectives/fitting/fitting_help.html" 529 _PageAnchor = "#simultaneous-fit-mode" 530 _doc_viewer = DocumentationWindow(self, self.ID_DOC, _TreeLocation, 546 if not self.batch_on: 547 _PageAnchor = "#simultaneous-fit-mode" 548 _doc_viewer = DocumentationWindow(self, self.ID_DOC, _TreeLocation, 531 549 _PageAnchor, 532 550 "Simultaneous/Constrained Fitting Help") 551 else: 552 _PageAnchor = "#combined-batch-fit-mode" 553 _doc_viewer = DocumentationWindow(self, self.ID_DOC, _TreeLocation, 554 _PageAnchor, 555 "Combined Batch Fit Help") 533 556 534 557 def set_manager(self, manager):
Note: See TracChangeset
for help on using the changeset viewer.