[Numpy-discussion] how to delete the duplicated data in numpy?

2009-04-06 Thread frank wang
Hi, I have just noticed that I did not change the title of my question. So I resend it out. Sorry for the mistake. Here is my question. I have a big 2 column data file where the data are repeated either 5 or 6 times. Are there any quick way to remove the duplicated data? Thanks Fran

Re: [Numpy-discussion] replace voids in 2d dat with nearest neighbour value

2009-04-06 Thread frank wang
Hi, I have a big 2 column data file where the data are repeated either 5 or 6 times. Are there any quick way to remove the duplicated data? Thanks Frank _ Rediscover HotmailĀ®: Get e-mail storage that grows with you. htt

Re: [Numpy-discussion] help on fast slicing on a grid

2009-01-30 Thread frank wang
Hi, Bob, Thanks. This solution works great. It really helps me a lot. Frank> Date: Fri, 30 Jan 2009 23:08:35 -0600> From: robert.k...@gmail.com> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] help on fast slicing on a grid> > On Fri, Jan 30, 2009 at

Re: [Numpy-discussion] help on fast slicing on a grid

2009-01-30 Thread frank wang
slicing on a grid> > On Fri, Jan 30, 2009 at 12:58, frank wang wrote:> > I have created a test example for the question using for loop and hope> > someone can help me to get fast solution. My data set is about 200 data.> >> > However, I have the problem to run

Re: [Numpy-discussion] help on fast slicing on a grid

2009-01-30 Thread frank wang
) Thanks Frank> Date: Thu, 29 Jan 2009 00:15:48 -0600> From: robert.k...@gmail.com> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] help on fast slicing on a grid> > On Thu, Jan 29, 2009 at 00:09, frank wang wrote:> > Here is the for loop that I am think about

Re: [Numpy-discussion] help on fast slicing on a grid

2009-01-28 Thread frank wang
ast slicing on a grid> > On Thu, Jan 29, 2009 at 00:09, frank wang wrote:> > Here is the for loop that I am think about. Also, I do not know whether the> > where commands can handle the complicated logic.> > The where command basically find the data in the square

Re: [Numpy-discussion] help on fast slicing on a grid

2009-01-28 Thread frank wang
ipy.org> Subject: Re: [Numpy-discussion] help on fast > slicing on a grid> > On Wed, Jan 28, 2009 at 23:52, frank wang > wrote:> >> > Hi,> >> > I have to buidl a grid with 256 > point by the command:> > a = arange(-15,16,2)> > L = len(a)&g

[Numpy-discussion] help on fast slicing on a grid

2009-01-28 Thread frank wang
Hi, I have to buidl a grid with 256 point by the command: a = arange(-15,16,2) L = len(a) cnstl = a.reshape(L,1)+1j*a My problem is that I have a big data array that contains the data round the points in cnstl. I want to slice the point to the closest cnstl point and also compute the error.

Re: [Numpy-discussion] Importance of order when summing values in anarray

2008-12-10 Thread frank wang
On my two systems with Intel Core2 DUO, finfo(float128) gives me the nameerro, "NameError: name 'float128' is not defined". Why? Thanks Frank> Date: Tue, 9 Dec 2008 21:10:32 -0600> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] Importance of order w

Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-10 Thread frank wang
e the memory?> > On Mon, Dec 8, 2008 at 19:15, frank wang <[EMAIL PROTECTED]> wrote:> > Hi,> >> > I have a program with some variables consume a lot of memory. The first time> > I run it, it is fine. The second time I run it, I will get MemoryError. If I> &

[Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-08 Thread frank wang
Hi, I have a program with some variables consume a lot of memory. The first time I run it, it is fine. The second time I run it, I will get MemoryError. If I close the ipython and reopen it again, then I can run the program once. I am looking for a command to delete the intermediate variable

Re: [Numpy-discussion] how to create a matrix based on a vector?

2008-12-08 Thread frank wang
Dec 8, 2008 at 11:27, frank wang <[EMAIL PROTECTED]> wrote:> > Hi,> >> > I want to create a matrix based on a vector. It is difficult to describe the> > issue for me in english. Here is an example.> >> > Suppose I have an array([3, 6, 8, 12]), I want

[Numpy-discussion] how to create a matrix based on a vector?

2008-12-08 Thread frank wang
Hi, I want to create a matrix based on a vector. It is difficult to describe the issue for me in english. Here is an example. Suppose I have an array([3, 6, 8, 12]), I want to create a range based on each element. In this exampe, let us say want to create 4 number with step 2, so I will ha

Re: [Numpy-discussion] fast way to convolve a 2d array with 1d filter

2008-12-01 Thread frank wang
o: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] fast way to convolve a 2d array with 1d filter> > Hi Frank> > > 2008/12/2 frank wang <[EMAIL PROTECTED]>:> > I need to convolve a 1d filter with 8 coefficients with a 2d array of the> > shape (6,7). I c

[Numpy-discussion] fast way to convolve a 2d array with 1d filter

2008-12-01 Thread frank wang
Hi, I need to convolve a 1d filter with 8 coefficients with a 2d array of the shape (6,7). I can use convolve to perform the operation for each row. This will involve a for loop with a counter 6. I wonder there is an fast way to do this in numpy without using for loop. Does anyone know how to

[Numpy-discussion] Fast and efficient way to convert an array into binary

2008-11-18 Thread frank wang
Hi, I have a large array and I want to convert it into a binary array. For exampe, y=array([1,2,3]), after the convertion I want the result array([0,0,0,1,0,0,1,0,0,0,1,1]). Each digit is converted into 4 bits in this example. In my real problem I want to convert each digit to 8 bits. My data

Re: [Numpy-discussion] fill() function does not work.

2008-11-18 Thread frank wang
ll(value) -> None. Fill the array with the scalar value.> > The method modifies the array, but does not return it.> > Matthieu> > 2008/11/18 frank wang <[EMAIL PROTECTED]>:> > Hi,> >> > My numpy is 1.2.1 and python is 2.5.2.> >> > In pyt

[Numpy-discussion] fill() function does not work.

2008-11-18 Thread frank wang
Hi, My numpy is 1.2.1 and python is 2.5.2. In python, I did: from numpy import * x=array([1,2,3]) z=x.fill(x) print z None z should be filled with zero. I do not knwo why I got None. Can anyone help me on this? Thanks Frank

Re: [Numpy-discussion] Numpy and MKL, update

2008-11-13 Thread frank wang
Hi, Can you provide a working example to build Numpy with MKL in window and linux? The reason I am thinking to build the system is that I need to make the speed match with matlab. Thanks frank> Date: Thu, 13 Nov 2008 11:39:42 +0100> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org

[Numpy-discussion] Numpy Example List With Doc cannot be printed

2008-11-13 Thread frank wang
Hi, >From www.scipy.org web site, I tried to print the "Numpy Example List with >Doc". Even though I can read the document on the computer, but when I printed, >except of the first few pages, all pages printed empty. Does anyone know the reason? Thanks Frank

[Numpy-discussion] signal processing filter operation in numpy

2008-11-06 Thread frank wang
Hi, I need to perform iir filter operation using numpy and could not googled any useful info for this. Are there filter operation similar the matlab filter funciton in Numpy? Thanks Frank _ Color coding for safety: Windows Liv

Re: [Numpy-discussion] help to speed up the python code

2008-10-30 Thread frank wang
[Numpy-discussion] help to speed up the python code> > On Fri, Oct 24, 2008 at 11:30, frank wang <[EMAIL PROTECTED]> wrote:> > Hi,> >> > I have to send this request second time since my first message contains the> > attached data file which is too big and wa

[Numpy-discussion] (no subject)

2008-10-30 Thread frank wang
Hi, In my work, I want to implement a fir filter with an input array. Since performing the filter on each input sample is slow, are there fast way to perform the fir filter operation? Are there ways to convert input into an array and perform the array multipication? Thanks Frank

[Numpy-discussion] help to speed up the python code

2008-10-24 Thread frank wang
Hi, I have to send this request second time since my first message contains the attached data file which is too big and was blocked by the system. So this time I will not attach the data file. I have converted a matlab function to python using numpy. both matlab and python run slow. I know

[Numpy-discussion] how to save a large array into a file quickly

2008-10-14 Thread frank wang
Hi, I have a large ndarray that I want to dump to a file. I know that I can use a for loop to write one data at a time. Since Python is a very powerfully language, I want to find a way that will dump the data fast and clean. The data can be in floating point or integer. Thanks Frank _

Re: [Numpy-discussion] Help to process a large data file

2008-10-02 Thread frank wang
es with 1> > but on my machine the numpy version takes about 20 > sec for a 'foo' file > of 2,500,000 lines versus 1.2 sec for the pure python > version...> > As a side note, if i replace "line == '1 1\n'" with > "line.startswith('1 >

[Numpy-discussion] Help to process a large data file

2008-10-01 Thread frank wang
Hi, I have a large data file which contains 2 columns of data. The two columns only have zero and one. Now I want to cound how many one in between if both columns are one. For example, if my data is: 1 0 0 0 1 1 0 0 0 1x 0 1x 0 0 0 1x 1 1 0 0 0 1x 0 1x 1 1 Then my

Re: [Numpy-discussion] Are there command similar as Matlab find command?

2008-09-29 Thread frank wang
appreciate the help I got from the forum. Frank> Date: Mon, 29 Sep 2008 20:22:14 -0500> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] Are there command similar as Matlab find command?> > On Mon, Sep 29, 2008 at 20:16, frank wang

Re: [Numpy-discussion] Are there command similar as Matlab find command?

2008-09-29 Thread frank wang
t') (Pdb) It does not return any result. Frank> Date: Mon, 29 Sep 2008 16:48:23 -0500> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] Are there command similar as Matlab find command?> > frank wang wrote:> > Hi,> > >

[Numpy-discussion] Are there command similar as Matlab find command?

2008-09-29 Thread frank wang
D]> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] loadtxt error> > 2008/9/24 frank wang <[EMAIL PROTECTED]>:> > Thank you very much for all of you. I have downloaded the binary version> > 1.2rc and it fixed the problem.> >> > My special th

Re: [Numpy-discussion] performance of the numpy

2008-09-24 Thread frank wang
Hi, All, I am using ipython with --pylab flag. ipython loads the numpy into the workspace, so I do not know abs is from python or numpy. The weird thing is if I execute the code line by line, I do not have any speed problem. But when I combine them together into one command, it slowdonws the

Re: [Numpy-discussion] loadtxt error

2008-09-24 Thread frank wang
Thank you very much for all of you. I have downloaded the binary version 1.2rc and it fixed the problem. My special thanks to the person who created the window binary version for users who do not know or do not have the capacity to build the numpy from source. Frank> Date: Wed, 24 Sep 200

[Numpy-discussion] performance of the numpy

2008-09-23 Thread frank wang
Hi, I am new user from matlab world. So I always compare with matlab. in my code, i have a large array with about 10 data. when I perform c=fft(b) d=abs(c) plot(d) I got good response. however, when i try to execute: plot(abs(fft(b))) it takes forever and i have to kill the operation.

Re: [Numpy-discussion] loadtxt error

2008-09-23 Thread frank wang
e-packages\numpy\lib\io.py(339)loadtxt()338 if usecols:--> 339 i = usecols.find(i)340 converters[i] = conv Thanks Frank> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org> Date: Mon, 22 Sep 2008 20:10:11 -0400> Subject: Re: [Numpy-discussion] lo

Re: [Numpy-discussion] loadtxt error

2008-09-23 Thread frank wang
been fixed in the trunk a couple of weeks ago. Cheers, David On Mon, Sep 22, 2008 at 8:10 PM, Pierre GM <[EMAIL PROTECTED]> wrote: On Monday 22 September 2008 19:56:47 frank wang wrote:> This error is caused that the usecols is a tuple and it does not have find> command. I do not know

Re: [Numpy-discussion] loadtxt error

2008-09-22 Thread frank wang
yours. I do not know why it is working for you.> Date: Mon, 22 Sep 2008 22:13:18 +0200> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] loadtxt error> > 2008/9/22 frank wang <[EMAIL PROTECTED]>:> > It will load an array ha

Re: [Numpy-discussion] loadtxt error

2008-09-22 Thread frank wang
= conv This command is the same as yours. I do not know why it is working for you.> Date: Mon, 22 Sep 2008 22:13:18 +0200> From: [EMAIL PROTECTED]> To: numpy-discussion@scipy.org> Subject: Re: [Numpy-discussion] loadtxt error> > 2008/9/22 frank wang <[EMAIL PROTEC

[Numpy-discussion] loadtxt error

2008-09-22 Thread frank wang
Hi, All, I am struggling to make the loadtxt works. In my file, I have several colunms of data, say I have two. When I use the following command to load the data, fid=loadtxt('filename.csv',comments='"',dtype='|S4',converters={0:lambda s:int(s,16)}) It will load an array has two columns.

Re: [Numpy-discussion] A bug in loadtxt and how to convert a string array (hex data) to decimal?

2008-09-18 Thread frank wang
ay (hex data) to decimal?> > frank wang wrote:> > > > > > > > Hi, All,> > > > > > > > > > > > I have found a bug in the loadtxt function. Here is the example. The > > file name is test.txt and contains:> > > >

[Numpy-discussion] A bug in loadtxt and how to convert a string array (hex data) to decimal?

2008-09-18 Thread frank wang
Hi, All, I have found a bug in the loadtxt function. Here is the example. The file name is test.txt and contains: "Thist is test" 3FF 3fE 3Ef 3e8 3Df 3d9 3cF 3c7 In the Python 2.5.2, I type: test=loadtxt('test.txt',comments='"',dtype='string',converters={0:lambda s:int(s,16)}) test will