After using np.instersect1d
I have retrieved the indices that I want to retrieve. I want to turn these indices into a mask so I can then combine it with another mask.
What I am wanting:
>>> times_1.shape
... (160,)
>>> _, time_indices, _ = np.intersect1d(times_1, times_2, return_indices=True)
>>> time_indices.shape
... (145,)
# Some way to turn return mask from original shape and indices
>>> time_mask = get_mask_from_shape(time_1.shape, time_indices)
>>> time_mask.shape
... (160,)
What would be the simplest way to implement the function get_mask_from_shape
?