In [1]:
import numpy as np
import pandas as pd

from astropy import coordinates
import astropy.units as u
import astroquery
from astroquery.irsa import Irsa
from astroquery.vizier import Vizier

Vizier.ROW_LIMIT = -1

import matplotlib.pyplot as plt

%matplotlib inline

Get the data


In [2]:
obj = ["3C 454.3", 343.49062, 16.14821, 4./60.]
# name, ra, dec, radius of cone
obj_name = obj[0]
obj_ra   = obj[1]
obj_dec  = obj[2]
cone_radius  = obj[3]

In [3]:
obj_coord = coordinates.SkyCoord(ra=obj_ra, dec=obj_dec, unit=(u.deg, u.deg), frame="icrs")

In [4]:
data_2mass = Irsa.query_region(obj_coord, catalog="fp_psc", radius=cone_radius * u.deg)
data_wise  = Irsa.query_region(obj_coord, catalog="allwise_p3as_psd", radius=cone_radius * u.deg)
data_galex = Vizier.query_region(obj_coord, catalog='II/335', radius=cone_radius * u.deg)
data_galex = data_galex[0]

In [9]:
num_2mass = len(data_2mass)
num_wise  = len(data_wise)
num_galex = len(data_galex)

print("Number of object in (2MASS, WISE, GALEX): ", num_2mass, num_wise, num_galex)


Number of object in (2MASS, WISE, GALE):  44 218 41

In [10]:
num_match_2mass_wise  = 0
num_match_2mass_galex = 0
num_match_wise_galex  = 0
sep_min = 2 # minimum separation in arcsec

## match: from 2MASS to WISE and GALEX
for i, idata in enumerate(data_2mass):
    ra_2mass  = idata['ra']
    dec_2mass = idata['dec']
    c_2mass = coordinates.SkyCoord(ra=ra_2mass, dec=dec_2mass, unit=(u.deg, u.deg), frame="icrs")
    
    #####
    # check in WISE cat
    match_wise = False
    for j, jdata in enumerate(data_wise):
        ra_wise  = jdata['ra']
        dec_wise = jdata['dec']
        c_wise = coordinates.SkyCoord(ra=ra_wise, dec=dec_wise, unit=(u.deg, u.deg), frame="icrs")
        
        sep_2mass_wise = c_2mass.separation(c_wise)
        
        if (sep_2mass_wise <= sep_min * u.arcsec):
            match_wise = True
            break
    
    if match_wise:
        num_match_2mass_wise  += 1
    
    #####
    # check in GALEX cat
    match_galex = False
    for k, kdata in enumerate(data_galex):
        ra_galex  = kdata['RAJ2000']
        dec_galex = kdata['DEJ2000']
        c_galex = coordinates.SkyCoord(ra=ra_galex, dec=dec_galex, unit=(u.deg, u.deg), frame="icrs")
        
        sep_2mass_galex = c_2mass.separation(c_galex)
        
        if (sep_2mass_galex < sep_min * u.arcsec):
            match_galex = True
            break
    
    if match_galex:
        num_match_2mass_galex += 1

#####
# check WISE in GALEX cat
for j, jdata in enumerate(data_wise):
    ra_wise  = jdata['ra']
    dec_wise = jdata['dec']
    c_wise = coordinates.SkyCoord(ra=ra_wise, dec=dec_wise, unit=(u.deg, u.deg), frame="icrs")
    
    match_wise_galex = False
    for k, kdata in enumerate(data_galex):
        ra_galex  = kdata['RAJ2000']
        dec_galex = kdata['DEJ2000']
        c_galex = coordinates.SkyCoord(ra=ra_galex, dec=dec_galex, unit=(u.deg, u.deg), frame="icrs")
    
        sep_wise_galex = c_wise.separation(c_galex)
        
        if (sep_wise_galex <= sep_min * u.arcsec):
            match_wise_galex = True
            break
    
    if match_wise_galex:
        num_match_wise_galex  += 1


print("Coordinate Match (2MASS-WISE, 2MASS-GALEX, WISE-GALEX): ", num_match_2mass_wise, num_match_2mass_galex, num_match_wise_galex)


Coordinate Match (2MASS-WISE, 2MASS-GALEX, WISE-GALEX) 41 15 18

In [11]:
data_2mass


Out[11]:
Table masked=True length=44
radecclonclaterr_majerr_minerr_angdesignationj_mj_cmsigj_msigcomj_snrh_mh_cmsigh_msigcomh_snrk_mk_cmsigk_msigcomk_snrph_qualrd_flgbl_flgcc_flgndetgal_contammp_flghemisxdatescanglonglatadist_optphi_optb_m_optvr_m_optnopt_mchsext_keydistanglej_hh_kj_kid
degdegarcsarcsdegmagmagmagmagmagmagmagmagmagdegdegarcsdegmagmagarcsdeg
float64float64objectobjectfloat64float64int32objectfloat64float64float64float64float64float64float64float64float64float64float64float64objectobjectobjectobjectobjectint32int32objectobjectint32float64float64objectfloat64int32float64float64int32int32float64float64float64float64float64object
343.49116.14822h53m57.75s16d08m53.63s0.070.069022535774+160853614.4940.0270.0361.613.8550.0290.0352.713.0610.0260.02755.9AAA22211100066556600n1998-10-017386.111-38.184U0.011514.814.11--0.0723445.4866870.6390.7941.4330
343.49216.15222h53m58.16s16d09m06.78s0.070.069022535816+160906711.8440.0170.021707.711.3390.0210.023535.011.2390.0190.021299.1AAA22211100066666600n1998-10-017386.115-38.182U0.810414.313.01--14.50979724.3484310.5050.10.6051
343.49016.15222h53m57.56s16d09m08.57s0.270.2510622535755+160908516.1640.0940.09513.216.0030.1770.1777.315.7240.2370.2384.8ACD222111ccc06060600n1998-10-017386.113-38.18U1.228416.716.11--15.26853349.4824770.1610.2790.442
343.49316.14122h53m58.37s16d08m27.05s0.070.069022535836+160827014.80.0350.03746.514.1030.0380.03942.013.8380.040.04127.3AAA22211100066664600n1998-10-017386.108-38.191U1.017218.716.91--27.958175161.4802860.6970.2650.9623
343.49716.14222h53m59.33s16d08m32.80s0.080.069022535933+160832815.6160.0660.06721.915.0640.0780.07817.314.7250.0920.09212.1AAA22211100056261600n1998-10-017386.114-38.192U0.59319.717.81--30.832877132.3068410.5520.3390.8914
343.49916.14322h53m59.74s16d08m33.12s0.280.2613322535974+160833116.1620.090.09113.315.660.120.1210.015.6750.2260.2275.0ABD22211100006160600n1998-10-017386.116-38.193U0.514217.416.71--35.271661125.4016160.502-0.0150.4875
343.50116.15822h54m00.21s16d09m29.41s0.220.218622540021+160929416.8270.1540.1557.216.0460.1630.1647.015.275------BCU22011000006060000n1998-10-017386.129-38.1810--------0--50.42661444.6837280.781----6
343.50016.16522h53m59.94s16d09m54.03s0.070.069022535994+160954014.2150.0250.02879.713.7950.0260.02755.713.6410.0460.04732.7AAA22211100066666600n1998-10-017386.132-38.175U0.77716.415.41--68.2222327.5798420.420.1540.5747
343.51116.15022h54m02.65s16d08m58.85s0.110.118322540264+160858815.9120.0710.07216.715.4910.10.111.715.4560.2030.2036.2AAC22211100026060600n1998-10-017386.133-38.193U0.119017.416.71--70.79586185.7073730.4210.0350.4568
.......................................................................................................................................
343.48316.20822h53m55.92s16d12m29.28s0.070.069022535591+161229214.1780.0360.03882.513.6260.0440.04565.113.4010.0440.04540.8AAA222211c0066556600n1998-10-017386.146-38.13U1.820917.616.12--217.332541353.0310290.5520.2250.77734
343.55216.16422h54m12.43s16d09m49.15s0.10.0817822541243+160949115.9640.0770.07815.915.4480.0860.08712.615.2940.1660.1667.1AAC22211100026060600n1998-10-017486.184-38.203U0.614917.616.81--218.77079975.2688590.5160.1540.6735
343.53316.10322h54m08.02s16d06m09.33s0.080.06022540801+160609313.710.0230.026126.913.2420.0250.02696.013.1180.0310.03253.0AAA22211100066666600n1998-10-017486.122-38.244U0.24715.814.81--221.053726137.974640.4680.1240.59236
343.44916.19522h53m47.84s16d11m42.44s0.130.127622534783+161142416.1340.0930.09413.615.4820.0870.08811.815.3450.1540.1546.8AAC22211100026040600n1998-10-017386.102-38.1230--------0--221.166183319.7886330.6520.1370.78937
343.43916.11122h53m45.33s16d06m38.56s0.220.2110622534533+160638516.1390.090.09113.615.6920.1170.1189.715.5620.2070.2075.6ABC22211100026150600n1998-10-017386.032-38.187U0.87418.016.91--224.121656232.9686960.4470.130.57738
343.54616.11522h54m11.04s16d06m54.63s0.080.06022541103+160654610.4160.0180.0222636.59.8330.0180.022216.79.5560.0160.0181409.4AAA22211100066666600n1998-10-017486.144-38.2410--------0--225.435611121.8316060.5830.2770.8639
343.47316.08722h53m53.58s16d05m13.96s0.070.069022535358+160513911.80.0150.02736.911.1920.0190.021612.511.070.0170.019349.5AAA22211100066556600n1998-10-017386.05-38.225U0.116214.813.51--227.661794195.3024810.6080.1220.7340
343.45116.09722h53m48.18s16d05m49.53s0.230.218122534818+160549516.8340.1550.1567.116.962------17.215------CUU20010000006000000n1998-10-017386.034-38.2050--------0--229.945724216.847096------41
343.52116.20522h54m04.97s16d12m18.74s0.210.213422540497+161218716.8160.1420.1437.316.2280.1750.1756.115.166------BCU22011000006050000n1998-10-017486.182-38.1520--------0--230.07032126.8906040.588----42
343.44216.19322h53m46.10s16d11m33.14s0.070.069022534609+161133113.9430.0220.025102.413.440.0280.02977.213.3280.0320.03343.7AAA22211100066446600n1998-10-017386.093-38.121U0.65716.315.31--231.615942313.5581060.5030.1120.61543

In [ ]: