stefano.covino at brera.inaf.it
Wed Nov 4 05:37:26 EST 2015
> Stefano, if I understand you correctly, you have:
> index2, index1, d2d, d3d = coord1.search_around_sky(coord2, maxsep)
> and you want to find "~index2" and "~index1" (which, of course, don't exist like that).
> I actually assume you want to find the *coordinates* of the non-matched sources, not the indices. But both can be done.
> There's no simple one-liner that I know of, but creating a boolean mask is simple and useful to have around anyway (since a boolean mask can be simply inverted, unlike a array of indices).
> ind1 = np.unique(index1)
> mask = np.ones(len(coord1), dtype=np.bool)
> mask[ind1] = False
> nonmatched_coord1 = coord1[mask]
> nonmatched_ind1 = np.arange(len(coord1))[mask]
> and similar for coord2.
> I'm using np.unique to filter multiple matched objects. It's not really necessary here, but more as an ease of mind. (Otherwise you'd just be setting some values in the mask to False twice.)
> The last line is to get the indices, and essentially coord1[nonmatched_ind1] == nonmatched_coord1 .
Thanks a lot, Evert.
It is indeed what I was looking for.
More information about the AstroPy