[yoda-svn] yoda: Remove numpy from path-search testing main function

YODA Mercurial yoda at projects.hepforge.org
Mon Oct 9 09:45:01 BST 2017


details:   https://yoda.hepforge.org/hg/yoda/rev/974a09cdf1b2
branches:  
changeset: 1422:974a09cdf1b2
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Oct 09 09:36:31 2017 +0100
description:
Remove numpy from path-search testing main function

diffs (42 lines):

--- a/pyext/yoda/__init__.py	Tue Oct 03 20:13:30 2017 +0100
+++ b/pyext/yoda/__init__.py	Mon Oct 09 09:36:31 2017 +0100
@@ -10,7 +10,7 @@
 from yoda.search import match_aos
 
 
-## Pull in plotting tools (if matplotlib and numpy are available)
+## Pull in plotting tools (requires matplotlib and numpy)
 try:
     import yoda.plotting
     from yoda.plotting import mplinit, plot
--- a/pyext/yoda/search.py	Tue Oct 03 20:13:30 2017 +0100
+++ b/pyext/yoda/search.py	Mon Oct 09 09:36:31 2017 +0100
@@ -129,8 +129,9 @@
 
 if __name__ == "__main__":
 
-    import numpy as np
+    from . import linspace, logspace
     from pprint import pprint
+    import math
 
     class Point(object):
         def __init__(self, path, n, xmin, xmax, value=None):
@@ -144,13 +145,13 @@
             return "Point({} #{:d}  {:.2e}--{:.2e}{})".format(self.path, self.n, self.xmin, self.xmax, val)
 
     POINTS = []
-    xs = np.linspace(0, 10, 5)
+    xs = linspace(5, 0, 10)
     POINTS += [Point("/foo", i, xs[i], xs[i+1]) for i in range(len(xs)-1)]
-    xs = np.linspace(0, 100, 50)
+    xs = linspace(50, 0, 100)
     POINTS += [Point("/bar", i, xs[i], xs[i+1]) for i in range(len(xs)-1)]
-    xs = np.linspace(0, np.pi, 20)
+    xs = linspace(20, 0, math.pi)
     POINTS += [Point("/baz/pi", i, xs[i], xs[i+1]) for i in range(len(xs)-1)]
-    xs = np.logspace(0.1, 50, 20)
+    xs = logspace(20, 0.1, 50)
     POINTS += [Point("/baz/log", i, xs[i], xs[i+1]) for i in range(len(xs)-1)]
     pprint(POINTS)
 


More information about the yoda-svn mailing list