-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_all.py
66 lines (50 loc) · 2.12 KB
/
plot_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
from cov import get_glgb
from plot_cov import get_colorlist
surv_list = ['AODRIFT','GBNCC','GBT350','HTRU-Nh','HTRU-Nl','HTRU-Nm','HTRU-Sh',
'HTRU-Sl','HTRU-Sm','PALFA-Mi','PALFA-Wi','PMPS','SMPS']
with open('all.dat') as f:
ref_freq = f.readline().split()[1]
f.close()
col = np.loadtxt('all.dat', usecols=[1],dtype='str',unpack=True)
smin,ncov = np.loadtxt('all.dat',dtype='float',usecols=[0,2],unpack=True)
# What kind of plot??
# 0: smin, 1: most sensitive survey, 2: redundancy
plot_type = 0
gl,gb = get_glgb()
deg2rad = np.pi/180.
f = plt.figure()
ax = f.add_subplot(111,projection='mollweide')
if plot_type == 0:
outfile = 'lowest_smin.pdf'
cm = plt.cm.get_cmap('RdYlBu')
# To avoid major outliers, find 10th and 90th percentiles of sensitivity distribution
smin_lo = np.percentile(smin,10.0)
smin_hi = np.percentile(smin,90.0)
plt.scatter(gl*deg2rad,gb*deg2rad,edgecolor='',s=1.5,c=smin,cmap=cm,vmin=smin_lo,vmax=smin_hi)
cbar = plt.colorbar()
cbar.set_label(r"S$_{\rm %s}$ (mJy)" % (ref_freq))
plt.scatter(-46.06*deg2rad,-1.93*deg2rad,s=25,c='white',marker='x',lw=1.2)
plt.title('Sensitivity Map (%s MHz)' % (ref_freq))
if plot_type == 1:
outfile = 'most_sensitive_survey.pdf'
patch_list = []
colorlist = get_colorlist(len(surv_list)) # assign color to each survey
for ss,cc in zip(surv_list,colorlist):
patch_list.append(mpatches.Patch(color=cc,label=ss))
plt.scatter(gl*deg2rad,gb*deg2rad,edgecolor='',s=2.5,c=col)
plt.legend(handles=patch_list,loc=8, ncol=4,fontsize='small',frameon=False,bbox_to_anchor=(0.5,-0.38)) # 8: lower center
plt.title('Most Sensitive Surveys')
if plot_type == 2:
outfile = 'redundant_coverage.pdf'
cm = plt.cm.get_cmap('Greys')
plt.scatter(gl*deg2rad,gb*deg2rad,edgecolor='',s=2.5,c=ncov/np.float(len(surv_list)),cmap=cm)
cbar = plt.colorbar()
cbar.set_label("Fractional Redundancy")
plt.title('Survey Redundancy')
plt.grid()
plt.xlabel('Galactic Longitude (deg)')
plt.ylabel('Galactic Latitude (deg)')
plt.savefig(outfile,format='pdf')