Commit a90f313b52abbb2e5db6c121725314f9b7ae3c11

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

fixed with the right scope

src/idl/dustem_activate_plugins.pro
... ... @@ -96,7 +96,7 @@ dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_SED'], a
96 96 ;IC: I think the segmentation fault comes from the fact that the user wants to use models that have the /pol keyword in the GRAIN.DAT file without being in polarization mode.
97 97  
98 98 ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['STELLAR','ISRF'] ,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step.
99   -dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_ISRF'] ,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step.
  99 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_ISRF','REPLACE_ISRF'] ,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step.
100 100  
101 101 ;added this small condition to ensure that dustem is run
102 102 ;(if no ISRF plugin is used)
... ...
src/idl/dustem_plugin_stellar_population.pro
1   -FUNCTION dustem_plugin_stellar_population, key=key, val=val, scope=scope, paramtag=paramtag,help=help,test=test,initialize=initialize
  1 +FUNCTION dustem_plugin_stellar_population, key=key, val=val, scope=scope, paramtag=paramtag,help=help,test=test
2 2  
3 3 ;+
4 4 ; NAME:
... ... @@ -39,31 +39,51 @@ IF keyword_set(help) THEN BEGIN
39 39 goto,the_end
40 40 ENDIF
41 41  
  42 +;print,keyword_set(scope)
  43 +;print,keyword_set(paramtag)
  44 +;print,keyword_set(key),keyword_set(val)
  45 +;stop
  46 +
42 47 IF keyword_set(scope) THEN BEGIN
43 48 message,'Scope keyword was set',/continue
44   - stop
45   -ENDIF
  49 + ;scope='STELLAR_POPULATION'
  50 + ;scope='REPLACE_ISRF'
  51 + scope='ADD_ISRF'
  52 + stellar_isrf=0.
  53 + goto,the_end
  54 + ;stop
  55 +ENDIF
46 56  
47   -IF keyword_set(paramtag) THEN BEGIN
48   - message,'paramtag keyword was set',/continue
49   - stop
50   -; out=0
51   -; goto, the_paramtag
  57 +;==== read stellar population parameters if not already in memory
  58 +defsysv,'!dustem_plugin_stellar_population',exist=exist
  59 +IF exist EQ 0 THEN BEGIN
  60 + message,'Initializing stellar population parameters',/continue
  61 + file = !dustem_wrap_soft_dir+'Data/STELLARPOPS/EEM_dwarf_UBVIJHK_colors_Teff.xcat'
  62 + st=read_xcat(file,/silent)
  63 + defsysv,'!dustem_plugin_stellar_population',st
52 64 ENDIF
53   -scope='STELLAR_POPULATION'
  65 +
  66 +Nstars=n_elements(!dustem_plugin_stellar_population)
  67 +paramvalues=fltarr(Nstars,2) ;first parameter is distance to the stars in pc, second is the number of such stars
  68 +Nparam=Nstars*2
54 69 stellar_isrf=0.
  70 +spectral_types=!dustem_plugin_stellar_population.spt
55 71  
56   -;==== read stellar population parameters if not already in memory
57   -IF keyword_set(initialize) THEN BEGIN
58   - defsysv,'!dustem_plugin_stellar_population',exist=exist
59   - IF exist EQ 0 THEN BEGIN
60   - message,'Initializing stellar population parameters',/continue
61   - file = !dustem_wrap_soft_dir+'Data/STELLARPOPS/EEM_dwarf_UBVIJHK_colors_Teff.xcat'
62   - st=read_xcat(file,/silent)
63   - defsysv,'!dustem_plugin_stellar_population',st
64   - ENDIF
65   - goto,the_end
  72 +IF keyword_set(paramtag) THEN BEGIN
  73 + message,'paramtag keyword was set',/continue
  74 + paramtag=strarr(Nparam)
  75 + ii=0L
  76 + FOR i=0L,Nparam-1 DO BEGIN
  77 + ij=index2ij([i],[Nstars,2])
  78 + IF ij[0,1] EQ 0 THEN cc='dist to ' ELSE cc='N of '
  79 + paramtag[ii]=cc+spectral_types[ij[0,0]]
  80 + ii=ii+1
  81 + ENDFOR
  82 + ;stop
  83 + stellar_isrf=0.
  84 + goto, the_end
66 85 ENDIF
  86 +stellar_isrf=0.
67 87  
68 88 ;stop
69 89  
... ... @@ -85,21 +105,6 @@ pc2cm = 3.086e18 ;cm (cgs)
85 105 ;This will help ease and shorten the fitting procedure
86 106 ;If the user wants to use them without having to read the entirety of this plugin please contact the DustEmWrap team.
87 107  
88   -Nstars=n_elements(!dustem_plugin_stellar_population)
89   -paramvalues=fltarr(Nstars,2) ;first parameter is distance to the stars in pc, second is the number of such stars
90   -Nparam=Nstars*2
91   -stellar_isrf=0.
92   -spectral_types=!dustem_plugin_stellar_population.spt
93   -
94   -paramtag=strarr(Nparam)
95   -ii=0L
96   -FOR i=0L,Nparam-1 DO BEGIN
97   - ij=index2ij([i],[Nstars,2])
98   - IF ij[0,1] EQ 0 THEN cc='dist to ' ELSE cc='N of '
99   - paramtag[ii]=cc+spectral_types[ij[0,0]]
100   - ii=ii+1
101   -ENDFOR
102   -
103 108 IF keyword_set(key) THEN BEGIN
104 109 ;stop
105 110 FOR i=0L,n_elements(key)-1 DO BEGIN
... ... @@ -127,13 +132,10 @@ IF keyword_set(key) THEN BEGIN
127 132 fact=1./1.e20*1.e7/1.e4
128 133 stellar_isrf=stellar_isrf*fact ;ergs/cm2/s/Hz
129 134 ENDIF
130   -
131   -;the_scope:
132   -;scope='STELLAR_POPULATION'
133 135  
134   -the_end:
135   -;print,minmax(stellar_isrf)
136 136 ;stop
137 137  
138   -RETURN, stellar_isrf
  138 +the_end:
  139 +
  140 +RETURN,stellar_isrf
139 141 END
... ...
src/idl/dustem_stellarpopisrf_example.pro
... ... @@ -117,8 +117,11 @@ dustem_define_la_common
117 117 ;; example parameter initialisation 1
118 118 ;; Here we attempt to fit the distance to a single O7V star
119 119 ;; Other ISRF contributions are fixed to ~zero
120   -toto=dustem_plugin_stellar_population(/initialize)
  120 +;toto=dustem_plugin_stellar_population(/initialize)
  121 +scope=1
  122 +toto=dustem_plugin_stellar_population(scope=scope)
121 123 ;=== get the parameter tagnames
  124 +paramtag=1
122 125 toto=dustem_plugin_stellar_population(paramtag=paramtag)
123 126  
124 127 ;stop
... ... @@ -132,7 +135,8 @@ iv = true_vals+[1.] ; distance we use as an initial guess
132 135  
133 136 fpd=['dustem_plugin_stellar_population_'+strtrim(ind2+1,2) , $ ;number of O7V star (FIXED)
134 137 '(*!dustem_params).G0'] ; Mathis field (FIXED TO ~ZERO)
135   -fiv=[1.,1.e-12]
  138 +;fiv=[1.,1.e-12]
  139 +fiv=[1.,1.]
136 140  
137 141 Npar=n_elements(pd)
138 142 ulimed=replicate(0,Npar) & ulimed[0]=0
... ... @@ -142,7 +146,7 @@ llims=replicate(1.e-15,Npar) & llims[0]=15.
142 146  
143 147 ;=== INITIALIZE DUSTEMWRAP
144 148  
145   -dustem_init,model=use_model,polarization=use_polarization
  149 +dustem_init,model=use_model,polarization=use_polarization,/show_plots
146 150 ;help,(*!dustem_plugin).(0),/str
147 151 ;stop
148 152  
... ...