In [1]:
import sys
sys.path.append('../../src/utils/')

from galenv import *

from astroquery.irsa import Irsa
Irsa.ROW_LIMIT = 10000

%matplotlib inline

In [2]:
def plot_cone(coord, theta, res, xSize=7.5, ySize=7.5, title='', show=True, savefig=False, imgname="plot.png"):
        '''Only cone
        coord = astropy coordinates
        theta = Cone angle
        res = result catalog
        '''
        ra = coord.ra.value
        dec = coord.dec.value

        fig = plt.figure(figsize=(xSize, ySize))        
        gs = gridspec.GridSpec(1, 1)
        
        ax = plt.subplot(gs[0])
        # ax.axis('equal')
        limangle = 1.5*theta
        ax.set_xlim((ra-limangle, ra+limangle))
        ax.set_ylim((dec-limangle, dec+limangle))
        
        # Central position/object
        ax.plot(ra, dec, 'ro', alpha=0.5)
        
        # Catalog object
        ax.plot(res['ra'], res['dec'], 'k.')
        
        plt.gca().invert_xaxis() # RA from E to W
        ax.set_xlabel('RA (deg)')
        ax.set_ylabel('DEC (deg)')
        plt.title(title)

        # Circle
        # it is wrong if I draw a circle around (ra, dec) with radius theta
        # due to small circle in celestial sphere for DEC
        circle = plt.Circle((ra, dec), theta, fc='none', ec='black')
        ax.add_artist(circle)
        
        fig.tight_layout()

        if savefig:
            plt.savefig(imgname)

        if show:
            plt.show()

        plt.close()

In [3]:
ga = Galenv()

Check using name


In [4]:
# objlist = ['J0541-0211', 'J1733-3722', 'J1610-3958', 'J1743-0350', 'J2253+1608', 
#            'J1851+0035', 'J0541-0541', 'J0601-7036', 'J1130-1449', 'J1305-4928', 
#            'J0336+3218', 'J0006-0623', 'J1717-3342', 'J1833-210B', 'J0237+2848', 
#            'J0750+1231', 'J1751+0939', 'J0948+0022', 'J1107-4449', 'J1256-0547', 
#            'J1830+0619', 'J1225+1253',
#            'J0747-3310', 'J1516+1932', 'J0438+3004', 'J2134-0153', 'J2226+0052', 
#            'J0426+2327', 'J1626-2951', 'J1058-8003']

#objlist = ['J2253+1608']
# typical size (diameter) of galaxy cluster => 2 - 10 Mpc
#tangential_dist = 0.05 # Mpc 

# objlist = ['WISE J161021.87-395858.4', '[HB89] 1741-038', '3C 454.3', 'PKS 0539-057', 'PKS 0601-70', 'SSTSL2 J113006.83-144912.6',
#           'NGC 4945', '[HB89] 0333+321 ABS01', 'PKS 0003-066', 'PKS 1830-21', '[HB89] 0234+285', '[HB89] 0748+126',
#           '[HB89] 1749+096', 'WISE J094857.31+002225.6', '[HB89] 1104-445', '3C 279', 'WISE J183005.92+061915.7', 
#           'MESSIER 084', '[HB89] 1514+197', 'LQAC 069+030 001', '[HB89] 2131-021', '4C +00.81', 'LQAC 066+023 001',
#           'PKS 1622-29', 'PKS 1057-79']

# for obj in objlist:
#     objname = 'PKS ' + obj

def search_and_plot(objname, ra, dec, tangential_dist, cat='fp_psc'):
    try:
        print(objname)
        z, v0, _ra, _dec = ga.queryobject_byname(objname)
        print("NED (z, v, ra, dec): ", z, v0, _ra, _dec)

        obj_coord = coordinates.SkyCoord(ra=ra, dec=dec, unit=(u.deg, u.deg))

        dA, theta = ga.calc_dA_theta(z, tangential_dist)
        print("From redshift & tangential_dist (dA, theta):", dA, theta)
        
        result = Irsa.query_region(obj_coord, catalog=cat, spatial="Cone", radius= theta * u.deg)
        
        plot_cone(obj_coord, theta, result, savefig=True, imgname=objname + '.png')
        
        return result
        print("----")
        
    except:
        print("error! maybe can not identify from name") 
        print("----")

In [8]:
data = search_and_plot('PKS J2253+1608', 343.49061, 16.148211, 2, 'fp_psc')


PKS J2253+1608
NED (z, v, ra, dec):  0.859 257522.0 343.49062 16.14821
From redshift & tangential_dist (dA, theta): 1629.9307676687627 0.07030455605796143

In [7]:
0.26*3600


Out[7]:
936.0

In [6]:
data


Out[6]:
Table masked=True length=676
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.08310129.9560180.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.52408824.4727080.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.262256349.6101080.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.969178161.4131140.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.858459132.2636220.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.299853125.3690990.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.45093744.7116470.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.23824727.6055750.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.83034385.7094640.4210.0350.4568
.......................................................................................................................................
343.26016.00722h53m02.49s16d00m26.05s0.090.0817822530248+160026015.6960.060.06221.115.2850.0940.09512.315.5030.1640.1656.3AAC22211100036160600n1999-11-014985.777-38.177U0.419117.016.51--944.42937237.5272680.411-0.2180.193666
343.24316.03822h52m58.24s16d02m17.80s0.280.2615822525823+160217717.060.1790.1796.016.3140.1880.1884.815.8740.2410.2414.5CDD22211100006060600n1999-11-014985.782-38.142U0.98518.818.21--944.544798245.2633050.7460.441.186667
343.45315.88822h53m48.73s15d53m17.60s0.080.089022534873+155317515.6270.0590.0621.715.1020.0740.07416.715.130.1320.1328.3AAB22211100056040600n1998-10-017385.889-38.38U0.69617.716.51--944.936468187.9087750.525-0.0280.497668
343.75116.07022h55m00.35s16d04m12.21s0.080.06022550035+160412215.2980.0440.04529.414.6270.0560.05726.814.4240.0810.08215.9AAA22211100066562600n1998-10-017586.322-38.388U0.628816.716.21--945.057736107.2832850.6710.2030.874669
343.23816.24822h52m57.10s16d14m54.33s0.090.08022525710+161454315.5790.060.06123.515.0730.0940.09515.015.2370.140.148.1AAB22211100056260600n1999-11-014985.926-37.965U0.618417.716.51--945.11161292.4758620.506-0.1640.342670
343.73316.27022h54m55.99s16d16m11.10s0.310.249022545599+161611016.5870.1280.1289.016.0160.150.157.515.7040.2210.2214.9BBD22211100006050600n1998-10-017586.444-38.211U0.216518.417.41--946.22043662.4235380.5710.3120.883671
343.25616.28422h53m01.40s16d17m01.77s0.090.08322530140+161701716.1190.0780.07914.315.3840.0980.09811.215.1590.1270.1278.7AAB22211100006060500n1999-11-014985.969-37.946U0.422518.918.01--947.056875301.0640480.7350.2250.96672
343.76416.16822h55m03.38s16d10m03.29s0.060.069022550338+161003214.9790.0320.03438.114.2020.0320.03338.314.0780.0540.05521.9AAA22211100066664600n1998-10-017686.403-38.313U0.514318.116.51--948.19475585.7445110.7770.1240.901673
343.22516.21322h52m53.93s16d12m47.46s0.080.06022525393+161247414.8040.030.03248.014.380.050.05128.314.3730.0680.06817.9AAA22211100066363600n1999-11-014985.888-37.988U0.716416.815.71--948.556183284.3125080.4240.0070.431674
343.74716.05422h54m59.20s16d03m13.68s0.230.2422545919+160313616.8790.1650.1666.915.7810.1340.1349.315.2740.1670.1677.3CBC22211100006061500n1998-10-017586.305-38.399U0.218519.118.01--948.615207110.9592231.0980.5071.605675

- 0.5 Mpc is too small?