Reputation:
Given two numpy array masks, created with the 3rd and 4th columns of data of 7 columns total:
exp_mask = np.repeat(data[:,2]>7., data.shape[1])
loggf_mask = np.repeat(data[:,3]<-7., data.shape[1])
How can I mask data which are masked by either exp_mask
or loggf_mask
?
The logic of what I am trying to describe is:
mask = exp_mask or loggf_mask
Upvotes: 1
Views: 2892
Reputation: 69172
You can use either bitwise_or
, which also has the |
shorthand, or logical_or
. Both will work since your array will be of type bool
:
mask = exp_mask | loggf_mask
Upvotes: 1
Reputation:
You can use np.any() to evaluate boolean or on masks:
mask = np.any([exp_mask,loggf_mask],axis=0)
Upvotes: 1