In [1]:
import numpy as np
import pandas as pd
from astropy import coordinates
from astropy.coordinates import match_coordinates_sky
import astropy.units as u
import astroquery
from astroquery.irsa import Irsa
from astroquery.vizier import Vizier
from astropy.table import Table, join
from astropy.units import Quantity
from astroquery.gaia import Gaia
Irsa.ROW_LIMIT = -1
Vizier.ROW_LIMIT = -1
from astropy.io import ascii as asci
import matplotlib.pyplot as plt
# Suppress warnings. Comment this out if you wish to see the warning messages
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
2MASS => J, H K, angular resolution ~4"
WISE => 3.4, 4.6, 12, and 22 μm (W1, W2, W3, W4) with an angular resolution of 6.1", 6.4", 6.5", & 12.0"
GALEX imaging => Five imaging surveys in a Far UV band (1350-1750Å) and Near UV band (1750-2800Å) with 6-8 arcsecond resolution (80% encircled energy) and 1 arcsecond astrometry, and a cosmic UV background map.
In [2]:
from astroquery.gaia import Gaia
tables = Gaia.load_tables(only_names=True)
for table in (tables):
print (table.get_qualified_name())
In [4]:
#obj = ["3C 454.3", 343.49062, 16.14821, 1.0]
obj = ["PKS J0006-0623", 1.55789, -6.39315, 1]
#obj = ["M87", 187.705930, 12.391123, 1.0]
#### name, ra, dec, radius of cone (in deg)
obj_name = obj[0]
obj_ra = obj[1]
obj_dec = obj[2]
cone_radius = obj[3]
In [49]:
obj_coord = coordinates.SkyCoord(ra=obj_ra, dec=obj_dec, unit=(u.deg, u.deg), frame="icrs")
In [64]:
# cmd = "SELECT * \
# FROM gaiadr2.gaia_source \
# WHERE CONTAINS(POINT('ICRS',gaiadr2.gaia_source.ra,gaiadr2.gaia_source.dec), \
# CIRCLE('ICRS'," + str(obj_ra) + "," + str(obj_dec) + "," + str(cone_radius) + "))=1;"
cmd = "SELECT * FROM gaiadr2.gaia_source AS g, \
gaiadr2.tmass_best_neighbour AS tbest, \
gaiadr1.tmass_original_valid AS tmass \
WHERE g.source_id = tbest.source_id AND tbest.tmass_oid = tmass.tmass_oid AND CONTAINS(POINT('ICRS',g.ra,g.dec),\
CIRCLE('ICRS'," + str(obj_ra) + "," + str(obj_dec) + "," + str(cone_radius) + "))=1;"
print(cmd)
job = Gaia.launch_job_async(cmd, dump_to_file=True)
print (job)
# GAIA
In [65]:
r = job.get_results()
print(len(r['source_id']))
In [66]:
print(r['phot_g_mean_mag', 'phot_bp_mean_mag', 'phot_rp_mean_mag', 'j_m', 'h_m', 'ks_m', 'tmass_oid'])
In [54]:
cmd = "SELECT * FROM gaiadr2.gaia_source AS g, \
gaiadr2.allwise_best_neighbour AS wbest, \
gaiadr1.allwise_original_valid AS allwise \
WHERE g.source_id = wbest.source_id AND wbest.allwise_oid = allwise.allwise_oid AND CONTAINS(POINT('ICRS',g.ra,g.dec),\
CIRCLE('ICRS'," + str(obj_ra) + "," + str(obj_dec) + "," + str(cone_radius) + "))=1;"
print(cmd)
job = Gaia.launch_job_async(cmd, dump_to_file=True)
print(job)
In [55]:
r = job.get_results()
print(len(r['source_id']))
In [58]:
print(r['w1mpro', 'w2mpro', 'w3mpro', 'w4mpro'])
In [5]:
cmd = "SELECT * FROM gaiadr2.gaia_source AS g, \
gaiadr2.allwise_best_neighbour AS wbest, \
gaiadr1.allwise_original_valid AS allwise \
WHERE g.source_id = wbest.source_id AND wbest.allwise_oid = allwise.allwise_oid AND CONTAINS(POINT('ICRS',g.ra,g.dec),\
CIRCLE('ICRS'," + str(obj_ra) + "," + str(obj_dec) + "," + str(cone_radius) + "))=1 \
AND pmra IS NOT NULL AND abs(pmra)<10 \
AND pmdec IS NOT NULL AND abs(pmdec)<10;"
print(cmd)
job = Gaia.launch_job_async(cmd, dump_to_file=True)
print(job)
In [6]:
r = job.get_results()
print(len(r['source_id']))
In [7]:
print(r['pmra', 'pmdec', 'w1mpro'])
Desc of tmass_key:
2MASS PSC association. Unique identifier of the closest source in the 2MASS Point Source Catalog (PSC) that falls within 3 arcsec of the non-motion fit position of this WISE source. This is equivalent to the pts_key in the 2MASS PSC entry. This column is “null” if there is no 2MASS PSC source within 3 arcsec of the WISE source position.
In [90]:
cmd = "SELECT * FROM gaiadr2.gaia_source AS g, \
gaiadr2.allwise_best_neighbour AS wbest, \
gaiadr1.allwise_original_valid AS allwise, \
gaiadr1.tmass_original_valid AS tmass \
WHERE g.source_id = wbest.source_id AND wbest.allwise_oid = allwise.allwise_oid AND CONTAINS(POINT('ICRS',g.ra,g.dec),\
CIRCLE('ICRS'," + str(obj_ra) + "," + str(obj_dec) + "," + str(cone_radius) + "))=1\
AND allwise.tmass_key IS NOT NULL \
AND allwise.tmass_key = tmass.tmass_oid;"
print(cmd)
job = Gaia.launch_job_async(cmd, dump_to_file=True)
print(job)
In [91]:
r = job.get_results()
print(len(r['source_id']))
In [8]:
print(r.colnames)
In [93]:
r['ra', 'dec', 'ra_2', 'dec_2', 'ra_3', 'dec_3', 'phot_g_mean_mag', 'j_m', 'w1mpro', 'tmass_key', 'tmass_oid']
Out[93]:
In [ ]: