-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap_v.py
132 lines (114 loc) · 10.4 KB
/
Map_v.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import aplpy
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import cm
# data from Summary20190624_v1, extracted by slopefittingevery.py
# data first processed in Map_sources.xlsx - Map_v
#
# RA=[78.90629167,81.64733333,81.63270833,78.90629167,79.173375,81.63270833,81.64733333,73.08758333,81.94133333,78.90629167,78.90629167,76.37966667,88.02429167,80.27154167,81.64733333,73.08758333,81.63270833,83.906375,83.906375,76.37366667,79.173375,84.237875,84.906375,84.51945833,84.237875,83.866625,72.45425,76.37366667,85.04333333,81.64733333,83.43645833,84.51945833,80.27154167,79.173375,84.94166667,88.02429167,73.96483333,84.237875,84.237875,84.237875,78.41695833,73.38733333,83.866625,73.92483333,80.62279167,78.90629167,80.920125,85.01879167,84.94166667,85.810625,78.41695833,84.94166667,79.63654167,73.96454167,84.237875,84.94166667,69.73404167,73.92458333,74.07775,73.96454167,85.810625,84.94166667,74.07775,84.237875,73.609,81.60920833,85.01879167,83.866625,84.01983333,77.87333333,81.64691667,77.12995833,69.73404167,71.21316667,79.173375,81.60920833,73.96483333,85.01879167,84.237875,87.87566667,85.01879167,73.08758333,85.01879167,84.51945833,83.906375,76.256125]
# Dec=[-67.35789722,-67.81898889,-65.81859167,-67.35789722,-71.81814167,-65.81859167,-67.81898889,-68.38506944,-67.99033333,-67.35789722,-67.35789722,-65.92110556,-68.24428889,-69.99446111,-67.81898889,-68.38506944,-65.81859167,-68.91865,-68.91865,-66.93234444,-71.81814167,-69.22468889,-69.75741389,-69.89355,-69.22468889,-69.26984722,-69.67068889,-66.93234444,-67.30399167,-67.81898889,-72.27349444,-69.89355,-69.99446111,-71.81814167,-69.64421944,-68.24428889,-69.03615556,-69.22468889,-69.22447222,-69.22447222,-67.11137778,-70.67439722,-69.26984722,-69.10821944,-70.63206944,-67.35789722,-70.83850278,-69.74400556,-69.64421944,-68.74313056,-67.11137778,-69.64421944,-69.58922778,-69.03621667,-69.22447222,-69.64421944,-67.36490278,-69.10826111,-68.83022778,-69.03621667,-68.74313056,-69.64421944,-68.83022778,-69.22447222,-69.18379167,-65.93994167,-69.74400556,-69.26960278,-69.31261667,-68.10493889,-67.81915556,-67.10607222,-67.36490278,-67.77678333,-71.81814167,-65.93994167,-69.03615556,-69.74400556,-69.22468889,-69.27541389,-69.74400556,-68.38506944,-69.74400556,-69.89355,-68.91865,-66.75466389]
# peak_velo_kms=[296.6,308.3,308.5,285.6,246.1,302,289.9,277.5,295.1,309,312.3,298.2,298.5,258.6,286.4,259.4,316.8,262.9,277.1,292.2,240.6,259.7,257,257.5,264.3,278.7,257.6,297.1,301,250.7,241,261.4,277,237.5,252.6,303.2,271.5,271.2,264.2,260.7,302.2,272.2,283.2,253.6,249.9,318.6,237.3,239.9,245.5,272.9,310.6,249.7,232.9,266.2,268.1,276.7,257.1,253.8,275.4,271.7,279.3,292.5,270,272.3,255.1,308.2,249.7,279.4,245.6,315.9,309.4,303.3,262.4,271.7,256.3,318.9,266.5,255.3,290.5,315.2,237.3,281.5,232.4,282.2,267.9,299.4]
# slope_m=[-8.754904789,3.782334041,0.46431041,-3.370635623,-4.248141582,23.6211788,10.98687552,5.498672902,3.596363561,-5.906511388,3.146441518,11.35303452,-1.406853892,24.60004677,-3.900729775,-5.188553664,2.065477656,0.733933957,-1.499378455,23.22103524,-1.871492826,-0.716031928,51.28196888,2.023172892,2.454799755,4.117543279,6.804317046,-16.88885932,2.54636447,-7.72311193,1.779912359,0.576352662,-12.52394443,-53.2489646,1.418042591,15.57828516,-1.372679306,-0.516999026,2.647197963,4.820453969,13.04059515,7.296850922,2.715985252,8.449185482,3.60136743,-107.5426026,2.825856576,3.559209829,-25.40873481,7.299313038,-1.145140976,11.89965757,-5.493216112,1.053741539,1.342876373,-14.97650078,14.46615987,1.667999087,-1.657141397,-2.339956516,1.031027341,-3.621445449,2.474539366,-12.32293082,24.53127053,3.269642732,2.716710351,-0.60395019,-0.210224592,2.856910001,-1.69644757,-1.00184168,11.94710695,0.702550141,29.66083269,8.169346467,-1.151075191,7.015632601,8.087442023,18.90663367,1.042322738,-2.065022663,0.675428088,-8.858837485,-6.289282143,6.992511578]
# T_spin_cold=[4.470376011,13.08991383,27.48173624,5.2029295,7.826094279,41.41800633,38.31128169,20.60113014,15.49332113,6.851404926,14.81780248,24.66455452,9.842544222,45.40375706,16.69167781,0.891523638,19.72946777,21.14955626,11.28187878,41.71633279,12.35547359,26.08107675,71.88483341,40.1175721,30.50341533,22.38121683,22.56357034,8.441508872,14.78582921,-2.518589154,6.270462959,41.40250024,-7.758294116,-39.03113926,30.12958308,31.90368447,13.63375571,30.88648012,31.2330889,30.15742267,30.53644666,14.20763085,21.98613653,29.34548191,11.06936777,-101.1849505,10.26374573,30.74594185,-4.505286827,28.98885326,17.2545432,34.57943641,0.206198363,18.29530708,31.95938118,7.071098205,18.75588597,24.84988196,18.13309662,12.47056703,29.74668863,4.171753078,19.81029852,25.1017832,36.94849652,25.09761847,41.88808514,18.89375721,1.025917781,13.20675988,7.649326899,16.49860779,18.51389296,16.34240996,32.53590022,43.15174597,16.33595045,44.42107862,29.3754098,35.27743881,24.03322526,12.24555524,12.38661319,2.427103347,11.68609788,20.00558319]
# SN_ratio=[114.7870804,41.52736951,40.86641538,39.37332218,30.72863945,28.69097866,27.3149067,23.74752795,22.21406466,21.80491861,21.14413097,20.41162195,19.86880327,18.03864791,17.93856304,16.91704865,16.3862323,16.10762503,15.45671703,14.70311783,12.81330635,12.57092114,12.51750707,12.15443259,11.8413302,11.3447066,11.18492809,10.4628085,10.3202917,10.16124642,10.09350913,10.000497,9.85564721,9.741348636,9.524395473,9.509500809,9.185845803,9.171857368,9.156344511,9.073958944,9.046834525,9.032626051,8.892826153,8.679240017,8.586310139,8.479635552,8.415911555,8.334614703,8.223790108,7.908732831,7.831455085,7.672056631,7.614366684,7.574311298,7.531933564,7.530033872,7.483029115,7.39425737,7.276732268,6.974240812,6.964575805,6.944943339,6.816899588,6.812358167,6.648220968,6.570475079,6.256896089,6.236721299,6.228414254,6.187234889,6.123405378,6.110436355,6.080367696,6.072945747,5.899544645,5.73607304,5.716701353,5.715707858,5.685609494,5.67574465,5.418703366,5.418150201,5.292679746,5.249203611,5.221671203,5.18820818]
import csv
csvpath="/Users/boyangliu/Dropbox/ATCA_SMC/190624/fitting_190624/"
with open(csvpath+'Table2_190624.csv', newline='') as csvfile:
data = np.array(list(csv.reader(csvfile)))
line_count=len(data[:,0])-1
RA=np.zeros(line_count)
Dec=np.zeros(line_count)
peak_velo_kms=np.zeros(line_count)
slope_m=np.zeros(line_count)
T_spin_cold=np.zeros(line_count)
abs=np.zeros(line_count)
abs_err=np.zeros(line_count)
SN_ratio=np.zeros(line_count)
for n in np.arange(line_count):
sourcename=data[n+1,0]
RAHH=float(sourcename[14:16])
RAMM=float(sourcename[16:18])
RASS=float(sourcename[18:23])
DecDD=float(sourcename[23:26])
DecMM=float(sourcename[26:28])
DecSS=float(sourcename[28:33])
RA[n]=(RAHH+RAMM/60.+RASS/3600.)*15
Dec[n]=DecDD-DecMM/60.-DecSS/3600.
peak_velo_kms[n]=float(data[n+1,1])
slope_m[n]=float(data[n+1,3])
T_spin_cold[n]=float(data[n+1,7])
abs[n]=float(data[n+1,13])
abs_err[n]=float(data[n+1,14])
SN_ratio[n]=abs[n]/abs_err[n]
print(np.min(T_spin_cold[np.where(slope_m>0)]), np.max(T_spin_cold))
print(np.min(SN_ratio[np.where(slope_m>0)]), np.max(SN_ratio))
sort_index=np.flip(np.argsort(SN_ratio),0)
RA=RA[sort_index]
Dec=Dec[sort_index]
peak_velo_kms=peak_velo_kms[sort_index]
slope_m=slope_m[sort_index]
T_spin_cold=T_spin_cold[sort_index]
SN_ratio=SN_ratio[sort_index]
HIcol='/Users/boyangliu/Dropbox/MAGMA/HIcol.fits'
path='/Users/boyangliu/Dropbox/ATCA_SMC/NHI/NHI_'
filelist=[]
for n in np.arange(9):
filelist.append(path+str(n+1)+'.fit')
print(path+str(n+1)+'.fit')
CDELT3=1.649
CRPIX3=1
CRVAL3=190
fig=plt.figure(figsize=(8,7))
cbaxes = fig.add_axes([0.85, 0.11, 0.02, 0.81])
norm = mpl.colors.Normalize(vmin=-0.5e+21,vmax=1.5e+21)
fig.colorbar(cm.ScalarMappable(norm=norm, cmap='Greys'), cax = cbaxes)
cbaxes.set_ylabel('$N_{H,uncor} (cm^{-2})$')
for n in np.arange(9):
print(n,0.1+(n%3)*0.25,0.65-(n//3)*0.27)
subfig=aplpy.FITSFigure(filelist[n],figure=fig,subplot=[0.1+(n%3)*0.25,0.65-(n//3)*0.27,0.25,0.27])
subfig.show_grayscale(invert=1,vmin=-0.5e+21,vmax=1.5e+21) #white background
subfig.recenter(79.75,-69.5,radius=5) #radius in degree
subfig.show_contour(HIcol, levels=[1E21], colors='r', linewidths=0.1, alpha=0.3)
subfig.add_grid()
subfig.grid.set_linewidth(0.5)
subfig.axis_labels.set_font(size='small')
subfig.tick_labels.set_font(size='small')
if n < 6:
subfig.tick_labels.hide_x()
subfig.axis_labels.hide_x()
if n%3!=0:
subfig.tick_labels.hide_y()
subfig.axis_labels.hide_y()
n0=5+n*10
n1=n0+10
v0=(n0-CRPIX3)*CDELT3+CRVAL3
v1=(n1-CRPIX3)*CDELT3+CRVAL3
subfig.add_label(0.32, 0.95, str(int(v0))+' < v < '+str(int(v1))+' km/s', relative=True, weight='light', size='small')
for i in np.arange(line_count):
peakv=peak_velo_kms[i]
if (peakv > v0) & (peakv < v1):
slope=slope_m[i]
if slope > 0:
Tsc2color=(T_spin_cold[i]-5)*1.49/100.
print(T_spin_cold[i],Tsc2color)
SNr=SN_ratio[i]
radius=np.log10(SNr)-0.6
subfig.show_circles(RA[i], Dec[i], radius,linewidth=0.1,edgecolor='b',facecolor=[0.8, Tsc2color, 0])
else:
subfig.show_circles(RA[i], Dec[i], 0.1,linewidth=0.1,edgecolor='white',facecolor='black')
if n == 8:
subfig.show_circles(89, -72, np.log10(5)-0.6, edgecolor='black', linewidth=0.1)
subfig.show_circles(89, -72,np.log10(10)-0.6, edgecolor='black', linewidth=0.1)
subfig.show_circles(89, -72, np.log10(20)-0.6, edgecolor='black', linewidth=0.1)
subfig.show_circles(89, -72, np.log10(40)-0.6, edgecolor='black', linewidth=0.1)
subfig.add_label(0.25, 0.05, 'S/N: 5,10,20,40', relative=True, weight='ultralight', size='small')
for i in np.arange(200):
subfig.show_rectangles(1200+3*i, 500, 3, 150, coords_frame='pixel', facecolor=[0.8, i/200., 0])
subfig.add_label(0.6, 0.12, '5', relative=True, weight='light', size='small')
subfig.add_label(0.76, 0.12, '39', relative=True, weight='light', size='small')
subfig.add_label(0.92, 0.12, '72', relative=True, weight='light', size='small')
subfig.add_label(0.77, 0.06, r'$T_{c}$(K)', relative=True, weight='light', size='small')#what is q=0.5 in Katie's paper?
# plt.show()
outpath='/Users/boyangliu/Dropbox/ATCA_SMC/190624/maps/'
plt.savefig(outpath+'Map_v.pdf',dpi=200) #it takes long to produce an eps! use png for quick view!