[cctbxbb] Inconsistency between numpy and flex (sclice notation)

Richard Gildea rgildea at gmail.com
Mon Jan 2 10:47:11 PST 2012


I think that the following does more or less what you want:

flex.show(grid[1:2,:])

Currently the multidimensional slicing only accepts slices as all the
arguments, not a mixture of slices and integers.

Richard

2012/1/2 Jan Marten Simons <marten at xtal.rwth-aachen.de>

> Hi,
>
> I've found a minor inconveniance using the flex type:
>
> test case:
>
> import numpy as np
> np_grid=np.double(np.zeros((3,7)))
> np_grid[1,3]=3.0
> print(np_grid)  # works
> print(np_grid[1,:])  # works
>
> from cctbx.array_family import flex
> grid=flex.double(flex.grid(3,7))
> grid[1,3]=3.0
> flex.show(grid)         #works
> flex.show(grid[1,:])  #gives error (see below)
>
> "TypeError: All items must be of same type."
>
> Is there another simple way to do sclices with flex arrays or could this be
> implemented the same way as in numpy by someone who is more into c++ than
> myself?
>
> Thanks,
> Jan
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20120102/5f51ab84/attachment.htm>


More information about the cctbxbb mailing list