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.

[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

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

2009-01-30 Thread frank wang
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 f...@hotmail.com wrote: Here is the for loop that I am think about. Also, I do not know whether the where

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 22:41, frank wang f

[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] help on fast slicing on a grid

2009-01-28 Thread frank wang
...@gmail.com To: numpy-discussion@scipy.org Subject: Re: [Numpy-discussion] help on fast slicing on a grid On Wed, Jan 28, 2009 at 23:52, frank wang f...@hotmail.com wrote: 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

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

2009-01-28 Thread frank wang
on fast slicing on a grid On Thu, Jan 29, 2009 at 00:09, frank wang f...@hotmail.com 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 around the point

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

2008-12-10 Thread frank wang
? 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 close the ipython and reopen it again, then I can run the program

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 when

[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

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

2008-12-08 Thread frank wang
, 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 to create a range based on each element. In this exampe, let us say want

[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

[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

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

2008-12-01 Thread frank wang
@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 can use convolve to perform the operation for each row

[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

[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

[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

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] 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

[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

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

2008-10-30 Thread frank wang
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 was blocked by the system. So this time I will not attach the data file. I have

[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

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

2008-10-02 Thread frank wang
' with line.startswith('1 1'), the pure python version goes up to 1.8 sec... Isn't this a bit weird, i'd think startswith() should be faster... Chris On Wed, Oct 01, 2008 at 07:27:27PM -0600, frank wang wrote: Hi,I have a large data file which contains 2 columns of data. The two

[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

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

2008-09-29 Thread frank wang
-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 thanks to the person who created the window binary version

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

2008-09-29 Thread frank wang
) 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,I am trying to find a command in numpy or python

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 [EMAIL PROTECTED] wrote

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

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-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 how to fix

Re: [Numpy-discussion] loadtxt error

2008-09-23 Thread frank wang
(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] loadtxt error On Monday 22 September 2008 19:56:47 frank wang wrote: This error is caused that the usecols

[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.

[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

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

2008-09-18 Thread frank wang
) 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: Thist is test 3FF 3fE 3Ef 3e8 3Df 3d9 3cF 3c7In the Python 2.5.2, I type: test