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

frank wang f.yw@hotmail....
Thu Jan 29 00:28:47 CST 2009

Hi, Bob,
Thanks for your help. 
I am sorry for my type error. qam array is the X array in my example.
cntl is a complex array contains the point (x,y) axises.
I will try to make a workable example. Also I will try to find out the zeros_like function. However, I guess that zeros_like(X) will create an array the same size as X. It it is. Then the two line Out=X and error=X should be Out=zeros_like(X) and error=zeros(X).
Also, can where command handel the logic command?
aa = np.where((real(X)<real(cnstl[j])+1) & (real(X)>real(cnstl[j])-1) & (imag(X)<imag(cnstl[j])+1) & (imag(X)>imag(cnstl[j]-1))
For example, cntl[j]=3+1j*5, then the where command is the same as:
aa = np.where((real(X)<4) & (real(X)>2 )& (imag(X)<6) & (imag(X)>4))
Frank> Date: Thu, 29 Jan 2009 00:15:48 -0600> From: robert.kern@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.yw@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> > cnstl[j].> > cnstl is a 2D array from your previous description.> > > Let the data array is qam with size N> > I don't see qam anywhere. Did you mean X?> > > Out = X> > error = X> > Don't you want something like zeros_like(X) for these?> > > for i in arange(N):> > for j in arange(L):> > aa = np.where((real(X)<real(cnstl[j])+1) &> > (real(X)>real(cnstl[j])-1) & (imag(X)<imag(cnstl[j])+1) &> > (imag(X)>imag(cnstl[j]-1))> > Out[aa]=cnstl[j]> > error[aa]=abs(X)**2 - abs(cnstl[j])**2> > I'm still confused. Can you show me a complete, working script with> possibly fake data?> > -- > Robert Kern> > "I have come to believe that the whole world is an enigma, a harmless> enigma that is made terrible by our own mad attempt to interpret it as> though it had an underlying truth."> -- Umberto Eco> _______________________________________________> Numpy-discussion mailing list> Numpy-discussion@scipy.org> http://projects.scipy.org/mailman/listinfo/numpy-discussion
Windows Live™: E-mail. Chat. Share. Get more ways to connect. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090128/e3ddd413/attachment-0001.html 

More information about the Numpy-discussion mailing list