[cctbxbb] Flex array slice assignment work-alike
luc_j_bourhis at mac.com
Thu Apr 11 08:18:20 PDT 2013
On 11 Apr 2013, at 09:49, James Stroud wrote:
> It seems that flex arrays do not support slice assignment:
it would not be too difficult to code 1-dimensional slice assignment but ...
On 11 Apr 2013, at 10:24, Graeme.Winter at Diamond.ac.uk wrote:
> array[k,:,:] = image.as_numpy_array()[y0:y1, x0:x1]
that's way more difficult!
This is the first time somebody voices such requests loud enough afaik. The Boost Python mapping of slicing is a bit of a mess: e.g. what Richard had to do to support multidimensional slicing for __getitem__ is quite scary. The argument cuts both ways of course, as adding those new features could be an opportunity to attempt to clean the code.
I will have a go in the coming weeks and I'll combine that with your request, James, for better conversions to and from numpy arrays. Unless Richard beats me to it!
More information about the cctbxbb