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

Robert Kern robert.kern@gmail....
Thu Jan 29 00:15:48 CST 2009

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

More information about the Numpy-discussion mailing list