hawking 07/11/20 21:15:32
Added: gnuplot-py-1.7-numpy.patch digest-gnuplot-py-1.7-r2
Log:
revbump. backported upstream's changes for numpy. numeric dependency changed to numpy.
(Portage version: 2.1.3.19)
Revision Changes Path
1.1 dev-python/gnuplot-py/files/gnuplot-py-1.7-numpy.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/gnuplot-py/files/gnuplot-py-1.7-numpy.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/gnuplot-py/files/gnuplot-py-1.7-numpy.patch?rev=1.1&content-type=text/plain
Index: gnuplot-py-1.7-numpy.patch
===================================================================
diff -ur gnuplot-py-1.7/ANNOUNCE.txt gnuplot-py-1.7-numpy/ANNOUNCE.txt
--- gnuplot-py-1.7/ANNOUNCE.txt 2003-10-17 18:03:10.000000000 +0300
+++ gnuplot-py-1.7-numpy/ANNOUNCE.txt 2007-11-20 22:17:29.000000000 +0200
@@ -9,7 +9,7 @@
Prerequisites (see footnotes):
the Python interpreter [1]
- the Python Numeric module [3]
+ the Python numpy module [3]
the gnuplot program [2]
or, to use it under Java (experimental):
@@ -20,7 +20,7 @@
Some ways this package can be used:
-1. Interactive data processing: Use Python's excellent Numeric package
+1. Interactive data processing: Use Python's excellent numpy package
to create and manipulate arrays of numbers, and use Gnuplot.py to
visualize the results.
2. Web graphics: write CGI scripts in Python that use gnuplot to
diff -ur gnuplot-py-1.7/demo.py gnuplot-py-1.7-numpy/demo.py
--- gnuplot-py-1.7/demo.py 2003-10-17 17:28:10.000000000 +0300
+++ gnuplot-py-1.7-numpy/demo.py 2007-11-20 22:36:59.000000000 +0200
@@ -16,7 +16,7 @@
__cvs_version__ = '$Revision: 1.1 $'
-from Numeric import *
+from numpy import *
# If the package has been installed correctly, this should work:
import Gnuplot, Gnuplot.funcutils
@@ -31,7 +31,7 @@
g = Gnuplot.Gnuplot(debug=1)
g.title('A simple example') # (optional)
g('set data style linespoints') # give gnuplot an arbitrary command
- # Plot a list of (x, y) pairs (tuples or a Numeric array would
+ # Plot a list of (x, y) pairs (tuples or a numpy array would
# also be OK):
g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
raw_input('Please press return to continue...\n')
@@ -39,7 +39,7 @@
g.reset()
# Plot one dataset from an array and one via a gnuplot function;
# also demonstrate the use of item-specific options:
- x = arange(10, typecode=Float)
+ x = arange(10, dtype='float_')
y1 = x**2
# Notice how this plotitem is created here but used later? This
# is convenient if the same dataset has to be plotted multiple
@@ -74,8 +74,8 @@
# Make a 2-d array containing a function of x and y. First create
# xm and ym which contain the x and y values in a matrix form that
# can be `broadcast' into a matrix of the appropriate shape:
- xm = x[:,NewAxis]
- ym = y[NewAxis,:]
+ xm = x[:,newaxis]
+ ym = y[newaxis,:]
m = (sin(xm) + 0.1*xm) - ym**2
g('set parametric')
g('set data style lines')
diff -ur gnuplot-py-1.7/FAQ.txt gnuplot-py-1.7-numpy/FAQ.txt
--- gnuplot-py-1.7/FAQ.txt 2003-10-17 17:28:10.000000000 +0300
+++ gnuplot-py-1.7-numpy/FAQ.txt 2007-11-20 22:17:50.000000000 +0200
@@ -17,7 +17,7 @@
#! /usr/bin/python2
import Gnuplot, Gnuplot.funcutils
-from Numeric import *
+from numpy import *
g = Gnuplot.Gnuplot()
g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
diff -ur gnuplot-py-1.7/funcutils.py gnuplot-py-1.7-numpy/funcutils.py
--- gnuplot-py-1.7/funcutils.py 2003-10-17 17:28:10.000000000 +0300
+++ gnuplot-py-1.7-numpy/funcutils.py 2007-11-20 22:25:24.000000000 +0200
@@ -16,19 +16,19 @@
__cvs_version__ = '$Revision: 1.1 $'
-import Numeric
+import numpy
import Gnuplot, utils
-def tabulate_function(f, xvals, yvals=None, typecode=None, ufunc=0):
+def tabulate_function(f, xvals, yvals=None, dtype=None, ufunc=0):
"""Evaluate and tabulate a function on a 1- or 2-D grid of points.
f should be a function taking one or two floating-point
parameters.
If f takes one parameter, then xvals should be a 1-D array and
- yvals should be None. The return value is a Numeric array
+ yvals should be None. The return value is a numpy array
'[f(x[0]), f(x[1]), ..., f(x[-1])]'.
If f takes two parameters, then 'xvals' and 'yvals' should each be
@@ -39,7 +39,7 @@
If 'ufunc=0', then 'f' is evaluated at each point using a Python
loop. This can be slow if the number of points is large. If
- speed is an issue, you should write 'f' in terms of Numeric ufuncs
+ speed is an issue, you should write 'f' in terms of numpy ufuncs
and use the 'ufunc=1' feature described next.
If called with 'ufunc=1', then 'f' should be a function that is
@@ -51,34 +51,33 @@
if yvals is None:
# f is a function of only one variable:
- xvals = Numeric.asarray(xvals, typecode)
+ xvals = numpy.asarray(xvals, dtype)
if ufunc:
return f(xvals)
else:
- if typecode is None:
- typecode = xvals.typecode()
+ if dtype is None:
+ dtype = xvals.dtype.char
- m = Numeric.zeros((len(xvals),), typecode)
+ m = numpy.zeros((len(xvals),), dtype)
for xi in range(len(xvals)):
x = xvals[xi]
m[xi] = f(x)
return m
else:
# f is a function of two variables:
- xvals = Numeric.asarray(xvals, typecode)
- yvals = Numeric.asarray(yvals, typecode)
+ xvals = numpy.asarray(xvals, dtype)
+ yvals = numpy.asarray(yvals, dtype)
if ufunc:
- return f(xvals[:,Numeric.NewAxis], yvals[Numeric.NewAxis,:])
+ return f(xvals[:,numpy.newaxis], yvals[numpy.newaxis,:])
else:
- if typecode is None:
+ if dtype is None:
# choose a result typecode based on what '+' would return
# (yecch!):
- typecode = (Numeric.zeros((1,), xvals.typecode()) +
- Numeric.zeros((1,), yvals.typecode())).typecode()
-
- m = Numeric.zeros((len(xvals), len(yvals)), typecode)
+ dtype = (numpy.zeros((1,), xvals.dtype.char) +
+ numpy.zeros((1,), yvals.dtype.char)).dtype.char
+ m = numpy.zeros((len(xvals), len(yvals)), dtype)
for xi in range(len(xvals)):
x = xvals[xi]
for yi in range(len(yvals)):
diff -ur gnuplot-py-1.7/_Gnuplot.py gnuplot-py-1.7-numpy/_Gnuplot.py
--- gnuplot-py-1.7/_Gnuplot.py 2003-10-17 17:28:10.000000000 +0300
+++ gnuplot-py-1.7-numpy/_Gnuplot.py 2007-11-20 22:37:26.000000000 +0200
@@ -228,8 +228,8 @@
'items' is a sequence of items, each of which should be a
'PlotItem' of some kind, a string (interpreted as a function
- string for gnuplot to evaluate), or a Numeric array (or
- something that can be converted to a Numeric array).
+ string for gnuplot to evaluate), or a numpy array (or
+ something that can be converted to a numpy array).
"""
diff -ur gnuplot-py-1.7/__init__.py gnuplot-py-1.7-numpy/__init__.py
--- gnuplot-py-1.7/__init__.py 2003-10-17 18:04:29.000000000 +0300
+++ gnuplot-py-1.7-numpy/__init__.py 2007-11-20 22:19:00.000000000 +0200
@@ -128,9 +128,9 @@
Restrictions:
- - Relies on the Numeric Python extension. This can be obtained from
- "SourceForge", http://sourceforge.net/projects/numpy/. If you're
- interested in gnuplot, you would probably also want NumPy anyway.
+ - Relies on the numpy Python extension. This can be obtained from
+ the Scipy group at <http://www.scipy.org/Download>.. If you're
+ interested in gnuplot, you would probably also want numpy anyway.
- Only a small fraction of gnuplot functionality is implemented as
explicit method functions. However, you can give arbitrary
diff -ur gnuplot-py-1.7/NEWS.txt gnuplot-py-1.7-numpy/NEWS.txt
--- gnuplot-py-1.7/NEWS.txt 2003-10-17 18:04:29.000000000 +0300
+++ gnuplot-py-1.7-numpy/NEWS.txt 2007-11-20 22:22:08.000000000 +0200
@@ -57,7 +57,7 @@
equivalent.) If I find the time I might try to produce a version
that doesn't require Numeric at all, under either Python or Jython.
-* Removed the oldplot.py module: (1) I doubt anybody is still using
+ Removed the oldplot.py module: (1) I doubt anybody is still using
it. (2) It seems to be broken anyway. (3) I don't have the energy to
fix or maintain it. Let me know if I'm wrong about point 1.
@@ -222,10 +222,10 @@
dataset; e.g., what used to be written as
g = Gnuplot.Gnuplot()
- x = Numeric.arange(100)/10.0
+ x = numpy.arange(100)/10.0
y = x**2
# Create an array of (x,y) pairs:
- g.plot(Gnuplot.Data(Numeric.transpose((x, y))))
+ g.plot(Gnuplot.Data(numpy.transpose((x, y))))
can now be shortened to
diff -ur gnuplot-py-1.7/PlotItems.py gnuplot-py-1.7-numpy/PlotItems.py
--- gnuplot-py-1.7/PlotItems.py 2003-10-17 17:39:03.000000000 +0300
+++ gnuplot-py-1.7-numpy/PlotItems.py 2007-11-20 22:34:49.000000000 +0200
@@ -23,7 +23,7 @@
except ImportError:
from StringIO import StringIO
-import Numeric
+import numpy
import gp, utils, Errors
@@ -471,12 +471,12 @@
return apply(_FileItem, (filename,), keyw)
-def Data(*set, **keyw):
- """Create and return a _FileItem representing the data from *set.
+def Data(*data, **keyw):
+ """Create and return a _FileItem representing the data from *data.
Create a '_FileItem' object (which is a type of 'PlotItem') out of
- one or more Float Python Numeric arrays (or objects that can be
- converted to a Float Numeric array). If the routine is passed a
+ one or more Float Python numpy arrays (or objects that can be
+ converted to a float numpy array). If the routine is passed a
single with multiple dimensions, then the last index ranges over
the values comprising a single data point (e.g., [<x>, <y>,
<sigma>]) and the rest of the indices select the data point. If
@@ -508,29 +508,29 @@
"""
- if len(set) == 1:
- # set was passed as a single structure
- set = utils.float_array(set[0])
+ if len(data) == 1:
+ # data was passed as a single structure
+ data = utils.float_array(data[0])
# As a special case, if passed a single 1-D array, then it is
# treated as one value per point (by default, plotted against
# its index):
- if len(set.shape) == 1:
- set = set[:,Numeric.NewAxis]
+ if len(data.shape) == 1:
+ data = data[:,numpy.newaxis]
else:
- # set was passed column by column (for example,
+ # data was passed column by column (for example,
# Data(x,y)); pack it into one big array (this will test
# that sizes are all the same):
- set = utils.float_array(set)
- dims = len(set.shape)
+ data = utils.float_array(data)
+ dims = len(data.shape)
# transpose so that the last index selects x vs. y:
- set = Numeric.transpose(set, (dims-1,) + tuple(range(dims-1)))
+ data = numpy.transpose(data, (dims-1,) + tuple(range(dims-1)))
if keyw.has_key('cols'):
cols = keyw['cols']
del keyw['cols']
- if type(cols) is types.IntType:
+ if isinstance(cols, types.IntType):
cols = (cols,)
- set = Numeric.take(set, cols, -1)
+ data = numpy.take(data, cols, -1)
if keyw.has_key('inline'):
inline = keyw['inline']
@@ -540,7 +540,7 @@
# Output the content into a string:
f = StringIO()
- utils.write_array(f, set)
+ utils.write_array(f, data)
content = f.getvalue()
if inline:
return apply(_InlineFileItem, (content,), keyw)
@@ -610,7 +610,7 @@
raise Errors.DataError('data array must be two-dimensional')
if xvals is None:
- xvals = Numeric.arange(numx)
+ xvals = numpy.arange(numx)
else:
xvals = utils.float_array(xvals)
if xvals.shape != (numx,):
@@ -619,7 +619,7 @@
'the first dimension of the data array')
if yvals is None:
- yvals = Numeric.arange(numy)
+ yvals = numpy.arange(numy)
else:
yvals = utils.float_array(yvals)
if yvals.shape != (numy,):
@@ -647,17 +647,17 @@
# documentation has the roles of x and y exchanged. We ignore
# the documentation and go with the code.
- mout = Numeric.zeros((numy + 1, numx + 1), Numeric.Float32)
+ mout = numpy.zeros((numy + 1, numx + 1), numpy.float32)
mout[0,0] = numx
- mout[0,1:] = xvals.astype(Numeric.Float32)
- mout[1:,0] = yvals.astype(Numeric.Float32)
+ mout[0,1:] = xvals.astype(numpy.float32)
+ mout[1:,0] = yvals.astype(numpy.float32)
try:
# try copying without the additional copy implied by astype():
- mout[1:,1:] = Numeric.transpose(data)
+ mout[1:,1:] = numpy.transpose(data)
except:
# if that didn't work then downcasting from double
# must be necessary:
- mout[1:,1:] = Numeric.transpose(data.astype(Numeric.Float32))
+ mout[1:,1:] = numpy.transpose(data.astype(numpy.float32))
content = mout.tostring()
if gp.GnuplotOpts.prefer_fifo_data:
@@ -668,10 +668,10 @@
# output data to file as "x y f(x)" triplets. This
# requires numy copies of each x value and numx copies of
# each y value. First reformat the data:
- set = Numeric.transpose(
- Numeric.array(
- (Numeric.transpose(Numeric.resize(xvals, (numy, numx))),
- Numeric.resize(yvals, (numx, numy)),
+ set = numpy.transpose(
+ numpy.array(
+ (numpy.transpose(numpy.resize(xvals, (numy, numx))),
+ numpy.resize(yvals, (numx, numy)),
data)), (1,2,0))
# Now output the data with the usual routine. This will
diff -ur gnuplot-py-1.7/README.txt gnuplot-py-1.7-numpy/README.txt
--- gnuplot-py-1.7/README.txt 2003-10-19 17:52:35.000000000 +0300
+++ gnuplot-py-1.7-numpy/README.txt 2007-11-20 22:35:30.000000000 +0200
@@ -65,8 +65,8 @@
Obviously, you must have the gnuplot program if Gnuplot.py is to be of
any use to you. Gnuplot can be obtained via
-<http://www.gnuplot.info>. You also need Python's Numerical
-extension, which is available from <http://numpy.sourceforge.net>.
+<http://www.gnuplot.info>. You also need a copy of the numpy package, which
+is available from the Scipy group at <http://www.scipy.org/Download>.
Gnuplot.py uses Python distutils
<http://www.python.org/doc/current/inst/inst.html> and can be
diff -ur gnuplot-py-1.7/setup.py gnuplot-py-1.7-numpy/setup.py
--- gnuplot-py-1.7/setup.py 2003-10-17 17:52:28.000000000 +0300
+++ gnuplot-py-1.7-numpy/setup.py 2007-11-20 22:19:20.000000000 +0200
@@ -31,7 +31,7 @@
author_email='mhagger@...',
url='http://gnuplot-py.sourceforge.net',
license='LGPL',
- licence='LGPL', # Spelling error in distutils
+ #licence='LGPL', # Spelling error in distutils
# Description of the package in the distribution
package_dir={'Gnuplot' : '.'},
diff -ur gnuplot-py-1.7/test.py gnuplot-py-1.7-numpy/test.py
--- gnuplot-py-1.7/test.py 2003-10-17 17:28:10.000000000 +0300
+++ gnuplot-py-1.7-numpy/test.py 2007-11-20 22:43:26.000000000 +0200
@@ -17,8 +17,7 @@
__cvs_version__ = '$Revision: 1.1 $'
import os, time, math, tempfile
-import Numeric
-from Numeric import NewAxis
+import numpy
try:
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
@@ -55,7 +54,7 @@
filename1 = tempfile.mktemp()
f = open(filename1, 'w')
try:
- for x in Numeric.arange(100)/5. - 10.:
+ for x in numpy.arange(100.)/5. - 10.:
f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x)))
f.close()
@@ -137,10 +136,10 @@
g.plot(f)
print '############### test Data ###################################'
- x = Numeric.arange(100)/5. - 10.
- y1 = Numeric.cos(x)
- y2 = Numeric.sin(x)
- d = Numeric.transpose((x,y1,y2))
+ x = numpy.arange(100)/5. - 10.
+ y1 = numpy.cos(x)
+ y2 = numpy.sin(x)
+ d = numpy.transpose((x,y1,y2))
wait('Plot Data against its index')
g.plot(Gnuplot.Data(y2, inline=0))
@@ -173,7 +172,7 @@
g.plot(Gnuplot.Data(d, title='Cosine of x'))
print '############### test compute_Data ###########################'
- x = Numeric.arange(100)/5. - 10.
+ x = numpy.arange(100)/5. - 10.
wait('Plot Data, computed by Gnuplot.py')
g.plot(Gnuplot.funcutils.compute_Data(x, lambda x: math.cos(x), inline=0))
@@ -235,14 +234,14 @@
print '############### test GridData and compute_GridData ##########'
# set up x and y values at which the function will be tabulated:
- x = Numeric.arange(35)/2.0
- y = Numeric.arange(30)/10.0 - 1.5
+ x = numpy.arange(35)/2.0
+ y = numpy.arange(30)/10.0 - 1.5
# Make a 2-d array containing a function of x and y. First create
# xm and ym which contain the x and y values in a matrix form that
# can be `broadcast' into a matrix of the appropriate shape:
- xm = x[:,NewAxis]
- ym = y[NewAxis,:]
- m = (Numeric.sin(xm) + 0.1*xm) - ym**2
+ xm = x[:,numpy.newaxis]
+ ym = y[numpy.newaxis,:]
+ m = (numpy.sin(xm) + 0.1*xm) - ym**2
wait('a function of two variables from a GridData file')
g('set parametric')
g('set data style lines')
@@ -264,7 +263,7 @@
wait('Use compute_GridData in ufunc and binary mode')
g.splot(Gnuplot.funcutils.compute_GridData(
- x,y, lambda x,y: Numeric.sin(x) + 0.1*x - y**2,
+ x,y, lambda x,y: numpy.sin(x) + 0.1*x - y**2,
ufunc=1, binary=1,
))
diff -ur gnuplot-py-1.7/utils.py gnuplot-py-1.7-numpy/utils.py
--- gnuplot-py-1.7/utils.py 2003-10-17 17:38:44.000000000 +0300
+++ gnuplot-py-1.7-numpy/utils.py 2007-11-20 22:21:24.000000000 +0200
@@ -17,28 +17,32 @@
__cvs_version__ = '$Revision: 1.1 $'
import string
-import Numeric
+import numpy
def float_array(m):
- """Return the argument as a Numeric array of type at least 'Float32'.
+ """Return the argument as a numpy array of type at least 'Float32'.
Leave 'Float64' unchanged, but upcast all other types to
'Float32'. Allow also for the possibility that the argument is a
- python native type that can be converted to a Numeric array using
- 'Numeric.asarray()', but in that case don't worry about
+ python native type that can be converted to a numpy array using
+ 'numpy.asarray()', but in that case don't worry about
downcasting to single-precision float.
"""
try:
# Try Float32 (this will refuse to downcast)
- return Numeric.asarray(m, Numeric.Float32)
+ return numpy.asarray(m, numpy.float32)
except TypeError:
# That failure might have been because the input array was
- # of a wider data type than Float32; try to convert to the
+ # of a wider data type than float32; try to convert to the
# largest floating-point type available:
- return Numeric.asarray(m, Numeric.Float)
+ try:
+ return numpy.asarray(m, numpy.float_)
+ except TypeError:
+ print "Fatal: array dimensions not equal!"
+ return None
def write_array(f, set,
1.1 dev-python/gnuplot-py/files/digest-gnuplot-py-1.7-r2
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/gnuplot-py/files/digest-gnuplot-py-1.7-r2?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/gnuplot-py/files/digest-gnuplot-py-1.7-r2?rev=1.1&content-type=text/plain
Index: digest-gnuplot-py-1.7-r2
===================================================================
MD5 724f9eee164d6ff763777b22a5851572 gnuplot-py-1.7.tar.gz 107278
RMD160 0d0f465f0dad0e3ff35f6bdea5fc6ea9ab1b245f gnuplot-py-1.7.tar.gz 107278
SHA256 78e8716324b654337801fd68212cc2184a81313421086df301718c19bb49e216 gnuplot-py-1.7.tar.gz 107278
--
gentoo-commits@g.o mailing list
|