choose

astropy.utils.masked.function_helpers.choose(a, choices, out=None, mode='raise')[source]

Construct an array from an index array and a set of arrays to choose from.

Like numpy.choose. Masked indices in a will lead to masked output values and underlying data values are ignored if out of bounds (for mode='raise'). Any values masked in choices will be propagated if chosen.