INNER CODE UNIT · Python
_xmatch_cds
jobovy/gaia_tools · gaia_tools/load/__init__.py:446
def _xmatch_cds(data,xcat,filePath,**kwargs):
if xcat.lower() == 'gaiadr2' or xcat.lower() == 'gaia2':
xcat= 'vizier:I/345/gaia2'
elif xcat.lower() == 'gaiaedr3' or xcat.lower() == 'gaiae3':
xcat= 'vizier:I/350/gaiaedr3'
maxdist= kwargs.pop('maxdist',2.)
# Check whether the cached x-match exists
xmatch_filename= xmatch_cache_filename(filePath,xcat,maxdist)
if os.path.exists(xmatch_filename):
with open(xmatch_filename,'rb') as savefile:
ma= pickle.load(savefile)
mai= pickle.load(savefile)
else:
from gaia_tools.xmatch import cds
ma,mai= cds(data,xcat=xcat,maxdist=maxdist,**kwargs)
save_pickles(xmatch_filename,ma,mai)
return (ma,mai)