Sebastian Berg sipsolutions.net> writes:
>
> Python has a mechanism both for getting an item and for setting an item.
> The latter will end up doing this (python already does this for us):
> x[:,d,:,d] = x[:,d,:,d] + 1
> so there is an item assignment going on (__setitem__ not __getitem__)
>
> -
On Mi, 2015-02-04 at 07:22 +, David Kershaw wrote:
> The numpy reference manual, array objects/indexing/advance indexing,
> says:
> Advanced indexing always returns a copy of the data (contrast with
> basic slicing that returns a view).
>
> If I run the following code:
> import numpy as np
The numpy reference manual, array objects/indexing/advance indexing,
says:
Advanced indexing always returns a copy of the data (contrast with
basic slicing that returns a view).
If I run the following code:
import numpy as np
d=range[2]
x=np.arange(36).reshape(3,2,3,2)
y=x[:,d,:,d]
y+=1
p
On Wednesday 29 October 2008 01:44:06 Adam wrote:
> In [62]: temp2d = reshape(array3d,[23*337,107])
>
> In [63]: temp2d2 = zeros([23*337,144])
>
> In [64]: temp2d2[:,f.bolo_indices] = temp2d
>
> In [65]: array2d[whscan,:] = temp2d2
>
>
> This works, but it feels wrong to me: I think there should be
> In [85]: bi = (f.bolo_indices[np.newaxis,:]+
>
> ones([7751,1])).astype('int')
>
> In [86]: whc = (whscan[:,np.newaxis] + ones([1,107])).astype('int')
>
> In [87]: array2d[whc,bi] = temp2d
>
> I thought this had worked, but the values didn't seem to be going to the
> right places when I re-exami
Hi numpy group,
I have a problem I know there is an elegant solution to, but I can't
wrap my head around the right way to do the indexing.
The problem:
I have a 2D array that has been chopped up into 3 dimensions - it was [ time
X detectors ], it is now [ scans X time X detectors ]. During th