Hi James,

1. The first example should really throw an exception, because silent failures like this can be catastrophic:

py> from numpy import random
py> r = random.randint(2, size=10)
py> r
array([1, 0, 1, 1, 0, 1, 0, 1, 1, 1])
py> list(flex.bool(r))
[True, False, False, False, False, False, False, False, False, False]

This example is clearly due to incorrect assumptions about the internal representations of numpy ndarrays.

As far as I can tell, this is much worse than that as the numpy-to-flex conversion assumes the same element type in the source and target array. 
Thus converting a numpy array of int's into a flex array of bools is illegal but this precondition is not asserted unfortunately.
Nasty indeed. I do not understand numpy well enough to propose a solution, I am afraid.

2. Although not as potentially catastrophic as the first, t

py> flex.int(range(10))[r[0]]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/jstroud/Unison/Code/radialx/testdata/<ipython-input-753-f14587f0ceeb> in <module>()
----> 1 flex.int(range(10))[r[0]]

TypeError: 'numpy.int64' object is not iterable

For flex arrays, the following __getitem__ variants are tried in this order:
1. one that takes a tuple
2. one that takes a slice
3. one that takes a single index, of type long in C++

The problem I think is that we are missing a registered conversion from the type numpy.int64 to the type long, and therefore all 3 variants fail. 
Somehow the first failure is reported.

Best wishes,

Luc