[sasview] 01/01: Fix enough comparison errors to enable ploting

Stuart Prescott stuart at debian.org
Tue Oct 31 08:42:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

stuart pushed a commit to branch master
in repository sasview.

commit 8b3d8fb49527b1f3879ca86b0751e9b8981bec2e
Author: Stuart Prescott <stuart at debian.org>
Date:   Tue Oct 31 19:30:44 2017 +1100

    Fix enough comparison errors to enable ploting
    
    SasView is incorrectly using 'a == None' with numpy arrays; changing these
    to 'a is None' is enough to fix the ValueErrors with newer numpy.
    
    (These and many more already fixed in upstream git)
---
 debian/patches/plotting-none.patch | 96 ++++++++++++++++++++++++++++++++++++++
 debian/patches/series              |  1 +
 2 files changed, 97 insertions(+)

diff --git a/debian/patches/plotting-none.patch b/debian/patches/plotting-none.patch
new file mode 100644
index 0000000..31420a5
--- /dev/null
+++ b/debian/patches/plotting-none.patch
@@ -0,0 +1,96 @@
+diff --git a/src/sas/sasgui/plottools/plottables.py b/src/sas/sasgui/plottools/plottables.py
+index 756a16a..567f187 100644
+--- a/src/sas/sasgui/plottools/plottables.py
++++ b/src/sas/sasgui/plottools/plottables.py
+@@ -226,7 +226,7 @@ class Graph(object):
+         for p in self.plottables:
+             if p.hidden == True:
+                 continue
+-            if not p.x == None:
++            if p.x is not None:
+                 for x_i in p.x:
+                     if min_value == None or x_i < min_value:
+                         min_value = x_i
+@@ -559,10 +559,8 @@ class Plottable(object):
+         """
+         Returns True if there is no data stored in the plottable
+         """
+-        if not self.x == None and len(self.x) == 0 \
+-            and not self.y == None and len(self.y) == 0:
+-            return True
+-        return False
++        return (self.x is not None and len(self.x) == 0
++                and self.y is not None and len(self.y) == 0)
+ 
+     def colors(self):
+         """Return the number of colors need to render the object"""
+@@ -676,11 +674,11 @@ class View(object):
+         """
+         # Sanity check
+         # Do the transofrmation only when x and y are empty
+-        has_err_x = not (dx == None or len(dx) == 0)
+-        has_err_y = not (dy == None or len(dy) == 0)
++        has_err_x = not (dx is None or len(dx) == 0)
++        has_err_y = not (dy is None or len(dy) == 0)
+ 
+-        if(x != None) and (y != None):
+-            if not dx == None and not len(dx) == 0 and not len(x) == len(dx):
++        if(x is not None) and (y is not None):
++            if dx is not None and not len(dx) == 0 and not len(x) == len(dx):
+                 msg = "Plottable.View: Given x and dx are not"
+                 msg += " of the same length"
+                 raise ValueError, msg
+@@ -690,7 +688,7 @@ class View(object):
+                 msg += "and x are not of the same length"
+                 raise ValueError, msg
+ 
+-            if not dy == None and not len(dy) == 0 and not len(y) == len(dy):
++            if dy is not None and not len(dy) == 0 and not len(y) == len(dy):
+                 msg = "Plottable.View: Given y and dy are not of the same "
+                 msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy))
+                 raise ValueError, msg
+@@ -794,9 +792,9 @@ class View(object):
+         tempdx = []
+         tempy = []
+         tempdy = []
+-        if self.dx == None:
++        if self.dx is None:
+             self.dx = numpy.zeros(len(self.x))
+-        if self.dy == None:
++        if self.dy is None:
+             self.dy = numpy.zeros(len(self.y))
+         if self.xLabel == "log10(x)":
+             for i in range(len(self.x)):
+@@ -824,9 +822,9 @@ class View(object):
+         tempdx = []
+         tempy = []
+         tempdy = []
+-        if self.dx == None:
++        if self.dx is None:
+             self.dx = numpy.zeros(len(self.x))
+-        if self.dy == None:
++        if self.dy is None:
+             self.dy = numpy.zeros(len(self.y))
+         if self.yLabel == "log10(y)":
+             for i in range(len(self.x)):
+@@ -857,9 +855,9 @@ class View(object):
+         tempdx = []
+         tempy = []
+         tempdy = []
+-        if self.dx == None:
++        if self.dx is None:
+             self.dx = numpy.zeros(len(self.x))
+-        if self.dy == None:
++        if self.dy is None:
+             self.dy = numpy.zeros(len(self.y))
+         if xmin != None and xmax != None:
+             for i in range(len(self.x)):
+@@ -1203,7 +1201,7 @@ class Chisq(Plottable):
+     def render(self, plot, **kw):
+         """
+         """
+-        if  self._chisq == None:
++        if  self._chisq is None:
+             chisqTxt = r'$\chi^2=$'
+         else:
+             chisqTxt = r'$\chi^2=%g$' % (float(self._chisq))
diff --git a/debian/patches/series b/debian/patches/series
index f436b68..d6c56c9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 sphinx-local-mathjax.patch
+plotting-none.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sasview.git



More information about the debian-science-commits mailing list