Gentoo Archives: gentoo-commits

From: "Ali Polatel (hawking)" <hawking@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/gnuplot-py/files: gnuplot-py-1.7-numpy.patch digest-gnuplot-py-1.7-r2
Date: Tue, 20 Nov 2007 21:15:39
Message-Id: E1IuaRQ-0007PB-Ig@stork.gentoo.org
1 hawking 07/11/20 21:15:32
2
3 Added: gnuplot-py-1.7-numpy.patch digest-gnuplot-py-1.7-r2
4 Log:
5 revbump. backported upstream's changes for numpy. numeric dependency changed to numpy.
6 (Portage version: 2.1.3.19)
7
8 Revision Changes Path
9 1.1 dev-python/gnuplot-py/files/gnuplot-py-1.7-numpy.patch
10
11 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
12 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
13
14 Index: gnuplot-py-1.7-numpy.patch
15 ===================================================================
16 diff -ur gnuplot-py-1.7/ANNOUNCE.txt gnuplot-py-1.7-numpy/ANNOUNCE.txt
17 --- gnuplot-py-1.7/ANNOUNCE.txt 2003-10-17 18:03:10.000000000 +0300
18 +++ gnuplot-py-1.7-numpy/ANNOUNCE.txt 2007-11-20 22:17:29.000000000 +0200
19 @@ -9,7 +9,7 @@
20
21 Prerequisites (see footnotes):
22 the Python interpreter [1]
23 - the Python Numeric module [3]
24 + the Python numpy module [3]
25 the gnuplot program [2]
26
27 or, to use it under Java (experimental):
28 @@ -20,7 +20,7 @@
29
30 Some ways this package can be used:
31
32 -1. Interactive data processing: Use Python's excellent Numeric package
33 +1. Interactive data processing: Use Python's excellent numpy package
34 to create and manipulate arrays of numbers, and use Gnuplot.py to
35 visualize the results.
36 2. Web graphics: write CGI scripts in Python that use gnuplot to
37 diff -ur gnuplot-py-1.7/demo.py gnuplot-py-1.7-numpy/demo.py
38 --- gnuplot-py-1.7/demo.py 2003-10-17 17:28:10.000000000 +0300
39 +++ gnuplot-py-1.7-numpy/demo.py 2007-11-20 22:36:59.000000000 +0200
40 @@ -16,7 +16,7 @@
41 __cvs_version__ = '$Revision: 1.1 $'
42
43
44 -from Numeric import *
45 +from numpy import *
46
47 # If the package has been installed correctly, this should work:
48 import Gnuplot, Gnuplot.funcutils
49 @@ -31,7 +31,7 @@
50 g = Gnuplot.Gnuplot(debug=1)
51 g.title('A simple example') # (optional)
52 g('set data style linespoints') # give gnuplot an arbitrary command
53 - # Plot a list of (x, y) pairs (tuples or a Numeric array would
54 + # Plot a list of (x, y) pairs (tuples or a numpy array would
55 # also be OK):
56 g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
57 raw_input('Please press return to continue...\n')
58 @@ -39,7 +39,7 @@
59 g.reset()
60 # Plot one dataset from an array and one via a gnuplot function;
61 # also demonstrate the use of item-specific options:
62 - x = arange(10, typecode=Float)
63 + x = arange(10, dtype='float_')
64 y1 = x**2
65 # Notice how this plotitem is created here but used later? This
66 # is convenient if the same dataset has to be plotted multiple
67 @@ -74,8 +74,8 @@
68 # Make a 2-d array containing a function of x and y. First create
69 # xm and ym which contain the x and y values in a matrix form that
70 # can be `broadcast' into a matrix of the appropriate shape:
71 - xm = x[:,NewAxis]
72 - ym = y[NewAxis,:]
73 + xm = x[:,newaxis]
74 + ym = y[newaxis,:]
75 m = (sin(xm) + 0.1*xm) - ym**2
76 g('set parametric')
77 g('set data style lines')
78 diff -ur gnuplot-py-1.7/FAQ.txt gnuplot-py-1.7-numpy/FAQ.txt
79 --- gnuplot-py-1.7/FAQ.txt 2003-10-17 17:28:10.000000000 +0300
80 +++ gnuplot-py-1.7-numpy/FAQ.txt 2007-11-20 22:17:50.000000000 +0200
81 @@ -17,7 +17,7 @@
82 #! /usr/bin/python2
83
84 import Gnuplot, Gnuplot.funcutils
85 -from Numeric import *
86 +from numpy import *
87
88 g = Gnuplot.Gnuplot()
89 g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
90 diff -ur gnuplot-py-1.7/funcutils.py gnuplot-py-1.7-numpy/funcutils.py
91 --- gnuplot-py-1.7/funcutils.py 2003-10-17 17:28:10.000000000 +0300
92 +++ gnuplot-py-1.7-numpy/funcutils.py 2007-11-20 22:25:24.000000000 +0200
93 @@ -16,19 +16,19 @@
94
95 __cvs_version__ = '$Revision: 1.1 $'
96
97 -import Numeric
98 +import numpy
99
100 import Gnuplot, utils
101
102
103 -def tabulate_function(f, xvals, yvals=None, typecode=None, ufunc=0):
104 +def tabulate_function(f, xvals, yvals=None, dtype=None, ufunc=0):
105 """Evaluate and tabulate a function on a 1- or 2-D grid of points.
106
107 f should be a function taking one or two floating-point
108 parameters.
109
110 If f takes one parameter, then xvals should be a 1-D array and
111 - yvals should be None. The return value is a Numeric array
112 + yvals should be None. The return value is a numpy array
113 '[f(x[0]), f(x[1]), ..., f(x[-1])]'.
114
115 If f takes two parameters, then 'xvals' and 'yvals' should each be
116 @@ -39,7 +39,7 @@
117
118 If 'ufunc=0', then 'f' is evaluated at each point using a Python
119 loop. This can be slow if the number of points is large. If
120 - speed is an issue, you should write 'f' in terms of Numeric ufuncs
121 + speed is an issue, you should write 'f' in terms of numpy ufuncs
122 and use the 'ufunc=1' feature described next.
123
124 If called with 'ufunc=1', then 'f' should be a function that is
125 @@ -51,34 +51,33 @@
126
127 if yvals is None:
128 # f is a function of only one variable:
129 - xvals = Numeric.asarray(xvals, typecode)
130 + xvals = numpy.asarray(xvals, dtype)
131
132 if ufunc:
133 return f(xvals)
134 else:
135 - if typecode is None:
136 - typecode = xvals.typecode()
137 + if dtype is None:
138 + dtype = xvals.dtype.char
139
140 - m = Numeric.zeros((len(xvals),), typecode)
141 + m = numpy.zeros((len(xvals),), dtype)
142 for xi in range(len(xvals)):
143 x = xvals[xi]
144 m[xi] = f(x)
145 return m
146 else:
147 # f is a function of two variables:
148 - xvals = Numeric.asarray(xvals, typecode)
149 - yvals = Numeric.asarray(yvals, typecode)
150 + xvals = numpy.asarray(xvals, dtype)
151 + yvals = numpy.asarray(yvals, dtype)
152
153 if ufunc:
154 - return f(xvals[:,Numeric.NewAxis], yvals[Numeric.NewAxis,:])
155 + return f(xvals[:,numpy.newaxis], yvals[numpy.newaxis,:])
156 else:
157 - if typecode is None:
158 + if dtype is None:
159 # choose a result typecode based on what '+' would return
160 # (yecch!):
161 - typecode = (Numeric.zeros((1,), xvals.typecode()) +
162 - Numeric.zeros((1,), yvals.typecode())).typecode()
163 -
164 - m = Numeric.zeros((len(xvals), len(yvals)), typecode)
165 + dtype = (numpy.zeros((1,), xvals.dtype.char) +
166 + numpy.zeros((1,), yvals.dtype.char)).dtype.char
167 + m = numpy.zeros((len(xvals), len(yvals)), dtype)
168 for xi in range(len(xvals)):
169 x = xvals[xi]
170 for yi in range(len(yvals)):
171 diff -ur gnuplot-py-1.7/_Gnuplot.py gnuplot-py-1.7-numpy/_Gnuplot.py
172 --- gnuplot-py-1.7/_Gnuplot.py 2003-10-17 17:28:10.000000000 +0300
173 +++ gnuplot-py-1.7-numpy/_Gnuplot.py 2007-11-20 22:37:26.000000000 +0200
174 @@ -228,8 +228,8 @@
175
176 'items' is a sequence of items, each of which should be a
177 'PlotItem' of some kind, a string (interpreted as a function
178 - string for gnuplot to evaluate), or a Numeric array (or
179 - something that can be converted to a Numeric array).
180 + string for gnuplot to evaluate), or a numpy array (or
181 + something that can be converted to a numpy array).
182
183 """
184
185 diff -ur gnuplot-py-1.7/__init__.py gnuplot-py-1.7-numpy/__init__.py
186 --- gnuplot-py-1.7/__init__.py 2003-10-17 18:04:29.000000000 +0300
187 +++ gnuplot-py-1.7-numpy/__init__.py 2007-11-20 22:19:00.000000000 +0200
188 @@ -128,9 +128,9 @@
189
190 Restrictions:
191
192 - - Relies on the Numeric Python extension. This can be obtained from
193 - "SourceForge", http://sourceforge.net/projects/numpy/. If you're
194 - interested in gnuplot, you would probably also want NumPy anyway.
195 + - Relies on the numpy Python extension. This can be obtained from
196 + the Scipy group at <http://www.scipy.org/Download>.. If you're
197 + interested in gnuplot, you would probably also want numpy anyway.
198
199 - Only a small fraction of gnuplot functionality is implemented as
200 explicit method functions. However, you can give arbitrary
201 diff -ur gnuplot-py-1.7/NEWS.txt gnuplot-py-1.7-numpy/NEWS.txt
202 --- gnuplot-py-1.7/NEWS.txt 2003-10-17 18:04:29.000000000 +0300
203 +++ gnuplot-py-1.7-numpy/NEWS.txt 2007-11-20 22:22:08.000000000 +0200
204 @@ -57,7 +57,7 @@
205 equivalent.) If I find the time I might try to produce a version
206 that doesn't require Numeric at all, under either Python or Jython.
207
208 -* Removed the oldplot.py module: (1) I doubt anybody is still using
209 + Removed the oldplot.py module: (1) I doubt anybody is still using
210 it. (2) It seems to be broken anyway. (3) I don't have the energy to
211 fix or maintain it. Let me know if I'm wrong about point 1.
212
213 @@ -222,10 +222,10 @@
214 dataset; e.g., what used to be written as
215
216 g = Gnuplot.Gnuplot()
217 - x = Numeric.arange(100)/10.0
218 + x = numpy.arange(100)/10.0
219 y = x**2
220 # Create an array of (x,y) pairs:
221 - g.plot(Gnuplot.Data(Numeric.transpose((x, y))))
222 + g.plot(Gnuplot.Data(numpy.transpose((x, y))))
223
224 can now be shortened to
225
226 diff -ur gnuplot-py-1.7/PlotItems.py gnuplot-py-1.7-numpy/PlotItems.py
227 --- gnuplot-py-1.7/PlotItems.py 2003-10-17 17:39:03.000000000 +0300
228 +++ gnuplot-py-1.7-numpy/PlotItems.py 2007-11-20 22:34:49.000000000 +0200
229 @@ -23,7 +23,7 @@
230 except ImportError:
231 from StringIO import StringIO
232
233 -import Numeric
234 +import numpy
235
236 import gp, utils, Errors
237
238 @@ -471,12 +471,12 @@
239 return apply(_FileItem, (filename,), keyw)
240
241
242 -def Data(*set, **keyw):
243 - """Create and return a _FileItem representing the data from *set.
244 +def Data(*data, **keyw):
245 + """Create and return a _FileItem representing the data from *data.
246
247 Create a '_FileItem' object (which is a type of 'PlotItem') out of
248 - one or more Float Python Numeric arrays (or objects that can be
249 - converted to a Float Numeric array). If the routine is passed a
250 + one or more Float Python numpy arrays (or objects that can be
251 + converted to a float numpy array). If the routine is passed a
252 single with multiple dimensions, then the last index ranges over
253 the values comprising a single data point (e.g., [<x>, <y>,
254 <sigma>]) and the rest of the indices select the data point. If
255 @@ -508,29 +508,29 @@
256
257 """
258
259 - if len(set) == 1:
260 - # set was passed as a single structure
261 - set = utils.float_array(set[0])
262 + if len(data) == 1:
263 + # data was passed as a single structure
264 + data = utils.float_array(data[0])
265
266 # As a special case, if passed a single 1-D array, then it is
267 # treated as one value per point (by default, plotted against
268 # its index):
269 - if len(set.shape) == 1:
270 - set = set[:,Numeric.NewAxis]
271 + if len(data.shape) == 1:
272 + data = data[:,numpy.newaxis]
273 else:
274 - # set was passed column by column (for example,
275 + # data was passed column by column (for example,
276 # Data(x,y)); pack it into one big array (this will test
277 # that sizes are all the same):
278 - set = utils.float_array(set)
279 - dims = len(set.shape)
280 + data = utils.float_array(data)
281 + dims = len(data.shape)
282 # transpose so that the last index selects x vs. y:
283 - set = Numeric.transpose(set, (dims-1,) + tuple(range(dims-1)))
284 + data = numpy.transpose(data, (dims-1,) + tuple(range(dims-1)))
285 if keyw.has_key('cols'):
286 cols = keyw['cols']
287 del keyw['cols']
288 - if type(cols) is types.IntType:
289 + if isinstance(cols, types.IntType):
290 cols = (cols,)
291 - set = Numeric.take(set, cols, -1)
292 + data = numpy.take(data, cols, -1)
293
294 if keyw.has_key('inline'):
295 inline = keyw['inline']
296 @@ -540,7 +540,7 @@
297
298 # Output the content into a string:
299 f = StringIO()
300 - utils.write_array(f, set)
301 + utils.write_array(f, data)
302 content = f.getvalue()
303 if inline:
304 return apply(_InlineFileItem, (content,), keyw)
305 @@ -610,7 +610,7 @@
306 raise Errors.DataError('data array must be two-dimensional')
307
308 if xvals is None:
309 - xvals = Numeric.arange(numx)
310 + xvals = numpy.arange(numx)
311 else:
312 xvals = utils.float_array(xvals)
313 if xvals.shape != (numx,):
314 @@ -619,7 +619,7 @@
315 'the first dimension of the data array')
316
317 if yvals is None:
318 - yvals = Numeric.arange(numy)
319 + yvals = numpy.arange(numy)
320 else:
321 yvals = utils.float_array(yvals)
322 if yvals.shape != (numy,):
323 @@ -647,17 +647,17 @@
324 # documentation has the roles of x and y exchanged. We ignore
325 # the documentation and go with the code.
326
327 - mout = Numeric.zeros((numy + 1, numx + 1), Numeric.Float32)
328 + mout = numpy.zeros((numy + 1, numx + 1), numpy.float32)
329 mout[0,0] = numx
330 - mout[0,1:] = xvals.astype(Numeric.Float32)
331 - mout[1:,0] = yvals.astype(Numeric.Float32)
332 + mout[0,1:] = xvals.astype(numpy.float32)
333 + mout[1:,0] = yvals.astype(numpy.float32)
334 try:
335 # try copying without the additional copy implied by astype():
336 - mout[1:,1:] = Numeric.transpose(data)
337 + mout[1:,1:] = numpy.transpose(data)
338 except:
339 # if that didn't work then downcasting from double
340 # must be necessary:
341 - mout[1:,1:] = Numeric.transpose(data.astype(Numeric.Float32))
342 + mout[1:,1:] = numpy.transpose(data.astype(numpy.float32))
343
344 content = mout.tostring()
345 if gp.GnuplotOpts.prefer_fifo_data:
346 @@ -668,10 +668,10 @@
347 # output data to file as "x y f(x)" triplets. This
348 # requires numy copies of each x value and numx copies of
349 # each y value. First reformat the data:
350 - set = Numeric.transpose(
351 - Numeric.array(
352 - (Numeric.transpose(Numeric.resize(xvals, (numy, numx))),
353 - Numeric.resize(yvals, (numx, numy)),
354 + set = numpy.transpose(
355 + numpy.array(
356 + (numpy.transpose(numpy.resize(xvals, (numy, numx))),
357 + numpy.resize(yvals, (numx, numy)),
358 data)), (1,2,0))
359
360 # Now output the data with the usual routine. This will
361 diff -ur gnuplot-py-1.7/README.txt gnuplot-py-1.7-numpy/README.txt
362 --- gnuplot-py-1.7/README.txt 2003-10-19 17:52:35.000000000 +0300
363 +++ gnuplot-py-1.7-numpy/README.txt 2007-11-20 22:35:30.000000000 +0200
364 @@ -65,8 +65,8 @@
365
366 Obviously, you must have the gnuplot program if Gnuplot.py is to be of
367 any use to you. Gnuplot can be obtained via
368 -<http://www.gnuplot.info>. You also need Python's Numerical
369 -extension, which is available from <http://numpy.sourceforge.net>.
370 +<http://www.gnuplot.info>. You also need a copy of the numpy package, which
371 +is available from the Scipy group at <http://www.scipy.org/Download>.
372
373 Gnuplot.py uses Python distutils
374 <http://www.python.org/doc/current/inst/inst.html> and can be
375 diff -ur gnuplot-py-1.7/setup.py gnuplot-py-1.7-numpy/setup.py
376 --- gnuplot-py-1.7/setup.py 2003-10-17 17:52:28.000000000 +0300
377 +++ gnuplot-py-1.7-numpy/setup.py 2007-11-20 22:19:20.000000000 +0200
378 @@ -31,7 +31,7 @@
379 author_email='mhagger@××××××××.edu',
380 url='http://gnuplot-py.sourceforge.net',
381 license='LGPL',
382 - licence='LGPL', # Spelling error in distutils
383 + #licence='LGPL', # Spelling error in distutils
384
385 # Description of the package in the distribution
386 package_dir={'Gnuplot' : '.'},
387 diff -ur gnuplot-py-1.7/test.py gnuplot-py-1.7-numpy/test.py
388 --- gnuplot-py-1.7/test.py 2003-10-17 17:28:10.000000000 +0300
389 +++ gnuplot-py-1.7-numpy/test.py 2007-11-20 22:43:26.000000000 +0200
390 @@ -17,8 +17,7 @@
391 __cvs_version__ = '$Revision: 1.1 $'
392
393 import os, time, math, tempfile
394 -import Numeric
395 -from Numeric import NewAxis
396 +import numpy
397
398 try:
399 import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
400 @@ -55,7 +54,7 @@
401 filename1 = tempfile.mktemp()
402 f = open(filename1, 'w')
403 try:
404 - for x in Numeric.arange(100)/5. - 10.:
405 + for x in numpy.arange(100.)/5. - 10.:
406 f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x)))
407 f.close()
408
409 @@ -137,10 +136,10 @@
410 g.plot(f)
411
412 print '############### test Data ###################################'
413 - x = Numeric.arange(100)/5. - 10.
414 - y1 = Numeric.cos(x)
415 - y2 = Numeric.sin(x)
416 - d = Numeric.transpose((x,y1,y2))
417 + x = numpy.arange(100)/5. - 10.
418 + y1 = numpy.cos(x)
419 + y2 = numpy.sin(x)
420 + d = numpy.transpose((x,y1,y2))
421
422 wait('Plot Data against its index')
423 g.plot(Gnuplot.Data(y2, inline=0))
424 @@ -173,7 +172,7 @@
425 g.plot(Gnuplot.Data(d, title='Cosine of x'))
426
427 print '############### test compute_Data ###########################'
428 - x = Numeric.arange(100)/5. - 10.
429 + x = numpy.arange(100)/5. - 10.
430
431 wait('Plot Data, computed by Gnuplot.py')
432 g.plot(Gnuplot.funcutils.compute_Data(x, lambda x: math.cos(x), inline=0))
433 @@ -235,14 +234,14 @@
434
435 print '############### test GridData and compute_GridData ##########'
436 # set up x and y values at which the function will be tabulated:
437 - x = Numeric.arange(35)/2.0
438 - y = Numeric.arange(30)/10.0 - 1.5
439 + x = numpy.arange(35)/2.0
440 + y = numpy.arange(30)/10.0 - 1.5
441 # Make a 2-d array containing a function of x and y. First create
442 # xm and ym which contain the x and y values in a matrix form that
443 # can be `broadcast' into a matrix of the appropriate shape:
444 - xm = x[:,NewAxis]
445 - ym = y[NewAxis,:]
446 - m = (Numeric.sin(xm) + 0.1*xm) - ym**2
447 + xm = x[:,numpy.newaxis]
448 + ym = y[numpy.newaxis,:]
449 + m = (numpy.sin(xm) + 0.1*xm) - ym**2
450 wait('a function of two variables from a GridData file')
451 g('set parametric')
452 g('set data style lines')
453 @@ -264,7 +263,7 @@
454
455 wait('Use compute_GridData in ufunc and binary mode')
456 g.splot(Gnuplot.funcutils.compute_GridData(
457 - x,y, lambda x,y: Numeric.sin(x) + 0.1*x - y**2,
458 + x,y, lambda x,y: numpy.sin(x) + 0.1*x - y**2,
459 ufunc=1, binary=1,
460 ))
461
462 diff -ur gnuplot-py-1.7/utils.py gnuplot-py-1.7-numpy/utils.py
463 --- gnuplot-py-1.7/utils.py 2003-10-17 17:38:44.000000000 +0300
464 +++ gnuplot-py-1.7-numpy/utils.py 2007-11-20 22:21:24.000000000 +0200
465 @@ -17,28 +17,32 @@
466 __cvs_version__ = '$Revision: 1.1 $'
467
468 import string
469 -import Numeric
470 +import numpy
471
472
473 def float_array(m):
474 - """Return the argument as a Numeric array of type at least 'Float32'.
475 + """Return the argument as a numpy array of type at least 'Float32'.
476
477 Leave 'Float64' unchanged, but upcast all other types to
478 'Float32'. Allow also for the possibility that the argument is a
479 - python native type that can be converted to a Numeric array using
480 - 'Numeric.asarray()', but in that case don't worry about
481 + python native type that can be converted to a numpy array using
482 + 'numpy.asarray()', but in that case don't worry about
483 downcasting to single-precision float.
484
485 """
486
487 try:
488 # Try Float32 (this will refuse to downcast)
489 - return Numeric.asarray(m, Numeric.Float32)
490 + return numpy.asarray(m, numpy.float32)
491 except TypeError:
492 # That failure might have been because the input array was
493 - # of a wider data type than Float32; try to convert to the
494 + # of a wider data type than float32; try to convert to the
495 # largest floating-point type available:
496 - return Numeric.asarray(m, Numeric.Float)
497 + try:
498 + return numpy.asarray(m, numpy.float_)
499 + except TypeError:
500 + print "Fatal: array dimensions not equal!"
501 + return None
502
503
504 def write_array(f, set,
505
506
507
508 1.1 dev-python/gnuplot-py/files/digest-gnuplot-py-1.7-r2
509
510 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
511 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
512
513 Index: digest-gnuplot-py-1.7-r2
514 ===================================================================
515 MD5 724f9eee164d6ff763777b22a5851572 gnuplot-py-1.7.tar.gz 107278
516 RMD160 0d0f465f0dad0e3ff35f6bdea5fc6ea9ab1b245f gnuplot-py-1.7.tar.gz 107278
517 SHA256 78e8716324b654337801fd68212cc2184a81313421086df301718c19bb49e216 gnuplot-py-1.7.tar.gz 107278
518
519
520
521 --
522 gentoo-commits@g.o mailing list