Commit 746b3ee287e206e08b75dcd1b5581fd98afb9182
1 parent
87fc4ae7
Exists in
master
fixed for REPLACE_FORTRAN plugins
Showing
5 changed files
with
54 additions
and
18 deletions
Show diff stats
src/idl/dustem_activate_plugins.pro
... | ... | @@ -56,6 +56,8 @@ IF keyword_set(help) THEN BEGIN |
56 | 56 | output=0. |
57 | 57 | ENDIF |
58 | 58 | |
59 | +;stop | |
60 | + | |
59 | 61 | p_dim = p_min * (*(*!dustem_fit).param_init_values) |
60 | 62 | |
61 | 63 | ;This is to account for fixed parameters |
... | ... | @@ -95,8 +97,9 @@ ENDELSE |
95 | 97 | ;JPB: Removed allusion to param_func not used in dustem_run_plugins.pro (08 March 2024) |
96 | 98 | ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_SED'], avoid=1,use_previous_fortran=use_previous_fortran |
97 | 99 | ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 1, avoid=1,use_previous_fortran=use_previous_fortran |
98 | -dustem_run_plugins, p_dim ,param_descs, param_values, 1, avoid=1,use_previous_fortran=use_previous_fortran | |
100 | +dustem_run_plugins, p_dim ,param_descs, param_values, 1,use_previous_fortran=use_previous_fortran | |
99 | 101 | |
102 | +;===== This one is the one that runs the Fortran even if there is no plugin of type 2 invoked (!) | |
100 | 103 | ;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. |
101 | 104 | ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 2,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step. |
102 | 105 | dustem_run_plugins, p_dim ,param_descs, param_values, 2,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step. |
... | ... | @@ -105,10 +108,11 @@ dustem_run_plugins, p_dim ,param_descs, param_values, 2,force_dustem_run=1,st=st |
105 | 108 | ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 3,use_previous_fortran=use_previous_fortran |
106 | 109 | dustem_run_plugins, p_dim ,param_descs, param_values, 3,use_previous_fortran=use_previous_fortran |
107 | 110 | |
111 | +;stop | |
108 | 112 | ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_SED'],use_previous_fortran=use_previous_fortran |
109 | 113 | ;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 4,use_previous_fortran=use_previous_fortran |
110 | -dustem_run_plugins, p_dim ,param_descs, param_values, 4,use_previous_fortran=use_previous_fortran | |
111 | - | |
114 | +dustem_run_plugins, p_dim ,param_descs, param_values, 4,use_previous_fortran=use_previous_fortran,/ask_for_st,st=st | |
115 | +;stop | |
112 | 116 | |
113 | 117 | the_end: |
114 | 118 | ... | ... |
src/idl/dustem_plugin_dl07_isrf_model.pro
1 | -FUNCTION dustem_plugin_dl07_isrf_model, key=key, val=val, scope=scope, paramtag=paramtag, help=help, Umean=Umean | |
1 | +FUNCTION dustem_plugin_dl07_isrf_model, key=key, val=val, scope=scope, paramtag=paramtag, help=help, Umean=Umean,st=st | |
2 | 2 | |
3 | 3 | ;+ |
4 | 4 | ; NAME: |
... | ... | @@ -71,6 +71,9 @@ IF keyword_set(paramtag) THEN BEGIN |
71 | 71 | goto, the_end |
72 | 72 | ENDIF |
73 | 73 | |
74 | +;dustem_print_params | |
75 | +;stop | |
76 | + | |
74 | 77 | spec=0. |
75 | 78 | |
76 | 79 | ;==== default parameter values |
... | ... | @@ -111,6 +114,8 @@ param_desc=['(*!dustem_params).G0'] |
111 | 114 | param_values=[Umin] |
112 | 115 | |
113 | 116 | dustem_init_params,!dustem_model,param_desc,param_values |
117 | + | |
118 | +;stop | |
114 | 119 | st=dustem_run(param_values) |
115 | 120 | spec1=st.sed.em_tot |
116 | 121 | spec=(1.-gamma)*spec1 |
... | ... | @@ -129,23 +134,30 @@ IF gamma NE 0. THEN BEGIN |
129 | 134 | fact=gamma*(alpha-1.)/(Umin^(1.-alpha)-Umax^(1.-alpha)) |
130 | 135 | FOR i=0L,NUs-1 DO BEGIN |
131 | 136 | param_values[0]=Us[i];^(-1.*alpha) |
137 | + ;stop | |
132 | 138 | st=dustem_run(param_values) |
133 | 139 | ffacts[i]=Us[i]^(-1.*alpha)*fact |
134 | 140 | specs[i,*]=ffacts[i]*st.sed.em_tot |
135 | 141 | ENDFOR |
136 | 142 | ;integrate over U |
143 | + ;stop | |
137 | 144 | FOR j=0L,Nwavs-1 DO BEGIN |
138 | 145 | integ=integral(Us,reform(specs[*,j]),Umin,Umax) |
139 | 146 | spec[j]=spec[j]+integ[0] |
140 | 147 | ENDFOR |
141 | - ;FOR i=0L,Nus-1 DO BEGIN | |
142 | - ; print,Us[i],ffacts[i] | |
143 | - ;ENDFOR | |
144 | 148 | ENDIF |
145 | 149 | |
146 | -;This is to update keyword st with final spectrum | |
150 | +;stop | |
151 | + | |
152 | +;This is to update keyword st with final spectrum. Useless, as there is no st keyword ! | |
153 | +;Not necessary here, but to be used in plugins with scope 'REPLACE_FORTRAN' which actually do not call the Fortran at all. | |
154 | +;Ngrains=3 | |
155 | +;st=dustem_make_empty_fortran_st(Ngrains) | |
147 | 156 | st.sed.em_tot=spec |
148 | 157 | |
158 | +;dustem_print_params | |
159 | +;stop | |
160 | + | |
149 | 161 | the_end: |
150 | 162 | scope='REPLACE_FORTRAN' |
151 | 163 | ... | ... |
src/idl/dustem_run.pro
src/idl/dustem_run_plugins.pro
... | ... | @@ -3,8 +3,9 @@ PRO dustem_run_plugins, p_dim $ |
3 | 3 | ,param_values $ |
4 | 4 | ; ,param_func $ |
5 | 5 | ,run_order $ |
6 | + ,ask_for_st=ask_for_st $ | |
6 | 7 | ,st=st $ |
7 | - ,avoid=avoid $ | |
8 | +; ,avoid=avoid $ | |
8 | 9 | ,force_dustem_run=force_dustem_run $ |
9 | 10 | ,use_previous_fortran=use_previous_fortran $ |
10 | 11 | ,help=help |
... | ... | @@ -72,8 +73,8 @@ dew_prefix='dustem_plugin_' ; we assume that this prefix is at the start of all |
72 | 73 | IF (*!dustem_plugin)[0].name EQ 'NONE' THEN goto, the_end |
73 | 74 | |
74 | 75 | ;==== This is probably not useful |
75 | -if not keyword_set(avoid) then avoid=0 | |
76 | -if not keyword_set(force_dustem_run) then force_dustem_run=0 | |
76 | +;if not keyword_set(avoid) then avoid=0 | |
77 | +;if not keyword_set(force_dustem_run) then force_dustem_run=0 | |
77 | 78 | |
78 | 79 | ;print,scopes |
79 | 80 | ;print,(*!dustem_plugin).scope |
... | ... | @@ -92,6 +93,7 @@ ENDFOR |
92 | 93 | |
93 | 94 | ;print,must_be_run |
94 | 95 | ;stop |
96 | +ind2be_run=where(must_be_run EQ 1,N2be_run) | |
95 | 97 | |
96 | 98 | ;=== run plugins that need be run |
97 | 99 | FOR i=0L,Nplugins-1 DO BEGIN |
... | ... | @@ -112,17 +114,32 @@ FOR i=0L,Nplugins-1 DO BEGIN |
112 | 114 | ENDFOR |
113 | 115 | keys=keys[1:*] |
114 | 116 | vals=vals[1:*] |
115 | - str='(*!dustem_plugin)['+strtrim(i,2)+'].spec=ptr_new('+(*!dustem_plugin)[i].name+'(key=keys,val=vals)'+')' | |
116 | - message,'executing '+str,/info | |
117 | - toto=execute(str) | |
117 | + IF keyword_set(ask_for_st) THEN BEGIN | |
118 | + str='spectrum='+(*!dustem_plugin)[i].name+'(key=keys,val=vals,st=st)' | |
119 | + message,'executing '+str,/info | |
120 | + toto=execute(str) | |
121 | + ;stop | |
122 | + ;dustem_init_st, | |
123 | + ENDIF ELSE BEGIN | |
124 | + str='spectrum='+(*!dustem_plugin)[i].name+'(key=keys,val=vals)' | |
125 | + message,'executing '+str,/info | |
126 | + toto=execute(str) | |
127 | + ENDELSE | |
118 | 128 | ;stop |
129 | + (*!dustem_plugin)[i].spec=ptr_new(spectrum) | |
130 | + ;str='(*!dustem_plugin)['+strtrim(i,2)+'].spec=ptr_new('+(*!dustem_plugin)[i].name+'(key=keys,val=vals)'+')' | |
131 | + ;message,'executing '+str,/info | |
132 | + ;toto=execute(str) | |
119 | 133 | ENDIF |
120 | 134 | ENDFOR |
121 | 135 | |
122 | -the_end: | |
123 | -IF keyword_set(force_dustem_run) THEN BEGIN ;and idd gt 0. : remved this so that dustem is always run when the keyword is mentioned. | |
136 | +;IF keyword_set(force_dustem_run) THEN BEGIN ;and idd gt 0. : remved this so that dustem is always run when the keyword is mentioned. | |
137 | +IF keyword_set(force_dustem_run) and N2be_run NE 0 THEN BEGIN ;and idd gt 0. : remved this so that dustem is always run when the keyword is mentioned. | |
124 | 138 | st = dustem_run(p_dim,use_previous_fortran=use_previous_fortran) |
125 | 139 | !dustem_current = ptr_new(st) |
126 | -ENDIF | |
140 | +ENDIF | |
141 | + | |
142 | +;=== JPB: This was initially above the previous test. I moved it below. | |
143 | +the_end: | |
127 | 144 | |
128 | 145 | END | ... | ... |
src/idl/dustem_write_all.pro
... | ... | @@ -33,7 +33,7 @@ PRO dustem_write_all,st,dir_out,help=help |
33 | 33 | ; None |
34 | 34 | ; |
35 | 35 | ; SIDE EFFECTS: |
36 | -; None | |
36 | +; JPB: In fact, this routine could probably use st=*!dustem_params and dir_out=!dustem_dat and would need no arguments ... | |
37 | 37 | ; |
38 | 38 | ; RESTRICTIONS: |
39 | 39 | ; The DustEMWrap IDL code must be installed | ... | ... |