forked from ianan/nsigh_nov14
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_fitted_specs_p1.pro
137 lines (109 loc) · 5.15 KB
/
plot_fitted_specs_p1.pro
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
133
134
135
136
137
pro plot_fitted_specs_p1,plter=plter,de=de
; PLot showing the regions selected in P1 and the resulting spectra and fits for FPMA and FPMB
; Assumes make_map_nov14o4.pro and fitvth_spec_nov14o4.pro has already been run
;
;
; Optional inputs:
; de - Energy binning of spectrum (default 0.2keV)
; plter - Energy range to plot
;
; For colortable 74 need IDL >8.0
;
; 09-Nov-2015 IGH
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@post_outset
pid=1
pname='P'+string(pid,format='(i1)')
grdid=0
grdname='G'+string(grdid,format='(i1)')
if (n_elements(plter) ne 2) then plter=[2.3,7.9]
if (n_elements(de) eq 0) then de=0.2
denm='DE'+strmid(string(1000+de*100,format='(i4)'),1,3)
intnam='INT'+string(1000+100*(de),format='(i4)')
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; The new regions of interest
; in S/C arcsec
; loads in the roi, xcsp, ycsp,rnm,wid
restore,file='out_files/roi_no14.dat'
nr=n_elements(rnm)
!p.multi=[0,3,2]
loadct,74,/silent
reverse_ct
tvlct,r,g,b,/get
r[0]=0
g[0]=0
b[0]=0
r[1]=255
g[1]=255
b[1]=255
tvlct,r,g,b
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Load in the maps, plot and then overplot the selected regions
fits2map,'out_files/maps_'+pname[0]+grdname+'_EG2_FPMA.fits',mma_in
fits2map,'out_files/maps_'+pname[0]+grdname+'_EG2_FPMB.fits',mmb_in
sub_map,mma_in,mma,xrange=[500,1500],yrange=[-700,300]
sub_map,mmb_in,mmb,xrange=[500,1500],yrange=[-700,300]
mall=[mma.data,mmb.data]
nx=n_elements(mma.data[*,0])
xa0=mma.xc-0.5*mma.dx*nx
ya0=mma.yc-0.5*mma.dy*nx
xcspa=(xcsp-xa0)/mma.dx
xcspb=nx+(xcsp-xa0)/mma.dx
ycspa=(ycsp-ya0)/mma.dx
wida=wid/mma.dx
mm=alog10(gauss_smooth(mall,3))
bscale,mm,min=-2,max=1
set_plot,'ps'
device, /encapsulated, /color, /isolatin1,/inches, $
bits=8, xsize=12, ysize=7,file='figs/fittedSpecsall_'+pname+'_'+intnam+'.eps'
!p.charsize=2.0
dfac=1.
dfac0=1.
; Personally do this via tvim but not under standard ssw install, so using plot_image instead
plot_image,mm,position=[0.01,0.62,0.35,0.92],bottom=1,xstyle=5,ystyle=5
; tvim,alog10(gauss_smooth(mall,3)),range=[-2,1],$
; pcharsize=0.01,position=[0.01,0.62,0.35,0.92],/noframe
for i=0,nr-1 do box_igh,xcspa[i],ycspa[i],wida,color=0,thick=2
for i=0,nr-1 do box_igh,xcspb[i],ycspa[i],wida,color=0,thick=2
for i=0,nr-1 do xyouts,xcspa[i]+0.5*wida+5,ycspa[i]-0.5*wida-5,rnm[i],color=0,chars=0.8
for i=0,nr-1 do xyouts,xcspb[i]+0.5*wida+5,ycspa[i]-0.5*wida-5,rnm[i],color=0,chars=0.8
tube_line_colors
xyouts, 0.5*nx,nx,'P1 FPMA',align=0.5,/data,color=1,chars=1
xyouts, 1.5*nx,nx,'P1 FPMB',align=0.5,/data,color=2,chars=1
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Label with the livetime information - so need to load in fits to get it
restore,file='out_files/fitvth_'+pname+rnm[0]+'FPMA_'+intnam+'.dat'
xyouts, 0.5*nx,-0.01*nx,strcompress(string(fit_out.exp,format='(f5.2)'),/rem)+'s ('+$
strcompress(string(fit_out.lvt_frac*100.,format='(f5.2)')+'%)',/rem),align=0.5,/data,color=1,chars=1
restore,file='out_files/fitvth_'+pname+rnm[0]+'FPMB_'+intnam+'.dat'
xyouts, 1.5*nx,-0.01*nx,strcompress(string(fit_out.exp,format='(f5.2)'),/rem)+'s ('+$
strcompress(string(fit_out.lvt_frac*100.,format='(f5.2)')+'%)',/rem),align=0.5,/data,color=2,chars=1
tmk=0.08617
ylim=[3e-1,2e4]*dfac
xlim=plter
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; For each region plot the FPMA and FPMB spectra and fits
for i=0,nr-1 do begin
restore,file='out_files/fitvth_'+pname+rnm[i]+'FPMA_'+intnam+'.dat'
plot,[1,1],[1,1],xtit='Energy [keV]',xrange=xlim,/ylog,$
yrange=ylim,ytit='counts keV!U-1!N s!U-1!N',ytickf='exp1',$
; yrange=ylim,ytit='counts s!U-1!N cm!U-2!N keV!U-1!N',ytickf='exp1',$
title=pname+' '+rnm[i]
; oplot,[1,10],[10.,10]/de/fit_out.exp ,lines=1,color=150
oploterr,fit_out.engs,fit_out.cnt_flx,fit_out.ecnt_flx,color=1,psym=10,thick=5,/nohat,errthick=3,errcolor=1
;oploterr,fit_out.engs,fit_out.cnt_flx,fit_out.ecnt_flx,color=1,psym=1,thick=4,/nohat,errthick=4,errcolor=1
oplot,fit_out.engs,fit_out.cnt_flx_mod,color=1,thick=5
xyouts,plter[0]+0.95*(plter[1]-plter[0]),10d^3.9,'A: '+string(fit_out.tmk,format='(f4.1)')+' MK, '$
+string(fit_out.parm[0]*1e3,format='(f4.1)')+' x10!U46!N cm!U-3!N',color=1,chars=1.,/data,align=1
oplot,fit_out.eranfit[0]*[1,1],ylim,line=2,thick=2,color=150
oplot,fit_out.eranfit[1]*[1,1],[ylim[0],2e3],line=2,thick=2,color=150
restore,file='out_files/fitvth_'+pname+rnm[i]+'FPMB_'+intnam+'.dat'
oploterr,fit_out.engs,fit_out.cnt_flx,fit_out.ecnt_flx,color=2,psym=10,thick=5,/nohat,errthick=3,errcolor=2
;oploterr,fit_out.engs,fit_out.cnt_flx,fit_out.ecnt_flx,color=2,psym=1,thick=4,/nohat,errthick=4,errcolor=2
oplot,fit_out.engs,fit_out.cnt_flx_mod,color=2,thick=5
xyouts,plter[0]+0.95*(plter[1]-plter[0]),10d^3.5,'B: '+string(fit_out.tmk,format='(f4.1)')+' MK, '$
+string(fit_out.parm[0]*1e3,format='(f4.1)')+' x10!U46!N cm!U-3!N',color=2,chars=1.,/data,align=1
endfor
device,/close
set_plot, mydevice
end