Commit 91e991b58a530ed2b43b6bbc4ef7a844257916a4

Authored by Ilyes Choubani
1 parent 0c25ef54
Exists in master

Applying corrections to run_plugins.

src/idl/dustem_activate_plugins.pro
... ... @@ -49,8 +49,6 @@ ENDIF
49 49 p_dim = p_min * (*(*!dustem_fit).param_init_values)
50 50  
51 51  
52   -
53   -
54 52 ;THISIS USED TO ACCOUNT FOR THE FREEZING OF PLUGIN PARAMETERS
55 53 if isa((*!dustem_fit).fixed_param_descs) then begin
56 54  
... ... @@ -72,8 +70,6 @@ endif else begin
72 70  
73 71 endelse
74 72  
75   -
76   -
77 73 ;PART WHERE THE PLUGINS RUN ACCORDING TO THEIR SCOPES.
78 74  
79 75 ;help section on the way
... ... @@ -83,10 +79,9 @@ endelse
83 79 ;The plugins that use the DustEM output come next - we can always change their 'common' scope
84 80  
85 81 ;IF /avoid is used the specified scopes are avoided. They're considered when /avoid is missing.
86   -dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*STELLAR*','*REPLACE*'], /avoid ;/dustem_run
87   -dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*STELLAR*'] ,/dustem_run;, avoid=avoid
88   -dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*REPLACE*'] ;,/dustem_run;, avoid=avoid
89   -stop
  82 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*STELLAR*','*REPLACE*'], avoid=1
  83 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*STELLAR*'] ,dustem_run=1,st
  84 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*REPLACE*']
90 85  
91 86  
92 87 the_end:
... ...
src/idl/dustem_plugin_modify_dust_pol.pro
... ... @@ -39,20 +39,22 @@ IF keyword_set(help) THEN BEGIN
39 39 ENDIF
40 40  
41 41  
  42 +
42 43 IF keyword_set(scope) THEN BEGIN
43   - scope='REPLACE_POLSED'
44   - out=0.
  44 + out=0
45 45 GOTO, the_end
46 46 ENDIF
47 47  
48 48 IF keyword_set(paramtag) THEN BEGIN
49   - paramtag=['p','Psi (deg)']
50 49 out=0.
51 50 GOTO, the_end
52 51 ENDIF
53 52  
54 53 ;Retrieving this sytem variable (dustem output)
55   -if isa(!dustem_current) then st=*!dustem_current else out =0 & goto, the_end
  54 +if ~isa(!dustem_current) then begin
  55 + out =0
  56 + goto, the_end
  57 +ENDIF else st=(*!dustem_current)
56 58  
57 59 ;below are the default values for the plugin parameters
58 60 smallp_fact=1. ;This is the default multiplicative factore to the dust polarization
... ... @@ -96,10 +98,12 @@ out[*,2]=U
96 98 ; ;out[*,4]=0.5*atan(U,Q)/degtorad
97 99 ; out[*,4]=psi_used
98 100  
99   -
100 101 RETURN, out
101 102  
102 103 the_end:
  104 +scope='REPLACE_POLSED'
  105 +paramtag=['p','Psi (deg)']
  106 +
103 107  
104 108 END
105 109  
... ...
src/idl/dustem_plugin_modify_dust_polx.pro
... ... @@ -39,17 +39,16 @@ IF keyword_set(help) THEN BEGIN
39 39 ENDIF
40 40  
41 41  
42   -
43 42 IF keyword_set(scope) THEN BEGIN
44   - scope='REPLACE_POLEXT'
  43 +
45 44 out=0.
46   - GOTO, the_scope
  45 + GOTO, the_end
47 46 ENDIF
48 47  
49 48 IF keyword_set(paramtag) THEN BEGIN
50   - paramtag=['p','Psi (deg)']
  49 +
51 50 out=0.
52   - GOTO, the_paramtag
  51 + GOTO, the_end
53 52 ENDIF
54 53  
55 54 ;Retrieving this system variable (dustem output)
... ... @@ -111,6 +110,9 @@ out[*,2]=UEXT_spec
111 110 RETURN, out
112 111  
113 112 the_end:
  113 +scope='REPLACE_POLEXT'
  114 +paramtag=['p','Psi (deg)']
  115 +
114 116  
115 117 END
116 118  
... ...
src/idl/dustem_plugin_stellar_population.pro
... ... @@ -38,13 +38,13 @@ IF keyword_set(help) THEN BEGIN
38 38 ENDIF
39 39  
40 40 IF keyword_set(scope) THEN BEGIN
41   - scope='STELLAR_POPULATION'
  41 +
42 42 out=0
43 43 goto, the_end
44 44 ENDIF
45 45  
46 46 IF keyword_set(paramtag) THEN BEGIN
47   - paramtag=['R_star (R_sol)','T_BB (K)','D (pc)','N_stars']
  47 +
48 48 out=0
49 49 goto, the_end
50 50 ENDIF
... ... @@ -3816,6 +3816,8 @@ endif
3816 3816  
3817 3817  
3818 3818 the_end:
  3819 +scope='STELLAR_POPULATION'
  3820 +paramtag=['R_star (R_sol)','T_BB (K)','D (pc)','N_stars']
3819 3821  
3820 3822 return, out
3821 3823 end
3822 3824 \ No newline at end of file
... ...
src/idl/dustem_run_plugins.pro
1   -PRO dustem_run_plugins, p_dim ,param_descs, param_values, param_func, scopes, avoid=avoid, dustem_run=dustem_run
  1 +PRO dustem_run_plugins, p_dim ,param_descs, param_values, param_func, scopes, st, avoid=avoid, dustem_run=dustem_run
2 2  
3 3 ;HELP ON THE WAY/
4 4 ;
... ... @@ -6,6 +6,11 @@ PRO dustem_run_plugins, p_dim ,param_descs, param_values, param_func, scopes, av
6 6 ;Because I don't want to run this block each time the procedure is run I will test on the presence of all the scope tags in !dustem_plugin
7 7 ;if all of them are present then this block has been run.
8 8  
  9 +;Just to be sure
  10 +if not keyword_set(avoid) then avoid=0
  11 +if not keyword_set(dustem_run) then dustem_run=0
  12 +
  13 +
9 14 test_all_scopes = 1.
10 15 FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
11 16  
... ... @@ -56,6 +61,11 @@ IF ~test_all_scopes THEN BEGIN
56 61 toto=execute(str)
57 62 ((*!dustem_plugin).(k).scope)=ptr_new(scope)
58 63  
  64 + str='toto='+ftn+'(paramtag=paramtag)' & str=str(0)
  65 + toto=execute(str)
  66 + ((*!dustem_plugin).(k).paramtag)=ptr_new(paramtag)
  67 +
  68 +
59 69 f=f+1 & i=i+count-1 ; Incrementing the parameter and same-type plugin indices
60 70 ENDIF
61 71 ENDFOR
... ... @@ -79,23 +89,36 @@ FOR i=0L,n_elements(scopes)-1 DO BEGIN
79 89  
80 90 ;Now I need to locate the second '*':
81 91 ind_ast = STRPOS(scopes(i), '*', /REVERSE_SEARCH)
82   - scope_to_match = strmid(scopes(i),1,ind_ast-1) ;not sure about this condition, adding a commented stop
83   - ;stop
  92 + scope_to_match = strmid(scopes(i),1,ind_ast-1)
  93 + ;
  94 + ENDIF ELSE BEGIN ;assuming the string is identical to the plugin's scope
  95 +
  96 + scope_to_match = strupcase(scopes(i))
  97 +
  98 + ENDELSE
  99 + ;Now locating the indices of this scope in !dustem_plugin.
  100 +
  101 + FOR j=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
  102 +
  103 + test = strcmp((*((*!dustem_plugin).(j).scope)),scope_to_match,strlen(scope_to_match),/FOLD_CASE) EQ 1
  104 +
  105 + IF test and keyword_set(avoid) THEN BEGIN
  106 + if (size(indices))[0] GT 1 then indices[j,i] = 0 ELSE indices[j] = 0
  107 + ENDIF ;ELSE BEGIN
  108 +; if (size(indices))[0] GT 1 then indices[j,i] = 1 ELSE indices[j] = 1
  109 +; ENDELSE
  110 +;
  111 + IF test and not keyword_set(avoid)then BEGIN
  112 + if (size(indices))[0] GT 1 then indices[j,i] = 1 ELSE indices[j] = 1
  113 +
  114 + ENDIF
84 115  
85   - ;Now locating the indices of this scope in !dustem_plugin.
  116 + if ~test and keyword_set(avoid) then begin
  117 + if (size(indices))[0] GT 1 then indices[j,i] = 1 ELSE indices[j] = 1
86 118  
87   - FOR j=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
  119 + endif
  120 + ENDFOR
88 121  
89   - test = strcmp((*((*!dustem_plugin).(j).scope)),scope_to_match,strlen(scope_to_match),/FOLD_CASE) EQ 1
90   -
91   - IF test THEN indices[j,i] = 1
92   -
93   -
94   - ENDFOR
95   -
96   -
97   -
98   - ENDIF
99 122  
100 123 ENDFOR
101 124  
... ... @@ -136,35 +159,29 @@ FOR i=0L,n_elements(param_descs)-1 DO BEGIN
136 159 ENDFOR
137 160  
138 161 ;==============Runnig of the plugins according to their scopes==============
139   -
140   -
  162 + idd=1
141 163  
142 164 FOR j=0L,n_elements(scopes)-1 DO BEGIN
143   -
144   - IF indices(k,j) EQ 1 THEN BEGIN
145 165  
146   - str='toto='+ftn+'(paramtag=paramtag)' & str=str(0)
147   -
148   - toto=execute(str)
149   -
150   - ((*!dustem_plugin).(k).paramtag)=ptr_new(paramtag)
151   -
152   - str='((*!dustem_plugin).('+strtrim(k,2)+').spec)=ptr_new('+ftn+'(key=index,val=value)'+')' & str=str(0)
153   -
154   - toto=execute(str) & IF !dustem_verbose NE 0 THEN message,strupcase(strmid(ftn,7)),/info
  166 + if (size(indices))[0] GT 1 then idd *= indices(k,j) ELSE idd *= indices(k)
  167 +
  168 + ENDFOR
  169 +
  170 + IF idd EQ 1 THEN BEGIN
  171 +
  172 + str='((*!dustem_plugin).('+strtrim(k,2)+').spec)=ptr_new('+ftn+'(key=index,val=value)'+')' & str=str(0)
  173 + toto=execute(str) & IF !dustem_verbose NE 0 THEN message,strupcase(strmid(ftn,7)),/info
  174 +
  175 + if keyword_set(dustem_run) then begin
155 176  
  177 + st = dustem_run(p_dim)
  178 + !dustem_current = ptr_new(st)
156 179  
157   - if keyword_set(dustem_run) then begin
158   -
159   - st = dustem_run(p_dim)
160   - !dustem_current = ptr_new(st)
161   -
162   - endif
  180 + endif
163 181  
164   -
165   - ENDIF
166 182  
167   - ENDFOR
  183 +
  184 + ENDIF
168 185  
169 186  
170 187  
... ...