Applying multiple masks to arrays

I think you're looking for the star operator:

fullmask = [all(mask) for mask in zip(*masks)]

...although I'm not sure I understand your data structure completely.


otherwise you can use boolean operators, let's define en example:

d=np.arange(10)
masks = [d>5, d % 2 == 0, d<8]

you can use reduce to combine all of them:

from functools import reduce

total_mask = reduce(np.logical_and, masks)

you can also use boolean operators explicitely if you need to manually choose the masks:

total_mask = masks[0] & masks[1] & masks[2]