Commit 0ed06487de7cef6786743f522029ff362c77832b

Authored by Jean-Philippe Bernard
1 parent a7446da7
Exists in master

new version now working with the avtual fiducial ssps

src/idl/dustem_plugin_phangs_stellar_continuum.pro
... ... @@ -53,16 +53,26 @@ IF keyword_set(help) THEN BEGIN
53 53 goto,the_end
54 54 ENDIF
55 55  
  56 +IF keyword_set(scope) THEN BEGIN
  57 + out=0
  58 + goto, the_scope
  59 +ENDIF
  60 +
  61 +;IF keyword_set(paramtag) THEN BEGIN
  62 +; out=0
  63 +; goto, the_paramtag
  64 +;ENDIF
  65 +
56 66 ;stop
57 67  
58 68 ;default values of input parameters
59   -scope='ADD_SED'
60 69  
61 70 age_values=[0.03, 0.05, 0.08, 0.15, 0.25, 0.40, 0.60, 1.0, 1.75, 3.0, 5.0, 8.5, 13.5]
62 71 metalicity_values=[-1.48630, -0.961400, -0.351200, +0.0600000, +0.255900, +0.397100]
63 72  
64 73 ;read template info
65 74 info_st=dustem_read_emiles_stellar_templates(age_values,metalicity_values,/info_only)
  75 +;stop
66 76 age_values_emiles=info_st.age
67 77 order=sort(age_values_emiles)
68 78 age_values_emiles=age_values_emiles[order]
... ... @@ -74,20 +84,34 @@ met_values_emiles=met_values_emiles[order]
74 84 un=uniq(met_values_emiles)
75 85 met_values_emiles=met_values_emiles[un]
76 86  
  87 +;==== This does not work because the info files has many more entries than there are available ssps.
  88 +;age_values=age_values_emiles
  89 +;metalicity_values=met_values_emiles
  90 +
77 91 Nage=n_elements(age_values)
78 92 Nmetalicity=n_elements(metalicity_values)
79 93 Nparam=Nage*Nmetalicity+1 ;+1 is for opacity
80   -paramtag=strarr(Nparam)
81 94 paramdefault=dblarr(Nparam)
82   -paramdefault[*]=0.D0
83   -i=0L
84   -paramtag[0]='E(B-V)'
85   -ii=1L
86   -FOR i=1L,Nparam-1 DO BEGIN
87   - ij=index2ij([i-1],[Nage,Nmetalicity])
88   - paramtag[ii]='Age'+strtrim(ij[0,0],2)+'Met'+strtrim(ij[0,1],2)
89   - ii=ii+1
90   -ENDFOR
  95 +paramdefault[*]=0.D0 ;default parameter values is 0.
  96 +
  97 +;==== define parameter tags
  98 +
  99 +;If the test below is activated (ie paramtags computed only when requested) the pluggin does not work.
  100 +;IF keyword_set(paramtag) THEN BEGIN
  101 + paramtag=strarr(Nparam)
  102 + paramtag[0]='E(B-V)'
  103 + ii=1L
  104 + FOR i=1L,Nparam-1 DO BEGIN
  105 + ij=index2ij([i-1],[Nage,Nmetalicity])
  106 + paramtag[ii]='Age'+strtrim(ij[0,0],2)+'Met'+strtrim(ij[0,1],2)
  107 + ii=ii+1
  108 + ENDFOR
  109 + ;out=0.
  110 + ;GOTO,the_paramtag
  111 +;ENDIF
  112 +
  113 +;==== decode key keyword.
  114 +;stop
91 115 paramvalues=paramdefault
92 116 IF keyword_set(key) THEN BEGIN
93 117 ind=where(key EQ 1,count)
... ... @@ -98,7 +122,7 @@ IF keyword_set(key) THEN BEGIN
98 122 ENDFOR
99 123 ENDIF
100 124  
101   -;==== initialize templates if not present
  125 +;==== initialize templates if not already present
102 126 defsysv,'!dustem_plugin_phangs_stellar_continuum',exist=exist
103 127 IF exist EQ 0 THEN BEGIN
104 128 st={ssps:ptr_new(),wavs:ptr_new(),Mstars:ptr_new()}
... ... @@ -130,11 +154,13 @@ FOR i=1L,Nparam-1 DO BEGIN
130 154 IF count NE 0 THEN BEGIN
131 155 ssp=*(*!dustem_plugin_phangs_stellar_continuum.ssps)[i-1]
132 156 output[ind,0]=output[ind,0]+paramvalues[i]*Mstar*interpol(ssp,wavs,lambir[ind])
  157 + message,'Mstar='+strtrim(Mstar,2)+' paramvalue='+strtrim(paramvalues[i],2),/continue
133 158 ENDIF
134 159 ENDIF
135 160 ENDFOR
136 161 ;==== Caution: at this point, output is unredenned Flambda in Lsun/pc^2/Angstroem
137 162  
  163 +stop
138 164 ;==== reden spectrum using Calzetti's extinction law (which is what Phangs does)
139 165 flux=output[*,0]
140 166 ;factor -1 is to reden, instead of unreden. factor 1e4 is to go from microns to Angstroem
... ... @@ -146,9 +172,8 @@ output[*,1]=0.
146 172 output[*,2]=0.
147 173  
148 174 ;at that stage, output is F_lambda in Lsun/A/pc^2
149   -;goint to MJy/sr (1e-20 W/m2/sr/hz)
  175 +;going to W/m2/sr/hz
150 176 pc=3.085677581e16 ;m
151   -;kpc=3.085677581e19 ;m
152 177 Lsun=3.828e26 ;Watts
153 178 c=3.e5*1e3 ;m/s
154 179 ;Fact=Lsun ;Watts/A
... ... @@ -156,8 +181,15 @@ c=3.e5*1e3 ;m/s
156 181 ;fact=fact/4./!pi ;Watts/Hz/sr
157 182 ;fact=fact/pc^2 ;Watts/m2/Hz/sr
158 183  
159   -fact=Lsun/pc*c/4./!pi/pc
  184 +fact=Lsun/pc*c/4./!pi/pc ;to go from F_lambda in Lsun/A/pc^2 to Watts/m2/Hz/sr
160 185 output=output*fact
  186 +;print,fact
  187 +; 9.59803
  188 +
  189 +the_scope:
  190 +scope='ADD_SED'
  191 +
  192 +the_paramtag:
161 193  
162 194 the_end:
163 195 RETURN,output
... ...
src/idl/dustem_read_emiles_stellar_templates.pro
... ... @@ -52,7 +52,8 @@ IF keyword_set(help) THEN BEGIN
52 52 goto,the_end
53 53 END
54 54  
55   -dir_templates='/Users/jpb/Soft_Libraries/dustem-wrapper_idl/Data/SSPs/ssp_emiles-ch/'
  55 +;dir_templates=!dustem_wrap_soft_dir+'/Data/SSPs/ssp_emiles-ch/'
  56 +dir_templates=!dustem_wrap_soft_dir+'/Data/SSPs/ssp_emiles-ch_extended/'
56 57  
57 58 ;read templates info file
58 59 ;IMF slope Z Age Mtotal M(*+remn) M* Mremn Mgas M(*+remn)/Lv M*/Lv Mv unknown
... ...