Commit a84e0595f59c69cae01b502a584949d1863b0ffc

Authored by Jean-Philippe Bernard
1 parent 4b27dd18
Exists in master

modified plugin scope handling

LabTools/IRAP/JPB/srun/make_phangs_grids.pro
... ... @@ -13,6 +13,9 @@ PRO make_phangs_grids,bidon
13 13 ;more {$phangs_srundir}/make_phangs_grids.log | grep "iteration "
14 14 ;more {$phangs_srundir}/make_phangs_grids.log | grep "Will produce"
15 15  
  16 +;This won't work, because it needs the Fortran to set files to the same area ...
  17 +;defsysv,'!DUSTEM_RES','/tmp/jbernard/Dustem_nohup'
  18 +
16 19 t0=systime(/sec)
17 20  
18 21 ;make grid
... ...
plugin_scopes_definition.xcat
... ... @@ -13,13 +13,13 @@
13 13 \------------------------------------------------
14 14 \This scope is for plugins adding to the output SEDs
15 15 ADD SED 1
16   -ADD POLSED 1
  16 +\ADD POLSED 1
17 17 \This scope is for plugins replacing the ISRF before fortran is run
18 18 REPLACE ISRF 2
19 19 ADD ISRF 2
20 20 \This scope is for plugins replacing the fortran SEDs
21 21 REPLACE SED 3
22   -REPLACE POLSED 3
  22 +\REPLACE POLSED 3
23 23 REPLACE POLEXT 3
24 24 \This scope is for plugins which fully replace the Fortran, including by calling Fortran several times ...
25 25 REPLACE FORTRAN 4
... ...
src/idl/dustem_activate_plugins.pro
... ... @@ -78,36 +78,27 @@ ENDELSE
78 78  
79 79 ;stop
80 80  
81   -;Run the plugins, according to their scopes
  81 +;===== Run the plugins, according to their scopes (and the Fortran)
82 82  
83   -;normal (additive) plugins come first as they can be used by other plugins
84   -;The ISRF plugin is next - we can always change its scope however we please to. DustEm runs here. This is with the /force_dustem_run keyword.
85   -;The plugins that use the DustEM output come next - we can always change their 'common' scope
  83 +;The 'ADD_SED' plugins are run first. Note that their output could be used by plugins run later.
  84 +;The plugins related to 'ISRF' are run second, and the Fortrn is run at that stage, just after the corresponding plugins.
  85 +;The plugins which Replace the output of the fortran are run last.
86 86  
87 87 ;IF /avoid is used the specified scopes are avoided. They're considered when /avoid is missing.
88 88 ;using '**' so not to write the entire scope
89 89  
90   -;=== This runs plugins with scopes including STELLAR, REPLACE and ISRF
91   -;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD','REPLACE'], avoid=1,use_previous_fortran=use_previous_fortran
92   -dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_SED'], avoid=1,use_previous_fortran=use_previous_fortran
  90 +;=== This runs the plugins
  91 +;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_SED'], avoid=1,use_previous_fortran=use_previous_fortran
  92 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 1, avoid=1,use_previous_fortran=use_previous_fortran
93 93  
94   -;=== The line below makes fawlty go Segmentation fault. st is undefined at that stage
95   -;=== it would run fine if avoid was set to 1
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.
  94 +;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.
  95 +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.
97 96  
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, ['ADD_ISRF','REPLACE_ISRF'] ,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step.
  97 +;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_SED'],use_previous_fortran=use_previous_fortran
  98 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 3,use_previous_fortran=use_previous_fortran
100 99  
101   -;added this small condition to ensure that dustem is run
102   -;(if no ISRF plugin is used)
103   -; if ~isa(st) then begin
104   -; st=dustem_run(p_dim)
105   -; !dustem_current=ptr_new(st)
106   -; endif
107   -;THE ABOVE CONDITION IS UNNECESSARY SINCE DUSTEM IS CALLED ABOVE WHETHER PLUGINS ARE RUN OR NOT.
108   -
109   -;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE'],use_previous_fortran=use_previous_fortran
110   -dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_SED'],use_previous_fortran=use_previous_fortran
  100 +;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_SED'],use_previous_fortran=use_previous_fortran
  101 +dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 4,use_previous_fortran=use_previous_fortran
111 102  
112 103  
113 104 the_end:
... ...
src/idl/dustem_compute_stokes.pro
... ... @@ -75,18 +75,25 @@ P = st.polsed.em_tot * fact ;This is Polarized intensity P
75 75  
76 76 Nwaves=(size(stI))[1]
77 77  
78   -frac=P/stI
  78 +;stop
  79 +
  80 +;This some times leads to division by 0
  81 +frac=P/stI
79 82 tes=where(finite(frac) eq 0)
80 83 frac(tes)=0.
81 84  
82   -scopes=tag_names((*!dustem_plugin))
  85 +scopes=(*!dustem_plugin).scope
  86 +n_plugins=n_elements(scopes)
  87 +
83 88 IF scopes[0] NE 'NONE' THEN BEGIN
84   - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
85   - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN
86   - Q_spec = (*(*!dustem_plugin).(i).spec)[*,1]
87   - U_spec = (*(*!dustem_plugin).(i).spec)[*,2]
88   - ENDIF
89   - ENDFOR
  89 + FOR i=0L,n_plugins-1 DO BEGIN
  90 + ;IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN
  91 + ;IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN
  92 + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_SED') THEN BEGIN
  93 + Q_spec = (*(*!dustem_plugin)[i].spec)[*,1]
  94 + U_spec = (*(*!dustem_plugin)[i].spec)[*,2]
  95 + ENDIF
  96 + ENDFOR
90 97 ENDIF
91 98  
92 99 IF ~isa(Q_spec) && ~isa(U_spec) THEN BEGIN
... ... @@ -94,18 +101,14 @@ ENDIF
94 101 ENDIF
95 102  
96 103 IF scopes[0] NE 'NONE' THEN BEGIN
97   - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
98   -
99   - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN
100   -
101   - Q_spec+=(*(*!dustem_plugin).(i).spec)[*,1]
102   - U_spec+=(*(*!dustem_plugin).(i).spec)[*,2]
103   -
104   -
  104 + FOR i=0L,n_plugins-1 DO BEGIN
  105 + ;IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN
  106 + ;IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_POLSED') THEN BEGIN
  107 + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_SED') THEN BEGIN
  108 + Q_spec+=(*(*!dustem_plugin)[i].spec)[*,1]
  109 + U_spec+=(*(*!dustem_plugin)[i].spec)[*,2]
105 110 ENDIF
106   -
107 111 ENDFOR
108   -
109 112 ENDIF
110 113 ;-----------------------------------------
111 114 ind=where(finite(U_spec) NE 1 OR finite(Q_spec) NE 1,count)
... ...
src/idl/dustem_fit_intensity_mbb_example.pro
... ... @@ -162,7 +162,7 @@ if keyword_set(wait) then begin
162 162 end
163 163  
164 164 ;== INITIALISE DUSTEM
165   -dustem_init,model=use_model,polarization=use_polarization
  165 +dustem_init,model=use_model,polarization=use_polarization,/show_plots
166 166 !dustem_nocatch=1
167 167 !dustem_verbose=use_verbose
168 168 IF keyword_set(noobj) THEN !dustem_noobj=1
... ...
src/idl/dustem_init_plugins.pro
... ... @@ -88,7 +88,13 @@ plugin_names=plugin_names[un]
88 88 parameter_types=parameter_types[un]
89 89  
90 90 ind=where(parameter_types EQ 'PLUGIN',Nplugins)
91   -one_plugin_st={name:'',spec:ptr_new(),scope:'',paramtag:ptr_new()}
  91 +;===== This is the dustem structure describing the plugin scopes
  92 +one_plugin_st={name:'', $ ;name of the plugin
  93 + spec:ptr_new(), $ ;output of the plugin (a spectrum)
  94 + scope:'', $ ;scope of the plugin
  95 + run_order:0L, $ ;plugin run order
  96 + paramtag:ptr_new() $ ;parameter names
  97 + }
92 98  
93 99 IF Nplugins EQ 0 THEN BEGIN
94 100 plugin_st=replicate(one_plugin_st,1)
... ... @@ -114,6 +120,18 @@ FOR i=0L,Nplugins-1 DO BEGIN
114 120 toto=execute(str)
115 121 plugin_st[i].paramtag=ptr_new(paramtag)
116 122 ENDFOR
  123 +;derive the run order from the scopes
  124 +file_scopes=!dustem_wrap_soft_dir+'plugin_scopes_definition.xcat'
  125 +scope_st=read_xcat(file_scopes,/silent)
  126 +possible_scopes=scope_st.objective+'_'+scope_st.target
  127 +FOR i=0L,Nplugins-1 DO BEGIN
  128 + ind=where(possible_scopes EQ plugin_st[i].scope,count)
  129 + IF count EQ 0 THEN BEGIN
  130 + message,'scope '+plugin_st[i].scope+' not recognized',/continue
  131 + stop
  132 + ENDIF
  133 + plugin_st[i].run_order=scope_st[ind[0]].run_order
  134 +ENDFOR
117 135  
118 136 ;creates the !dustem_plugin structure
119 137 defsysv, '!dustem_plugin', ptr_new(plugin_st)
... ...
src/idl/dustem_plugin_freefree.pro
... ... @@ -23,8 +23,11 @@ FUNCTION dustem_plugin_freefree,key=key $
23 23 ;
24 24 ; OPTIONAL INPUT PARAMETERS:
25 25 ; key = input parameter number
  26 +; 1 : Tgas [K]
  27 +; 2 : free-free Amplitude []
  28 +; 3 : polarization fraction [%] (default=0)
  29 +; 4 : polarization angle [deg]
26 30 ; val = input parameter value
27   -;
28 31 ; OUTPUTS:
29 32 ; freefree = free-free spectrum (on dustem wavelengths)
30 33 ;
... ... @@ -77,29 +80,21 @@ IF keyword_set(key) THEN BEGIN
77 80 b=where(key EQ 2,count2)
78 81 c=where(key EQ 3,count3) ;default polarization fraction -newly added
79 82 d=where(key EQ 4,count4) ;default polarization angle -newly added
80   - IF count1 NE 0 then Tgas=(val(a))(0)
81   - IF count2 NE 0 then Amplitude=(val(b))(0)
82   - IF count3 NE 0 then smallp=val[c[0]] ;-newly added
83   - IF count4 NE 0 then psi=val[d[0]] ;-newly added
  83 + IF count1 NE 0 then Tgas=val[a[0]]
  84 + IF count2 NE 0 then Amplitude=val[b[0]]
  85 + IF count3 NE 0 then smallp=val[c[0]]
  86 + IF count4 NE 0 then psi=val[d[0]]
84 87 ENDIF
85 88  
86   -;IF !dustem_which EQ 'DESERT' THEN BEGIN
87   -; lambir=((*!dustem_params).gemissiv.lambir)
88   -;ENDIF ELSE BEGIN
89   -; lambir=((*!dustem_params).lambda.lambda)
90   -;ENDELSE
91   -;replaced by the following to ease the life of plugins writters
92 89 lambir=dustem_get_wavelengths()
93 90 Nwavs=n_elements(lambir)
94 91 cmic=3.e14
95 92 nu=cmic/lambir ;Hz
96 93 mjy=1 ;output is in MJy/sr
97   -lambir_ref=10000.
98   -
  94 +lambir_ref=10000. ;in mic (this is 1cm)
99 95  
100   -output=fltarr(Nwavs,3) ;newly added
  96 +output=fltarr(Nwavs,3)
101 97  
102   -;stop
103 98 ;use_method='Deschenes2008'
104 99 ;use_method='WallsGabaud1998'
105 100 use_method='Dickinson2003_norm'
... ... @@ -140,10 +135,7 @@ ENDCASE
140 135 polar_ippsi2iqu,output[*,0],Q,U,replicate(smallp,Nwavs),replicate(psi,Nwavs)
141 136  
142 137 output[*,1]=Q
143   -output[*,2]=U
144   -;output[*,3]=replicate(smallp,Nwavs)
145   -;output[*,4]=replicate(psi,Nwavs)
146   -
  138 +output[*,2]=U
147 139  
148 140 the_end:
149 141 RETURN,output
... ...
src/idl/dustem_plugin_mbbdy.pro
... ... @@ -52,7 +52,8 @@ w0=100. ; Theoretical wavelength (3THz) where optical depth equals unity
52 52 smallp=0.
53 53 psi=0.
54 54  
55   -scope='ADD_SED+ADD_POLSED'
  55 +;scope='ADD_SED+ADD_POLSED'
  56 +scope='ADD_SED'
56 57 paramtag=['Amp',textoidl('T_{MBB}')+' [K]',textoidl('\beta'),'p','Psi [deg]']
57 58  
58 59 IF keyword_set(key) THEN BEGIN
... ...
src/idl/dustem_plugin_modify_dust_pol.pro
... ... @@ -5,31 +5,33 @@ FUNCTION dustem_plugin_modify_dust_pol, key=key, val=val, scope=scope, paramtag=
5 5 ; dustem_plugin_modify_dust_pol
6 6 ;
7 7 ; PURPOSE:
8   -; modifies Emission Stokes Q,U values for dust polarization in st according to the given keywords and values
9   -;
  8 +; Replaces the emission in polarization (Stokes Q,U) with a fixed polarization angle and fraction
  9 +; Q,U to be replaced are computed from the total intensity as:
  10 +; Q=I*val[0]*p*cos(2*val[1])
  11 +; U=I*val[0]*p*sin(2*val[1])
  12 +; where I is the total intensity in the model and p is the polarization fraction in the model
10 13 ; CATEGORY:
11 14 ; DustEMWrap, Plugin, Mid-level, Distributed
12 15 ;
13 16 ; CALLING SEQUENCE:
14   -; a=dustem_plugin_modify_dust_pol(st,[key=][val=][,scope=][,paramtag=][,paramdefault=][,/help])
  17 +; a=dustem_plugin_modify_dust_pol([key=][val=][,scope=][,paramtag=][,paramdefault=][,/help])
15 18 ;
16 19 ; INPUTS:
17 20 ; st = dustem structure
18 21 ;
19 22 ; OPTIONAL INPUT PARAMETERS:
20   -; key = input parameter numbers (first = polarization fraction in %, default=1.%, second=polarization angle, default=0.)
  23 +; key = input parameter numbers
  24 +; first = multiplication factor for the polarization fraction
  25 +; second = polarization angle [deg], default=0.
21 26 ; val = input parameter values
22   -;
23 27 ; OUTPUTS:
24   -; out = array containing the stokes emission parameters associated to the dust/synchrotron component or a concatenated version for both
  28 +; out = array containing the stokes emission parameters associated to the dust/synchrotron component or a concatenated version for both
25 29 ;
26 30 ; OPTIONAL OUTPUT PARAMETERS:
27 31 ; scope = if set, returns only the scope of the pluggin
28 32 ; paramtag = if set, returns only the parameter tags
29   -;
30 33 ; ACCEPTED KEY-WORDS:
31 34 ; help = if set, print this help
32   -;
33 35 ; COMMON BLOCKS:
34 36 ; None
35 37 ;
... ... @@ -53,20 +55,25 @@ IF keyword_set(help) THEN BEGIN
53 55 ENDIF
54 56  
55 57 IF keyword_set(scope) THEN BEGIN
  58 + ;scope='REPLACE_POLSED'
  59 + scope='REPLACE_SED'
56 60 out=0
57 61 GOTO, the_end
58 62 ENDIF
59 63  
60 64 IF keyword_set(paramtag) THEN BEGIN
  65 + paramtag=['p',textoidl('\psi')+' [deg]']
61 66 out=0.
62 67 GOTO, the_end
63 68 ENDIF
64 69  
65 70 ;Retrieving this sytem variable (dustem output)
66   -if ~isa(!dustem_current) then begin
67   - out=0
  71 +IF ~isa(!dustem_current) then begin
  72 + out=0
68 73 goto, the_end
69   -ENDIF else st=(*!dustem_current)
  74 +ENDIF ELSE BEGIN
  75 + st=(*!dustem_current)
  76 +ENDELSE
70 77  
71 78 ;below are the default values for the plugin parameters
72 79 smallp_fact=1. ;This is the default dust polarization factor
... ... @@ -76,12 +83,13 @@ IF keyword_set(key) THEN BEGIN
76 83 ind1=where(key EQ 1,count1)
77 84 ind2=where(key EQ 2,count2)
78 85 IF count1 NE 0 THEN smallp_fact=val[ind1[0]] ; setting smallp from pd - this is another polarization fraction (constant) that is applied to the total dust emission
79   - IF count2 NE 0 THEN psi=val[ind2[0]] & !dustem_psi = psi ; setting psi from pd. !dustem_psi here helps for the plotting.
  86 + IF count2 NE 0 THEN psi=val[ind2[0]]
  87 + !dustem_psi = psi ; setting psi from pd. !dustem_psi here helps for the plotting.
80 88 ENDIF
81 89  
82 90 fact = 1.e4*(*!dustem_HCD)/(4.*!pi)/(3.e8/1.e-6/((st.polsed).wav))*1.e20/1.e7
83   -P=((st.polsed).em_tot)*fact ; This is the polarized emission P
84   -I=((st.sed).em_tot)*fact ; This is the total intensity emission I
  91 +P=((st.polsed).em_tot)*fact ; This is the polarized emission P currently in the model
  92 +I=((st.sed).em_tot)*fact ; This is the total intensity emission I currently in the model
85 93  
86 94 Nwaves=(size(I))[1]
87 95  
... ... @@ -90,7 +98,7 @@ Nwaves=(size(I))[1]
90 98  
91 99 frac_model=P*0.
92 100 indI = where(I ne 0, countI)
93   -if countI ne 0 then frac_model[indI] = P[indI]/I[indI] ;This is the polarization fraction in the model
  101 +if countI ne 0 then frac_model[indI] = P[indI]/I[indI] ;This is the polarization fraction currently in the model
94 102  
95 103 frac_used=frac_model*smallp_fact
96 104  
... ... @@ -98,22 +106,15 @@ psi_used = replicate(psi,Nwaves)
98 106  
99 107 polar_ippsi2iqu,I,Q,U,frac_used,psi_used
100 108  
101   -out=fltarr(Nwaves,3) ; modified this. This is the only plugin that has this number of outputs.
102   -
103   -;degtorad = !pi/180
  109 +out=fltarr(Nwaves,3)
104 110  
105 111 out[*,0]=I
106 112 out[*,1]=Q
107 113 out[*,2]=U
108   -; out[*,3]=frac_used
109   -; ;out[*,4]=0.5*atan(U,Q)/degtorad
110   -; out[*,4]=psi_used
111 114  
112 115 RETURN, out
113 116  
114 117 the_end:
115   -scope='REPLACE_POLSED'
116   -paramtag=['p',textoidl('\psi')+' [deg]']
117 118  
118 119  
119 120 END
... ...
src/idl/dustem_plugin_synchrotron.pro
... ... @@ -64,7 +64,8 @@ s=3 ;power spectrum of CR E distribution
64 64 A=1 ;Synchrotron radiation amplitude at 10 mm
65 65 psi=0. ;default polarization angle
66 66 smallp=0.3;0.3 ;default polarization fraction
67   -scope='ADD_SED+ADD_POLSED'
  67 +;scope='ADD_SED+ADD_POLSED'
  68 +scope='ADD_SED'
68 69 ;paramtag=['s (plaw_index)','Amp','p','Psi (deg)']
69 70 paramtag=[textoidl('\alpha_{CR}'),'Amp','p',textoidl('\psi')+' [deg]']
70 71 paramdefault=[s,A,smallp,psi]
... ...
src/idl/dustem_read_dustem_lv.pro
... ... @@ -79,6 +79,7 @@ ENDWHILE
79 79 ;readf,unit,str
80 80 CLOSE,unit
81 81 free_lun,unit
  82 +
82 83 str=strcompress(str)
83 84 str=strtrim(str,2)
84 85 vv=str_sep(str,' ')
... ... @@ -100,12 +101,11 @@ Nlines=n_elements(wav)
100 101  
101 102 instruc='one_st={wav:0.,'
102 103 FOR i=0L,Ngrains-1 DO BEGIN
103   - instruc=instruc+'em_grain_'+strtrim(i+1,2)+':0.,'
  104 + instruc=instruc+'em_grain_'+strtrim(i+1,2)+':0.D0,'
104 105 ENDFOR
105   -instruc=instruc+'em_tot:0.}'
  106 +instruc=instruc+'em_tot:0.D0}'
106 107 message,'Executing '+instruc,/info
107 108 toto=execute(instruc)
108   -
109 109 st=replicate(one_st,Nlines)
110 110  
111 111 st.wav=wav
... ... @@ -113,6 +113,7 @@ FOR i=0L,Ngrains-1 DO BEGIN
113 113 instruc='st.(i+1)='+'em_grain_'+strtrim(i+1,2)
114 114 message,'Executing '+instruc,/info
115 115 toto=execute(instruc)
  116 + ;stop
116 117 ENDFOR
117 118 st.em_tot=em_tot
118 119  
... ...
src/idl/dustem_run_plugins.pro
1   -PRO dustem_run_plugins, p_dim ,$
2   - param_descs,$
3   - param_values,$
4   - param_func,$
5   - scopes,$
6   - st=st,$
7   - avoid=avoid,$
8   - force_dustem_run=force_dustem_run,$
9   - use_previous_fortran=use_previous_fortran, $
10   - help=help
  1 +PRO dustem_run_plugins, p_dim $
  2 + ,param_descs $
  3 + ,param_values $
  4 + ,param_func $
  5 + ,run_order $
  6 + ,st=st $
  7 + ,avoid=avoid $
  8 + ,force_dustem_run=force_dustem_run $
  9 + ,use_previous_fortran=use_previous_fortran $
  10 + ,help=help
11 11  
12 12 ;+
13 13 ; NAME:
... ... @@ -28,7 +28,7 @@ PRO dustem_run_plugins, p_dim ,$
28 28 ; param_descs = parameter description vector
29 29 ; param_values = current parameter values
30 30 ; param-func = plugin indices array
31   -; scopes = scopes of plugins
  31 +; run_order = run order of the plugins to be run
32 32 ;
33 33 ; OPTIONAL INPUT PARAMETERS:
34 34 ; avoid = scopes should be avoided
... ... @@ -85,12 +85,14 @@ Nplugins=n_elements(*!dustem_plugin)
85 85 must_be_run=intarr(Nplugins)
86 86  
87 87 FOR i=0L,Nplugins-1 DO BEGIN
88   - FOR j=0L,n_elements(scopes)-1 DO BEGIN
89   - pos=strposmulti((*!dustem_plugin)[i].scope,scopes[j],count)
90   - IF count NE 0 THEN must_be_run[i]=1
91   - ENDFOR
  88 + IF (*!dustem_plugin)[i].run_order EQ run_order THEN BEGIN
  89 + must_be_run[i]=1
  90 + ENDIF
92 91 ENDFOR
93 92  
  93 +;print,must_be_run
  94 +;stop
  95 +
94 96 ;=== run plugins that need be run
95 97 FOR i=0L,Nplugins-1 DO BEGIN
96 98 IF must_be_run[i] THEN BEGIN
... ...