demo-Gaia


Gaia TGAS + 2MASS + WISE

The provided Gaia dataset is a dump of the Gaia science archive's match between the astrometry in the Tycho-Gaia Astrometric Solution (TGAS) and photometric sources in 2MASS and WISE. The data contains all of the columns provided in the TGAS catalog (described here) along with photometric columns from the 2MASS and WISE catalogs.

The 2MASS photometry is in the $J$, $H$, and $K_s$ bands, so the corresponding magnitude measurements are stored in the columns j_m, h_m, ks_m. The uncertainties for each magnitude balue are in the columns j_msigcom, h_msigcom, ks_msigcom.

The WISE filters are named $W1$-$W4$, so the magnitudes and uncertainties are w*mpro and w*mpro_error with the * replaced by the filter number, 1-4.


In [1]:
from os import path
import numpy as np

import astropy.coordinates as coord
import astropy.units as u
from astropy.io import fits
from astropy.table import Table
import matplotlib.pyplot as plt
plt.style.use('notebook.mplstyle')
%matplotlib inline
import numpy as np

In [2]:
data_path = '../data/'

Reading the Gaia TGAS data

The data are all stored in a single FITS binary table and can be read using the astropy.table.Table class:


In [3]:
tgas = Table.read(path.join(data_path, 'gaia', 'tgas_2mass_wise.fits'))

In [4]:
print(tgas.colnames)


['hip', 'tycho2_id', 'solution_id', 'source_id', 'random_index', 'ref_epoch', 'ra', 'ra_error', 'dec', 'dec_error', 'parallax', 'parallax_error', 'pmra', 'pmra_error', 'pmdec', 'pmdec_error', 'ra_dec_corr', 'ra_parallax_corr', 'ra_pmra_corr', 'ra_pmdec_corr', 'dec_parallax_corr', 'dec_pmra_corr', 'dec_pmdec_corr', 'parallax_pmra_corr', 'parallax_pmdec_corr', 'pmra_pmdec_corr', 'astrometric_n_obs_al', 'astrometric_n_obs_ac', 'astrometric_n_good_obs_al', 'astrometric_n_good_obs_ac', 'astrometric_n_bad_obs_al', 'astrometric_n_bad_obs_ac', 'astrometric_delta_q', 'astrometric_excess_noise', 'astrometric_excess_noise_sig', 'astrometric_primary_flag', 'astrometric_relegation_factor', 'astrometric_weight_al', 'astrometric_weight_ac', 'astrometric_priors_used', 'matched_observations', 'duplicated_source', 'scan_direction_strength_k1', 'scan_direction_strength_k2', 'scan_direction_strength_k3', 'scan_direction_strength_k4', 'scan_direction_mean_k1', 'scan_direction_mean_k2', 'scan_direction_mean_k3', 'scan_direction_mean_k4', 'phot_g_n_obs', 'phot_g_mean_flux', 'phot_g_mean_flux_error', 'phot_g_mean_mag', 'phot_variable_flag', 'l', 'b', 'ecl_lon', 'ecl_lat', 'j_m', 'j_msigcom', 'h_m', 'h_msigcom', 'ks_m', 'ks_msigcom', 'w1mpro', 'w1mpro_error', 'w2mpro', 'w2mpro_error', 'w3mpro', 'w3mpro_error', 'w4mpro', 'w4mpro_error']

As an example of using the data, let's make two color-magnitude diagrams for all stars within 150 pc:


In [5]:
with u.set_enabled_equivalencies(u.parallax()):
    dist = coord.Distance((tgas['parallax'] * u.mas).to(u.pc), 
                          allow_negative=True)
    
dist_cut = (dist < 256. * u.pc) & (dist > 0)

Compute absolute magnitude using the distance to each star, and compute colors by differencing magnitudes:


In [48]:
M_G = tgas['phot_g_mean_mag'][dist_cut] - dist[dist_cut].distmod.value
G_J = tgas['phot_g_mean_mag'][dist_cut] - tgas[dist_cut]['j_m']
G_W1 = tgas['phot_g_mean_mag'][dist_cut] - tgas[dist_cut]['w1mpro']

In [49]:
fig,axes = plt.subplots(1, 2, figsize=(12, 6), sharey=True)
axes[0].plot(G_J, M_G, marker=',', linestyle='none')
axes[1].plot(G_W1, M_G, marker=',', linestyle='none')

axes[0].set_xlim(-0.25, 2.5)
axes[0].set_ylim(9, -1)

axes[1].set_xlim(-0.25, 3.5)

axes[0].set_xlabel('$G-J$ [mag]')
axes[1].set_xlabel('$G-W1$ [mag]')
axes[0].set_ylabel('$M_G$ [mag]')


Out[49]:
<matplotlib.text.Text at 0x10444f470>

In [50]:
RG = (G_J > 1.) & (M_G < (6*G_J - 3.5)) & (M_G < 4.5)

fig,ax = plt.subplots(1, 1, figsize=(6, 6), sharey=True)

ax.plot(G_J, M_G, marker=',', linestyle='none')
ax.plot(G_J[RG], M_G[RG], marker=',', linestyle='none', color='r')

ax.set_xlim(-0.25, 2.5)
ax.set_ylim(9, -1)

axes[0].set_xlabel('$G-J$ [mag]')
axes[0].set_ylabel('$M_G$ [mag]')


/Users/adrian/anaconda/lib/python3.5/site-packages/astropy/table/column.py:928: RuntimeWarning: invalid value encountered in greater
  return getattr(self.data, oper)(other)
/Users/adrian/anaconda/lib/python3.5/site-packages/astropy/table/column.py:928: RuntimeWarning: invalid value encountered in less
  return getattr(self.data, oper)(other)
Out[50]:
<matplotlib.text.Text at 0x10444f470>