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()
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')
In [7]:
0.26*3600
Out[7]:
In [6]:
data
Out[6]: