Changeset 0cc77d8 in sasview for src/sas/sasgui/plottools


Ignore:
Timestamp:
May 1, 2017 3:00:53 PM (8 years ago)
Author:
GitHub <noreply@…>
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)
Message:

Merge branch 'master' into raise

Location:
src/sas/sasgui/plottools
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/plottools/PlotPanel.py

    r7432acb ra1b8fee  
    22    Plot panel. 
    33""" 
     4from __future__ import print_function 
     5 
    46import logging 
    57import traceback 
     
    3840def show_tree(obj, d=0): 
    3941    """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__)) 
    4143    if 'get_children' in dir(obj): 
    4244        for a in obj.get_children(): show_tree(a, d + 1) 
     
    20142016            self.toolbar.copy_figure(self.canvas) 
    20152017        except: 
    2016             print "Error in copy Image" 
     2018            print("Error in copy Image") 
    20172019 
    20182020 
  • src/sas/sasgui/plottools/binder.py

    rb9d74f3 r0cc77d8  
    22Extension to MPL to support the binding of artists to key/mouse events. 
    33""" 
     4from __future__ import print_function 
     5 
    46import sys 
    57import logging 
     
    6365            ] 
    6466        except: 
    65             print "bypassing scroll_event: wrong matplotlib version" 
     67            print("bypassing scroll_event: wrong matplotlib version") 
    6668            self._connections = [ 
    6769                canvas.mpl_connect('motion_notify_event', self._onMotion), 
  • src/sas/sasgui/plottools/convert_units.py

    rb9d74f3 r0cc77d8  
    33    This is a cleaned up version of unitConverter.py 
    44""" 
     5from __future__ import print_function 
     6 
    57import re 
    68import string 
     
    6870    unit8 = "m/s^{4}"  #         x^2               (m/s^{4})^{2} 
    6971 
    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  
    1414 
    1515""" 
     16from __future__ import print_function 
     17 
    1618from scipy import optimize 
    1719 
     
    106108    chisqr, out, cov = sasfit(line, [cstA, cstB], event.x, y, 0) 
    107109    # print "Output parameters:", out 
    108     print "The right answer is [70.0, 1.0]" 
    109     print chisqr, out, cov 
     110    print("The right answer is [70.0, 1.0]") 
     111    print(chisqr, out, cov) 
  • src/sas/sasgui/plottools/plottable_interactor.py

    r45dffa69 ra1b8fee  
    22    This module allows more interaction with the plot 
    33""" 
     4from __future__ import print_function 
     5 
    46from BaseInteractor import _BaseInteractor 
     7 
    58 
    69class PointInteractor(_BaseInteractor): 
     
    156159 
    157160    def clear(self): 
    158         print "plottable_interactor.clear()" 
     161        print("plottable_interactor.clear()") 
    159162 
    160163    def _on_click(self, evt): 
  • src/sas/sasgui/plottools/LineModel.py

    r959eb01 rb9d74f3  
    8282        elif x.__class__.__name__ == 'tuple': 
    8383            msg = "Tuples are not allowed as input to BaseComponent models" 
    84             raise ValueError, msg 
     84            raise ValueError(msg) 
    8585        else: 
    8686            return self._line(x) 
     
    104104        elif x.__class__.__name__ == 'tuple': 
    105105            msg = "Tuples are not allowed as input to BaseComponent models" 
    106             raise ValueError, msg 
     106            raise ValueError(msg) 
    107107        else: 
    108108            return self._line(x) 
  • src/sas/sasgui/plottools/fitDialog.py

    r7432acb rb9d74f3  
    671671                return x 
    672672            else: 
    673                 raise ValueError, "cannot compute log of a negative number" 
     673                raise ValueError("cannot compute log of a negative number") 
    674674 
    675675    def floatInvTransform(self, x): 
     
    734734        except: 
    735735            msg = "LinearFit.set_fit_region: fit range must be floats" 
    736             raise ValueError, msg 
     736            raise ValueError(msg) 
    737737        self.xminFit.SetValue(format_number(xmin)) 
    738738        self.xmaxFit.SetValue(format_number(xmax)) 
  • src/sas/sasgui/plottools/plottables.py

    r45dffa69 rb9d74f3  
    386386 
    387387        """ 
    388         raise NotImplemented, "Not a valid transform" 
     388        raise NotImplemented("Not a valid transform") 
    389389 
    390390    # Related issues 
     
    686686                msg = "Plottable.View: Given x and dx are not" 
    687687                msg += " of the same length" 
    688                 raise ValueError, msg 
     688                raise ValueError(msg) 
    689689            # Check length of y array 
    690690            if not len(y) == len(x): 
    691691                msg = "Plottable.View: Given y " 
    692692                msg += "and x are not of the same length" 
    693                 raise ValueError, msg 
     693                raise ValueError(msg) 
    694694 
    695695            if dy is not None and not len(dy) == 0 and not len(y) == len(dy): 
    696696                msg = "Plottable.View: Given y and dy are not of the same " 
    697697                msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy)) 
    698                 raise ValueError, msg 
     698                raise ValueError(msg) 
    699699            self.x = [] 
    700700            self.y = [] 
     
    731731                msg = "Plottable.View: transformed x " 
    732732                msg += "and y are not of the same length" 
    733                 raise ValueError, msg 
     733                raise ValueError(msg) 
    734734            if has_err_x and not (len(self.x) == len(self.dx)): 
    735735                msg = "Plottable.View: transformed x and dx" 
    736736                msg += " are not of the same length" 
    737                 raise ValueError, msg 
     737                raise ValueError(msg) 
    738738            if has_err_y and not (len(self.y) == len(self.dy)): 
    739739                msg = "Plottable.View: transformed y" 
    740740                msg += " and dy are not of the same length" 
    741                 raise ValueError, msg 
     741                raise ValueError(msg) 
    742742            # Check that negative values are not plot on x and y axis for 
    743743            # log10 transformation 
     
    11051105        Plottable.__init__(self) 
    11061106        msg = "Theory1D is no longer supported, please use Data1D and change symbol.\n" 
    1107         raise DeprecationWarning, msg 
     1107        raise DeprecationWarning(msg) 
    11081108 
    11091109class Fit1D(Plottable): 
  • src/sas/sasgui/plottools/transform.py

    r7432acb rb9d74f3  
    2424    """ 
    2525    if not x > 0: 
    26         raise ValueError, "Transformation only accepts positive values." 
     26        raise ValueError("Transformation only accepts positive values.") 
    2727    else: 
    2828        return x 
     
    5050    """ 
    5151    if not x >= 0: 
    52         raise ValueError, "square root of a negative value " 
     52        raise ValueError("square root of a negative value ") 
    5353    else: 
    5454        return math.sqrt(x) 
     
    7676    """ 
    7777    if not x >= 0: 
    78         raise ValueError, "double square root of a negative value " 
     78        raise ValueError("double square root of a negative value ") 
    7979    else: 
    8080        return math.sqrt(math.sqrt(x)) 
     
    9090    """ 
    9191    if not x > 0: 
    92         raise ValueError, "Log(x)of a negative value " 
     92        raise ValueError("Log(x)of a negative value ") 
    9393    else: 
    9494        return math.log(x) 
     
    100100        return 1 / x 
    101101    else: 
    102         raise ValueError, "cannot divide by zero" 
     102        raise ValueError("cannot divide by zero") 
    103103 
    104104 
     
    109109        return 1 / math.sqrt(y) 
    110110    else: 
    111         raise ValueError, "transform.toOneOverSqrtX: cannot be computed" 
     111        raise ValueError("transform.toOneOverSqrtX: cannot be computed") 
    112112 
    113113 
     
    118118        return math.log(y * (x ** 2)) 
    119119    else: 
    120         raise ValueError, "transform.toLogYX2: cannot be computed" 
     120        raise ValueError("transform.toLogYX2: cannot be computed") 
    121121 
    122122 
     
    127127        return math.log(math.pow(x, 4) * y) 
    128128    else: 
    129         raise ValueError, "transform.toLogYX4: input error" 
     129        raise ValueError("transform.toLogYX4: input error") 
    130130 
    131131 
     
    149149    """ 
    150150    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 ") 
    152152    else: 
    153153        return math.log(x * y) 
     
    211211    else: 
    212212        msg = "transform.errFromX2: can't compute error of negative x" 
    213         raise ValueError, msg 
     213        raise ValueError(msg) 
    214214 
    215215 
     
    245245    else: 
    246246        msg = "transform.errFromX4: can't compute error of negative x" 
    247         raise ValueError, msg 
     247        raise ValueError(msg) 
    248248 
    249249 
     
    264264        msg = "Transformation does not accept" 
    265265        msg += " point that are consistent with zero." 
    266         raise ValueError, msg 
     266        raise ValueError(msg) 
    267267    if x != 0: 
    268268        dx = dx / (x * math.log(10)) 
    269269    else: 
    270         raise ValueError, "errToLogX: divide by zero" 
     270        raise ValueError("errToLogX: divide by zero") 
    271271    return dx 
    272272 
     
    287287        dx = dx / x 
    288288    else: 
    289         raise ValueError, "errToLogX: divide by zero" 
     289        raise ValueError("errToLogX: divide by zero") 
    290290    return dx 
    291291 
     
    312312        msg = "Transformation does not accept point " 
    313313        msg += " that are consistent with zero." 
    314         raise ValueError, msg 
     314        raise ValueError(msg) 
    315315    if x != 0 and y != 0: 
    316316        if dx is None: 
     
    320320        err = (dx / x) ** 2 + (dy / y) ** 2 
    321321    else: 
    322         raise ValueError, "cannot compute this error" 
     322        raise ValueError("cannot compute this error") 
    323323 
    324324    return math.sqrt(math.fabs(err)) 
     
    335335        msg = "Transformation does not accept point" 
    336336        msg += " that are consistent with zero." 
    337         raise ValueError, msg 
     337        raise ValueError(msg) 
    338338    if x > 0 and y > 0: 
    339339        if dx is None: 
     
    343343        err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 
    344344    else: 
    345         raise ValueError, "cannot compute this error" 
     345        raise ValueError("cannot compute this error") 
    346346    return math.sqrt(math.fabs(err)) 
    347347 
     
    357357        err = dx / x ** 2 
    358358    else: 
    359         raise ValueError, "Cannot compute this error" 
     359        raise ValueError("Cannot compute this error") 
    360360    return math.fabs(err) 
    361361 
     
    371371        err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx 
    372372    else: 
    373         raise ValueError, "Cannot compute this error" 
     373        raise ValueError("Cannot compute this error") 
    374374    return math.fabs(err) 
    375375 
     
    387387        msg = "Transformation does not accept point " 
    388388        msg += " that are consistent with zero." 
    389         raise ValueError, msg 
     389        raise ValueError(msg) 
    390390    if dx is None: 
    391391        dx = 0 
Note: See TracChangeset for help on using the changeset viewer.