Blame view

src/idl/dustem_plot_polsed.pro 3.57 KB
3ff9cac3   Ilyes Choubani   general update
1
PRO dustem_plot_polsed, st, p_dim, dustem_polsed, aligned=aligned, win=win
759a527d   Ilyes Choubani   general update
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


IF keyword_set(ps) THEN BEGIN
    set_plot, 'PS'
    device, filename=ps, /color, /encapsulated
ENDIF ELSE BEGIN
  set_plot,'X'
    IF keyword_set(win) then window,win,title='DUSTEM WRAP (POLSED)'
ENDELSE


;I will try to use the refreshed version of the polsed model spectrum
;This is because the default procedures for dustem

titstq='Polarization Intensity'
d012e324   Ilyes Choubani   FIX to the use of...
17
ytitstq=textoidl('P_\nu (W/m^2/Hz/sr) for N_H=10^{20} H/cm^2')
759a527d   Ilyes Choubani   general update
18
19
xtit=textoidl('\lambda (\mum)')
xr=[10,2e4]
b7f936fc   Ilyes Choubani   to JP: initial fi...
20
yr=[1e-30,1e-19]
759a527d   Ilyes Choubani   general update
21
22
Ngrains=(*!dustem_params).Ngrains
Nwaves=(size(st.polsed.em_tot))[1]
dc72d0b6   Ilyes Choubani   initial procedure...
23
24
25
26
27
28
29


if not keyword_set(st) then begin
    ;activate the plugins here 
    st=dustem_run(p_dim)
    dustem_polsed = dustem_compute_polsed(p_dim,st)
ENDIF
759a527d   Ilyes Choubani   general update
30
 
759a527d   Ilyes Choubani   general update
31

266ae799   Ilyes Choubani   General update
32
fact=1/(4.*!pi)*(*!dustem_HCD)*1.E-20/(3.e8/1.e-6/(st.polsed).wav)*1.00e17 ;applied correction here to take into account the HCD
d012e324   Ilyes Choubani   FIX to the use of...
33
fact1=1.E-20 ;This will convert data (real data) that is in MJy/sr to W
b7f936fc   Ilyes Choubani   to JP: initial fi...
34
35
36

P = st.polsed.em_tot*fact    ;This is Polarized intensity P
I = st.sed.em_tot*fact;This is Total intensity I
759a527d   Ilyes Choubani   general update
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
out=0.

frac=P/I
tes=where(finite(frac) eq 0)
frac(tes)=0.

colors=dustem_grains_colors(Ngrains,ls,ps=ps)
scopes=tag_names((*!dustem_scope))
IF scopes[0] NE 'NONE' THEN BEGIN

FOR i=0L,n_tags(*!dustem_scope)-1 DO BEGIN   
    
    IF total(strsplit((*(*!dustem_scope).(i)),'+',/extract) EQ 'REPLACE_QSED') THEN BEGIN
        
        Q_spec=(*(*!dustem_plugin).(i))[*,1]
    ENDIF 
    
    IF total(strsplit((*(*!dustem_scope).(i)),'+',/extract) EQ 'REPLACE_USED') THEN BEGIN
        U_spec=(*(*!dustem_plugin).(i))[*,2]
    ENDIF
    
ENDFOR    

    
IF ~isa(Q_spec) && ~isa(U_spec) THEN polar_ippsi2iqu,I,Q_spec,U_spec,frac,replicate(0.,Nwaves) 

        
FOR i=0L,n_tags(*!dustem_scope)-1 DO BEGIN
    
    IF total(strsplit((*(*!dustem_scope).(i)),'+',/extract) EQ 'ADD_QSED') THEN BEGIN
        Q_spec+=(*(*!dustem_plugin).(i))[*,1]
    ENDIF
    
    IF total(strsplit((*(*!dustem_scope).(i)),'+',/extract) EQ 'ADD_USED') THEN BEGIN
        U_spec+=(*(*!dustem_plugin).(i))[*,2]
    ENDIF              
    
ENDFOR


P=sqrt(Q_spec^2+U_spec^2)

ENDIF

normpol1=dustem_polsed*fact1
normpol=P
dc72d0b6   Ilyes Choubani   initial procedure...
83
;normpol=P*0.+1. ;and then use this to plot the normalized data
759a527d   Ilyes Choubani   general update
84
85
86
87
88
89
90

; for i = 0, Ngrains-1 do begin
;  if aligned(i) then cgoplot,st.polsed.wav,st.polsed.(i+1)*fact/normpol,color=colors(i+1),psym=psym,line=ls(i+1) ;investigate this line of the plotting of the different components in polarization
; endfor


ylog=1.
b7f936fc   Ilyes Choubani   to JP: initial fi...
91
cgplot,st.polsed.wav,P,xtit='',ytit=ytitstq,tit=titstq,ylog=ylog,/xlog,xr=xr,yr=yr,/ys,/xs,position=[0.17,0.35,0.93,0.93],xtickformat='(A1)',charsize=1.3
759a527d   Ilyes Choubani   general update
92
cgoplot,st.polsed.wav,P,color='black'
dc72d0b6   Ilyes Choubani   initial procedure...
93
94
cgoplot,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1,color='Tomato',psym=16,symsize=1,thick=2
err_bar,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1,yrms=3.*((*!dustem_data.polsed).sigma)/2.*fact1,color=cgColor('Tomato')
759a527d   Ilyes Choubani   general update
95
96
cgoplot,(*!dustem_data.polsed).wav,dustem_polsed*fact1,psym=6,color='red',symsize=2

b7f936fc   Ilyes Choubani   to JP: initial fi...
97
cgplot,st.polsed.wav,P/P,xtit=xtit,ytit='Normalized',tit='',/xlog,xr=xr,/ys,/xs,yr=[0,2],ylog=0,position=[0.17,0.14,0.93,0.35],/noerase,yticks=2,ymino=5,xticklen=0.1,ytickformat='(F6.2)',charsize=1.3    
759a527d   Ilyes Choubani   general update
98
cgoplot,st.polsed.wav,P/P,color='black'
dc72d0b6   Ilyes Choubani   initial procedure...
99
100
cgoplot,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1/normpol1,color='Tomato',psym=16,symsize=1,thick=2
err_bar,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1/normpol1,yrms=3.*((*!dustem_data.polsed).sigma)/2./normpol1*1E-20,color=cgColor('Tomato')
759a527d   Ilyes Choubani   general update
101
        
b7f936fc   Ilyes Choubani   to JP: initial fi...
102
;stop
759a527d   Ilyes Choubani   general update
103
104
105
106
107
108
109
110
111
112

IF keyword_set(ps) THEN BEGIN
  device,/close
  set_plot,'X'
ENDIF




END