[cctbxbb] flex and numpy caveats

Luc Bourhis luc_j_bourhis at mac.com
Fri Apr 5 05:46:36 PDT 2013

Hi James,

> This may be more generally useful:
>     http://docs.scipy.org/doc/numpy/reference/c-api.array.html#PyArray_DTYPE
> The relevant fields of the returned PyArray_Descr seem to be kind, byteorder, and elsize.

thanks for digging that out. I can now envision how to compare the numpy array and the flex array element types. Lots of boring bookkeeping but definitively possible. 

However, we haven't address the important question: what behaviour do we really want?
(i) the numpy array and the flex array must have the same element type, and an exception is thrown if this precondition is violated;
(ii) we use a fast copy of the numpy array to the flex array if the element types are the same; otherwise we fall back to a slower conversion.

Best wishes,


More information about the cctbxbb mailing list