def test_regression_4082(): """ Issue: https://github.com/astropy/astropy/issues/4082 """ from astropy.coordinates import search_around_sky, search_around_3d cat = SkyCoord([10.076, 10.00455], [18.54746, 18.54896], unit='deg') search_around_sky(cat[0:1], cat, seplimit=u.arcsec * 60, storekdtree=False) # in the issue, this raises a TypeError # also check 3d for good measure, although it's not really affected by this bug directly cat3d = SkyCoord([10.076, 10.00455]*u.deg, [18.54746, 18.54896]*u.deg, distance=[0.1, 1.5]*u.kpc) search_around_3d(cat3d[0:1], cat3d, 1*u.kpc, storekdtree=False)
def indices_xfind_coords( coords1, coords2, maxdist=1 * u.arcsec, obstime=None, ): """Indices of X-Find coords. Returns ------- idx1 : integer array idx2 : integer array indices into `other` for all coordinates which have a "match" in `catalog`. info : dict Useful information # TODO See Also -------- :func:`~astropy.coordinates.search_around_sky` :func:`~astropy.coordinates.search_around_3d` """ if u.get_physical_type(maxdist.unit) == "angle": idx1, idx2, sep2d, dist3d = coord.search_around_sky( coords1, coords2, seplimit=maxdist, ) elif u.get_physical_type(maxdist.unit) == "length": idx1, idx2, sep2d, dist3d = coord.search_around_3d( coords1, coords2, distlimit=maxdist, ) info = {"sep2d": sep2d, "dist3d": dist3d} return idx1, idx2, info