Blame view

src/idl/dustem_plot_fit_extsed.pro 4.29 KB
8d3ca45d   Jean-Philippe Bernard   First commit
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
PRO dustem_plot_fit_extsed,st,sed, $
                          res=res, $
                          help=help, $
                          win=win, $
                          ps=ps, $
                          UV=UV, $
                          _extra=_extra

;+
; NAME:
;    dustem_plot_fit_extsed
; PURPOSE:
;    Plots a Dustem model and SED. Parameter values and error are
;    printed on plot. Used for plotting results during fit.
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    dustem_plot_fit_sed,st,sed,cont[,/no_spec_error][,res=][,errors=][,chi2=][,rchi2=][/help][_extra=]
; INPUTS:
;    st        = Dustem model output structure
;    sed       = Dustem model SED
;    cont      = Dustem model NIR continuum
; OPTIONAL INPUT PARAMETERS:
;    res       = fit result values. If set values are written on plot.
;    errors    = fit result errors. If set values are written on plot.
;    chi2      = fit chi^2. if set value is written on plot.
;    rchi2     = Reduced fit chi^2. if set value is written on plot.
;    _extra    = extra parameters for the plot routine
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    SED and model are plotted
; RESTRICTIONS:
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; EXAMPLES
;    dustem_plot_fit_sed,st,sed,cont
; MODIFICATION HISTORY:
;    Written by J.-Ph. Bernard
;    see evolution details on the dustem cvs maintained at CESR
;    Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems.
;-

;stop

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_plot_fit_extsed'
  goto,the_end
ENDIF

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
;ENDELSE

;fact = 1.e4*1.E20/(4.*!pi)/(3.e8/1.e-6/st.sed.wav)*1.e20/1.e7

;use_col_data_filt=70
;use_col_sed_spec=170
use_col_data_filt='blue'
;use_col_sed_spec='red'
use_col_sed_spec='grey'
IF not keyword_set(col_sed) THEN BEGIN
  ;use_col_sed_filt=250     ;red
  use_col_sed_filt='red'     ;red
ENDIF ELSE BEGIN
  use_col_sed_filt=col_sed
ENDELSE
IF not keyword_set(col_tot) THEN BEGIN
  ;use_col_tot=200
  use_col_tot='black'
ENDIF ELSE BEGIN
  use_col_tot=col_tot
ENDELSE
IF not keyword_set(line_tot) THEN BEGIN
  use_line_tot=0
ENDIF ELSE BEGIN
  use_line_tot=line_tot
ENDELSE
;color and linestyle for continuum
IF not keyword_set(col_cont) THEN BEGIN
  ;use_col_cont=30
  use_col_cont='Navy'
ENDIF ELSE BEGIN
  use_col_count=col_cont
ENDELSE
IF not keyword_set(line_cont) THEN BEGIN
  use_line_cont=0
ENDIF ELSE BEGIN
  use_line_cont=line_cont
ENDELSE
;color and linestyle for freefree
IF not keyword_set(col_freefree) THEN BEGIN
  ;use_col_cont=30
  use_col_freefree='Dark Red'
ENDIF ELSE BEGIN
  use_col_freefree=col_freefree
ENDELSE
IF not keyword_set(line_freefree) THEN BEGIN
  use_line_freefree=0
ENDIF ELSE BEGIN
  use_line_freefree=line_freefree
ENDELSE
IF not keyword_set(col_synchrotron) THEN BEGIN
  ;use_col_cont=30
  use_col_synchrotron='Dark Red'
ENDIF ELSE BEGIN
  use_col_synchrotron=col_synchrotron
ENDELSE
IF not keyword_set(line_synchrotron) THEN BEGIN
  use_line_synchrotron=0
ENDIF ELSE BEGIN
  use_line_synchrotron=line_synchrotron
ENDELSE

;win=1
dustem_ext = interpol(st.ext.ext_tot,st.ext.wav,(*!dustem_data.ext).wav) 
chi2_ext   = total(((*!dustem_data.ext).values-dustem_ext)^2/(*!dustem_data.ext).sigma^2)
n_ext = n_elements((*!dustem_data.ext).values)
rchi2_ext  = chi2_ext / n_ext
d0f68bb6   Jean-Philippe Bernard   replaced system v...
131
wrchi2_ext  = rchi2_ext * (*!fit_rchi2_weight).ext
8d3ca45d   Jean-Philippe Bernard   First commit
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
print,"chi2 EXT = ",chi2_ext,"  rchi2 EXT = ",rchi2_ext;," weighted rchi2 EXT=",wrchi2_ext
;xr=[0.3,40]
;yr=[1.e-26,1.e-21]
;dustem_plot_ext,st,yr=yr,/ysty,xr=xr,/xsty,ps=filename,win=win,mergePAH=mergePAH,/donotclose,multi=1,_extra=_extra
dustem_plot_ext,st,ps=filename,mergePAH=mergePAH,/donotclose,multi=1,_extra=_extra,UV=UV
dustem_plot_ext,st,ps=filename,mergePAH=mergePAH,multi=2,UV=UV,_extra=_extra

;win+=1
                    ;dustem_plot_ext,st,/UV,yr=[0,2.5],/ysty,xr=[0,10],/xsty,win=win
;xr=[0.2,10]
;yr=[0,3e-21]
;dustem_plot_ext,st,/UV,yr=yr,/ysty,xr=xr,/xsty,ps=filename,win=win,mergePAH=mergePAH,/donotclose,multi=1
;dustem_plot_ext,st,/UV,yr=yr,/ysty,xr=xr,/xsty,ps=filename,win=win,mergePAH=mergePAH,multi=2

;stop

the_end:

END