[Numpy-discussion] ndarray sub-classing and append function

2012-03-30 Thread Prashant Saxena
Hi, I am sub-classing numpy.ndarry for vector array representation. The append function is like this:     def append(self, other):        self = numpy.append(self, [other], axis=0) Example: vary = VectorArray([v1, v2]) #vary = numpy.append(vary, [v1], axis=0) vary.append(v1) The commented synt

[Numpy-discussion] numpy/numexpr performance (particle simulation)

2009-06-29 Thread Prashant Saxena
Hi, I am doing a little test using numpy and numexpr to do a particle simulation. I never used either of them much and this is the first time I have to go deeper. Here is the code: import numpy as np import numexpr as nexpr class Particle( object ): def __init__( self, id ): s

Re: [Numpy-discussion] image processing using numpy-scipy?

2009-02-27 Thread Prashant Saxena
Well, I came up with a slightly different approach. Get the first row on the image. It would be something like this: [1,1,1,0,0,0,1,1,0,0,1] 1 = white, 0 = black. Run the floodfill on [0],[6] and [10] pixel if floodfill area is smaller then given area then paint that area black if floodfill area

[Numpy-discussion] image processing using numpy-scipy?

2009-02-27 Thread Prashant Saxena
Hi, This a little wiered problem. I am having a black and white image. (black background) Entire image is filled with noisy white patterns of different size and shape. I need to fill the white patches if there area is more then given one. Logically this could possible to use a quickfill algorit

[Numpy-discussion] replace array values efficiently

2009-01-08 Thread Prashant Saxena
Hi, I am new to numpy and getting my hands on slowly. How do you replace integers from strings in an integer array. (1D) For example: array = {1,1,1,2,3,3,4} replace 1 with "apple" replace 2 with "cheery" replace 3 with "mango" replace 4 with "banana" I know the general solution, but I am lo

Re: [Numpy-discussion] array not appending

2008-12-18 Thread Prashant Saxena
December, 2008 4:20:49 PM Subject: Re: [Numpy-discussion] array not appending On Thu, Dec 18, 2008 at 04:19:20PM +0530, Prashant Saxena wrote: >How do I solve this? If you want appending in place you have to use a python list. If you don't need modification in place, np.append returns

Re: [Numpy-discussion] array not appending

2008-12-18 Thread Prashant Saxena
How do I solve this? Thanks Prashant From: Gael Varoquaux To: Discussion of Numerical Python Sent: Thursday, 18 December, 2008 4:03:34 PM Subject: Re: [Numpy-discussion] array not appending On Thu, Dec 18, 2008 at 03:52:23PM +0530, Prashant Saxena wrote

[Numpy-discussion] array not appending

2008-12-18 Thread Prashant Saxena
Hi, This is copied from ipython console. In [42]: import numpy as np In [43]: ST = np.empty([], dtype=np.float32) In [44]: np..append(ST, 10.0) Out[44]: array([ 3.8603e-38, 1.e+01]) In [45]: np.append(ST, 10.0) Out[45]: array([ 3.8603e-38, 1.e+01]) In [46]: prin

Re: [Numpy-discussion] numpy fileIO

2008-10-16 Thread Prashant Saxena
:22 PM Subject: Re: [Numpy-discussion] numpy fileIO A Thursday 16 October 2008, Prashant Saxena escrigué: > Hi, > > I have never used numpy in my python applications until now. I am > writing a python/openGL based tool to manipulate 3d geometrical > data(meshes, curve, points etc.) I

Re: [Numpy-discussion] numpy fileIO

2008-10-16 Thread Prashant Saxena
es you need, along with c++ routines for I/O, manipulation and (OpenGL) display, and a python interface. Nadav. -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Prashant Saxena נשלח: ה 16-אוקטובר-08 13:12 אל: numpy-discussion@scipy.org נושא: [Numpy-discussion] numpy fileIO Hi, I have never used

[Numpy-discussion] numpy fileIO

2008-10-16 Thread Prashant Saxena
Hi, I have never used numpy in my python applications until now. I am writing a python/openGL based tool to manipulate 3d geometrical data(meshes, curve, points etc.) I would be using numpy to store these objects(vertices, edges, faces, index etc.) at run time. One of my major concern is numpy'

[Numpy-discussion] first post, simple questions

2008-08-21 Thread Prashant Saxena
Hi, numpy rocks!!! import numpy linsp = numpy.linspace red = linsp(0, 255, 50) green = linsp(125, 150, 50) blue = linsp(175, 255, 50) array's elements are float. How do I convert them into integer? I need to build a new array from red, green, blue. like this: [[ red[0], green[0], blue[0] ], [