Changeset 0cc77d8 in sasview for src/sas/sasgui/plottools
- Timestamp:
- May 1, 2017 3:00:53 PM (8 years ago)
- Children:
- 733cdcd
- Parents:
- b9d74f3 (diff), c00a797a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Paul Kienzle <pkienzle@…> (05/01/17 15:00:53)
- git-committer:
- GitHub <noreply@…> (05/01/17 15:00:53)
- Location:
- src/sas/sasgui/plottools
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
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
rb9d74f3 r0cc77d8 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
rb9d74f3 r0cc77d8 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/plottools/LineModel.py
r959eb01 rb9d74f3 82 82 elif x.__class__.__name__ == 'tuple': 83 83 msg = "Tuples are not allowed as input to BaseComponent models" 84 raise ValueError , msg84 raise ValueError(msg) 85 85 else: 86 86 return self._line(x) … … 104 104 elif x.__class__.__name__ == 'tuple': 105 105 msg = "Tuples are not allowed as input to BaseComponent models" 106 raise ValueError , msg106 raise ValueError(msg) 107 107 else: 108 108 return self._line(x) -
src/sas/sasgui/plottools/fitDialog.py
r7432acb rb9d74f3 671 671 return x 672 672 else: 673 raise ValueError , "cannot compute log of a negative number"673 raise ValueError("cannot compute log of a negative number") 674 674 675 675 def floatInvTransform(self, x): … … 734 734 except: 735 735 msg = "LinearFit.set_fit_region: fit range must be floats" 736 raise ValueError , msg736 raise ValueError(msg) 737 737 self.xminFit.SetValue(format_number(xmin)) 738 738 self.xmaxFit.SetValue(format_number(xmax)) -
src/sas/sasgui/plottools/plottables.py
r45dffa69 rb9d74f3 386 386 387 387 """ 388 raise NotImplemented , "Not a valid transform"388 raise NotImplemented("Not a valid transform") 389 389 390 390 # Related issues … … 686 686 msg = "Plottable.View: Given x and dx are not" 687 687 msg += " of the same length" 688 raise ValueError , msg688 raise ValueError(msg) 689 689 # Check length of y array 690 690 if not len(y) == len(x): 691 691 msg = "Plottable.View: Given y " 692 692 msg += "and x are not of the same length" 693 raise ValueError , msg693 raise ValueError(msg) 694 694 695 695 if dy is not None and not len(dy) == 0 and not len(y) == len(dy): 696 696 msg = "Plottable.View: Given y and dy are not of the same " 697 697 msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy)) 698 raise ValueError , msg698 raise ValueError(msg) 699 699 self.x = [] 700 700 self.y = [] … … 731 731 msg = "Plottable.View: transformed x " 732 732 msg += "and y are not of the same length" 733 raise ValueError , msg733 raise ValueError(msg) 734 734 if has_err_x and not (len(self.x) == len(self.dx)): 735 735 msg = "Plottable.View: transformed x and dx" 736 736 msg += " are not of the same length" 737 raise ValueError , msg737 raise ValueError(msg) 738 738 if has_err_y and not (len(self.y) == len(self.dy)): 739 739 msg = "Plottable.View: transformed y" 740 740 msg += " and dy are not of the same length" 741 raise ValueError , msg741 raise ValueError(msg) 742 742 # Check that negative values are not plot on x and y axis for 743 743 # log10 transformation … … 1105 1105 Plottable.__init__(self) 1106 1106 msg = "Theory1D is no longer supported, please use Data1D and change symbol.\n" 1107 raise DeprecationWarning , msg1107 raise DeprecationWarning(msg) 1108 1108 1109 1109 class Fit1D(Plottable): -
src/sas/sasgui/plottools/transform.py
r7432acb rb9d74f3 24 24 """ 25 25 if not x > 0: 26 raise ValueError , "Transformation only accepts positive values."26 raise ValueError("Transformation only accepts positive values.") 27 27 else: 28 28 return x … … 50 50 """ 51 51 if not x >= 0: 52 raise ValueError , "square root of a negative value "52 raise ValueError("square root of a negative value ") 53 53 else: 54 54 return math.sqrt(x) … … 76 76 """ 77 77 if not x >= 0: 78 raise ValueError , "double square root of a negative value "78 raise ValueError("double square root of a negative value ") 79 79 else: 80 80 return math.sqrt(math.sqrt(x)) … … 90 90 """ 91 91 if not x > 0: 92 raise ValueError , "Log(x)of a negative value "92 raise ValueError("Log(x)of a negative value ") 93 93 else: 94 94 return math.log(x) … … 100 100 return 1 / x 101 101 else: 102 raise ValueError , "cannot divide by zero"102 raise ValueError("cannot divide by zero") 103 103 104 104 … … 109 109 return 1 / math.sqrt(y) 110 110 else: 111 raise ValueError , "transform.toOneOverSqrtX: cannot be computed"111 raise ValueError("transform.toOneOverSqrtX: cannot be computed") 112 112 113 113 … … 118 118 return math.log(y * (x ** 2)) 119 119 else: 120 raise ValueError , "transform.toLogYX2: cannot be computed"120 raise ValueError("transform.toLogYX2: cannot be computed") 121 121 122 122 … … 127 127 return math.log(math.pow(x, 4) * y) 128 128 else: 129 raise ValueError , "transform.toLogYX4: input error"129 raise ValueError("transform.toLogYX4: input error") 130 130 131 131 … … 149 149 """ 150 150 if not (x * y) > 0: 151 raise ValueError , "Log(X*Y)of a negative value "151 raise ValueError("Log(X*Y)of a negative value ") 152 152 else: 153 153 return math.log(x * y) … … 211 211 else: 212 212 msg = "transform.errFromX2: can't compute error of negative x" 213 raise ValueError , msg213 raise ValueError(msg) 214 214 215 215 … … 245 245 else: 246 246 msg = "transform.errFromX4: can't compute error of negative x" 247 raise ValueError , msg247 raise ValueError(msg) 248 248 249 249 … … 264 264 msg = "Transformation does not accept" 265 265 msg += " point that are consistent with zero." 266 raise ValueError , msg266 raise ValueError(msg) 267 267 if x != 0: 268 268 dx = dx / (x * math.log(10)) 269 269 else: 270 raise ValueError , "errToLogX: divide by zero"270 raise ValueError("errToLogX: divide by zero") 271 271 return dx 272 272 … … 287 287 dx = dx / x 288 288 else: 289 raise ValueError , "errToLogX: divide by zero"289 raise ValueError("errToLogX: divide by zero") 290 290 return dx 291 291 … … 312 312 msg = "Transformation does not accept point " 313 313 msg += " that are consistent with zero." 314 raise ValueError , msg314 raise ValueError(msg) 315 315 if x != 0 and y != 0: 316 316 if dx is None: … … 320 320 err = (dx / x) ** 2 + (dy / y) ** 2 321 321 else: 322 raise ValueError , "cannot compute this error"322 raise ValueError("cannot compute this error") 323 323 324 324 return math.sqrt(math.fabs(err)) … … 335 335 msg = "Transformation does not accept point" 336 336 msg += " that are consistent with zero." 337 raise ValueError , msg337 raise ValueError(msg) 338 338 if x > 0 and y > 0: 339 339 if dx is None: … … 343 343 err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 344 344 else: 345 raise ValueError , "cannot compute this error"345 raise ValueError("cannot compute this error") 346 346 return math.sqrt(math.fabs(err)) 347 347 … … 357 357 err = dx / x ** 2 358 358 else: 359 raise ValueError , "Cannot compute this error"359 raise ValueError("Cannot compute this error") 360 360 return math.fabs(err) 361 361 … … 371 371 err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx 372 372 else: 373 raise ValueError , "Cannot compute this error"373 raise ValueError("Cannot compute this error") 374 374 return math.fabs(err) 375 375 … … 387 387 msg = "Transformation does not accept point " 388 388 msg += " that are consistent with zero." 389 raise ValueError , msg389 raise ValueError(msg) 390 390 if dx is None: 391 391 dx = 0
Note: See TracChangeset
for help on using the changeset viewer.