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

frank wang f.yw@hotmail....
Thu Jan 29 00:09:01 CST 2009

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

Let the data array is qam with size N

Out = X
error = X
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

Thanks

Frank
> Date: Wed, 28 Jan 2009 23:57:16 -0600> From: robert.kern@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.yw@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)+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. The condition is in the middle of the two point in x> > and y axis. I can do it in a for loop. Since Python and numpy have a lot of> > magic, I want to find an efficient way to do. This problem arise from QAM> > 256 modulation.> > Can you show us the for loop? I'm not really sure what you want to compute.> > -- > 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.
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_allup_howitworks_012009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090128/838165ee/attachment.html
```