This repository contains the code to create a sharded SQLite database of the Gaia-2MASS crossmatch catalogue, enabling fast local queries.
The locally created database is currently optimised for offline astrometric plate solving for visible and near-infrared observations.
The catalogue was generated by cross-matching Gaia DR2 and 2MASS catalogues using the astroquery Python package. For reference, please see multi_query.py. Before using the code (to avoid overloading the Gaia archive servers), please refer to the Usage section below for more details.
To use a local catalogue, download the already created 16 J magnitude cut Gaia-2MASS SQLite database file from here. This catalogue is about 18GB in size, containing approximately 300M cross-matched sources.
You can find an example of how to use the database in example.py:
if __name__ == '__main__':
min_dec = -50.2
max_dec = -49.2
min_ra = 23.3
max_ra = 24.4
t0 = datetime.now()
df = db_query('./db/gaia_tmass_16_jm_cut.db', min_dec, max_dec, min_ra, max_ra)
print("Executed query", datetime.now() - t0)
print(df)
Executed query 0:00:00.236333
ra dec pmra pmdec phot_g_mean_mag j_m
0 23.693215 -49.805034 17.91935 -36.989641 7.487380 5.177
1 23.573126 -49.448267 91.111847 10.057243 9.748498 8.751
2 24.121133 -49.926295 91.715677 47.979666 9.838325 8.860
3 23.817866 -49.549265 14.543387 8.118343 10.602289 9.109
4 24.226083 -49.414841 -2.335897 -87.573116 10.764868 9.329
.. ... ... ... ... ... ...
615 23.629336 -50.186380 11.270629 -0.525701 17.416536 15.977
616 24.218084 -50.074234 12.997597 -0.806246 17.658678 15.986
617 24.326128 -49.769186 11.724527 -6.793672 18.224480 15.989
618 23.476797 -49.334399 0.578949 -1.991031 17.085663 15.993
619 23.386318 -49.613298 22.275294 -0.469569 17.023968 15.998
If you require a database with a different magnitude cut or the inclusion of Gaia IDs, please refer to multi_query.py within the gaia_archive_bulk_query directory, and db_maker.py for instructions on how to create it. Alternatively, feel free to contact me.