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

from galenv import *

from astroquery.irsa import Irsa
Irsa.ROW_LIMIT = 5000

%matplotlib inline

In [3]:
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 [4]:
ga = Galenv()

Check using name


In [5]:
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']

# typical size (diameter) of galaxy cluster => 2 - 10 Mpc
tangential_dist = 7.5 # Mpc 


for obj in objlist:
    objname = 'PKS ' + obj
    try:
        print(objname)
        z, v0, ra, dec = ga.queryobject_byname(objname)
        print(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(dA, theta)
        
        result = Irsa.query_region(objname, catalog="fp_psc", spatial="Cone", radius= theta * u.deg)
        
        plot_cone(obj_coord, theta, result, savefig=True, imgname=objname + '.png')
        
        print("----")
        
    except:
        print("error! maybe can not identify from name") 
        print("----")


PKS J0541-0211
error! maybe can not identify from name
----
PKS J1733-3722
error! maybe can not identify from name
----
PKS J1610-3958
error! maybe can not identify from name
----
PKS J1743-0350
1.054 315981.0 265.99523 -3.83462
1717.70727627639 0.2501697188357098
----
PKS J2253+1608
0.859 257522.0 343.49062 16.14821
1629.9307676687627 0.2636420852173554
----
PKS J1851+0035
error! maybe can not identify from name
----
PKS J0541-0541
0.839 251526.0 85.40868 -5.69706
1618.0605034352159 0.26557619164166346
----
PKS J0601-7036
error! maybe can not identify from name
----
PKS J1130-1449
1.184 354954.0 172.52939 -14.82427
1753.737300779338 0.24503005447689125
----
PKS J1305-4928
0.001878 563.0 196.36449 -49.46821
8.292149410020395 51.822311092083964
error! maybe can not identify from name
----
PKS J0336+3218
error! maybe can not identify from name
----
PKS J0006-0623
0.346676 103931.0 1.55789 -6.39315
1044.0300496957655 0.41159576438756634
----
PKS J1717-3342
error! maybe can not identify from name
----
PKS J1833-210B
error! maybe can not identify from name
----
PKS J0237+2848
error! maybe can not identify from name
----
PKS J0750+1231
0.889 266516.0 117.71686 12.51801
1646.623423400248 0.26096941185298866
----
PKS J1751+0939
0.322 96533.0 267.88674 9.6502
994.3201278022433 0.43217303394826034
----
PKS J0948+0022
error! maybe can not identify from name
----
PKS J1107-4449
1.598 479068.0 166.78622 -44.81877
1793.3027653878596 0.2396239802012333
----
PKS J1256-0547
0.5362 160749.0 194.04653 -5.78931
1344.817110605312 0.3195366440234375
----
PKS J1830+0619
error! maybe can not identify from name
----
PKS J1225+1253
0.003392 1017.0 186.2656 12.88698
14.949233862918131 28.745175190150867
error! maybe can not identify from name
----
PKS J0747-3310
-- -- 116.83201 -33.17971
error! maybe can not identify from name
----
PKS J1516+1932
1.07 320778.0 229.23665 19.53694
1722.9801220862478 0.24940412303062362
/scratch/home/rwibowo/anaconda3/lib/python3.6/site-packages/astropy/units/quantity.py:639: RuntimeWarning: invalid value encountered in true_divide
  result = super().__array_ufunc__(function, method, *arrays, **kwargs)
----
PKS J0438+3004
error! maybe can not identify from name
----
PKS J2134-0153
1.285 385233.0 323.54296 -1.88812
1772.3854802599205 0.2424519672126287
----
PKS J2226+0052
2.249877 674496.0 336.6939 0.86981
1741.4070377375724 0.24676502221238603
----
PKS J0426+2327
error! maybe can not identify from name
----
PKS J1626-2951
0.815 244331.0 246.52509 -29.85749
1602.9924999664522 0.2680725869628901
----
PKS J1058-8003
0.581 174179.0 164.68046 -80.06504
1398.6384248097584 0.3072404838345317
----

In [ ]: