diff --git a/src/idl/dustem_compute_polext.pro b/src/idl/dustem_compute_polext.pro index 9056188..8066d01 100644 --- a/src/idl/dustem_compute_polext.pro +++ b/src/idl/dustem_compute_polext.pro @@ -90,27 +90,29 @@ frac=POLEXT_spec/EXT_spec tes=where(finite(frac) eq 0) frac(tes)=0. - -scopes=tag_names((*!dustem_plugin)) -IF scopes[0] NE 'NONE' THEN BEGIN +plugin_tags=(*!dustem_plugin).name +ind=where(plugin_tags NE 'NONE',Nplugins) +IF Nplugins NE 0 THEN BEGIN ;IF ptr_valid(!dustem_plugin) THEN BEGIN - for i=0L,n_tags(*!dustem_plugin)-1 do begin - if total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) eq 'ADD_EXT') then EXT_spec+=(*(*!dustem_plugin).(i).spec)[*,0] + for i=0L,Nplugins-1 do begin + if total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) eq 'ADD_EXT') then EXT_spec+=(*(*!dustem_plugin)[i].spec)[*,0] endfor ENDIF - -IF scopes[0] NE 'NONE' THEN BEGIN - - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN - - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN - - QEXT_spec=(*(*!dustem_plugin).(i).spec)[*,1] - UEXT_spec=(*(*!dustem_plugin).(i).spec)[*,2] - +;scopes=tag_names((*!dustem_plugin)) +;IF scopes[0] NE 'NONE' THEN BEGIN +;IF ptr_valid(!dustem_plugin) THEN BEGIN +; for i=0L,n_tags(*!dustem_plugin)-1 do begin +; if total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) eq 'ADD_EXT') then EXT_spec+=(*(*!dustem_plugin).(i).spec)[*,0] +; endfor +;ENDIF + +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN + QEXT_spec=(*(*!dustem_plugin)[i].spec)[*,1] + UEXT_spec=(*(*!dustem_plugin)[i].spec)[*,2] ENDIF - ENDFOR ENDIF @@ -119,19 +121,13 @@ ENDIF SPEXT_spec = frac ENDIF -IF scopes[0] NE 'NONE' THEN BEGIN - - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN - - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN - - QEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,1] - UEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,2] - +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN + QEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,1] + UEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,2] ENDIF - ENDFOR - ENDIF POLEXT_spec=sqrt(QEXT_spec^2+UEXT_spec^2) diff --git a/src/idl/dustem_compute_polsed.pro b/src/idl/dustem_compute_polsed.pro index a5ec0b9..31170f5 100755 --- a/src/idl/dustem_compute_polsed.pro +++ b/src/idl/dustem_compute_polsed.pro @@ -93,29 +93,29 @@ frac(tes)=0. ;NB: if plugins that replace the total emission given by the fortran executable exist, ;the need to add a block with a 'REPLPACE_SED' scope as for the 'REPLACE_POLSED' below, may arise. -scopes=tag_names((*!dustem_plugin)) -IF scopes[0] NE 'NONE' THEN BEGIN +;scopes=tag_names((*!dustem_plugin)) +;IF scopes[0] NE 'NONE' THEN BEGIN ;IF ptr_valid(!dustem_plugin) THEN BEGIN - for i=0L,n_tags(*!dustem_plugin)-1 do begin - if total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) eq 'ADD_SED') then stI+=(*(*!dustem_plugin).(i).spec)[*,0] +; for i=0L,n_tags(*!dustem_plugin)-1 do begin + +plugin_tags=(*!dustem_plugin).name +ind=where(plugin_tags NE 'NONE',Nplugins) +IF Nplugins NE 0 THEN BEGIN +;IF ptr_valid(!dustem_plugin) THEN BEGIN + for i=0L,Nplugins-1 do begin + if total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) eq 'ADD_SED') then stI+=(*(*!dustem_plugin)[i].spec)[*,0] endfor ENDIF -IF scopes[0] NE 'NONE' THEN BEGIN - - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN - - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN - +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN Q_spec=(*(*!dustem_plugin).(i).spec)[*,1] U_spec=(*(*!dustem_plugin).(i).spec)[*,2] ;make sure sti hasn't been replaced. But this is not happening in the near future - ENDIF - ENDFOR - ENDIF IF ~isa(Q_spec) && ~isa(U_spec) THEN BEGIN @@ -123,27 +123,19 @@ ENDIF SP_spec = frac ENDIF -IF scopes[0] NE 'NONE' THEN BEGIN - - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN - - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN - - Q_spec+=(*(*!dustem_plugin).(i).spec)[*,1] - U_spec+=(*(*!dustem_plugin).(i).spec)[*,2] - +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN + Q_spec+=(*(*!dustem_plugin)[i].spec)[*,1] + U_spec+=(*(*!dustem_plugin)[i].spec)[*,2] ENDIF - ENDFOR - ENDIF P_spec=sqrt(Q_spec^2+U_spec^2) SP_spec=P_spec/Sti - dustem_polsed = (*(*!dustem_data).qsed).values * 0. - if not isarray(P_spec) THEN stop ;I don't understand this test. The only thing it can indicate is a problem with the dust parameters or the fortran executable. But in my opinion these tests would be diff --git a/src/idl/dustem_compute_sed.pro b/src/idl/dustem_compute_sed.pro index a858fea..7a2d9d3 100755 --- a/src/idl/dustem_compute_sed.pro +++ b/src/idl/dustem_compute_sed.pro @@ -69,11 +69,14 @@ fact = 1.e4*(*!dustem_HCD)/(4.*!pi)/(3.e8/1.e-6/st.sed.wav)*1.e20/1.e7 ;this is SED_spec = st.sed.em_tot * fact ;===== Adding plugin output to spectrum ---------------- -Nplugins=n_elements(*!dustem_plugin) -scopes=(*!dustem_plugin).scope +;Nplugins=n_elements(*!dustem_plugin) +;scopes=(*!dustem_plugin).scope +plugin_tags=(*!dustem_plugin).name +ind=where(plugin_tags NE 'NONE',Nplugins) +IF Nplugins NE 0 THEN BEGIN ;stop -IF scopes[0] NE 'NONE' THEN BEGIN +;IF scopes[0] NE 'NONE' THEN BEGIN FOR i=0L,Nplugins-1 DO BEGIN IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) eq 'ADD_SED') THEN BEGIN SED_spec+=(*(*!dustem_plugin)[i].spec)[*,0] diff --git a/src/idl/dustem_compute_stokes.pro b/src/idl/dustem_compute_stokes.pro index 46c3aae..92314f5 100755 --- a/src/idl/dustem_compute_stokes.pro +++ b/src/idl/dustem_compute_stokes.pro @@ -82,14 +82,13 @@ frac=P/stI tes=where(finite(frac) eq 0) frac(tes)=0. -scopes=(*!dustem_plugin).scope -n_plugins=n_elements(scopes) - -IF scopes[0] NE 'NONE' THEN BEGIN - FOR i=0L,n_plugins-1 DO BEGIN +plugin_tags=(*!dustem_plugin).name +ind=where(plugin_tags NE 'NONE',Nplugins) +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,nplugins-1 DO BEGIN ;IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN ;IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN - IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_SED') THEN BEGIN + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN Q_spec = (*(*!dustem_plugin)[i].spec)[*,1] U_spec = (*(*!dustem_plugin)[i].spec)[*,2] ENDIF @@ -100,11 +99,13 @@ ENDIF polar_ippsi2iqu,stI,Q_spec,U_spec,frac,replicate(!dustem_psi,Nwaves); ENDIF -IF scopes[0] NE 'NONE' THEN BEGIN - FOR i=0L,n_plugins-1 DO BEGIN +plugin_tags=(*!dustem_plugin).name +ind=where(plugin_tags NE 'NONE',Nplugins) +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN ;IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN ;IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_POLSED') THEN BEGIN - IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_SED') THEN BEGIN + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_POLSED') THEN BEGIN Q_spec+=(*(*!dustem_plugin)[i].spec)[*,1] U_spec+=(*(*!dustem_plugin)[i].spec)[*,2] ENDIF diff --git a/src/idl/dustem_compute_stokext.pro b/src/idl/dustem_compute_stokext.pro index fd306bf..c63cb76 100755 --- a/src/idl/dustem_compute_stokext.pro +++ b/src/idl/dustem_compute_stokext.pro @@ -105,18 +105,14 @@ frac=POLEXT_spec/EXT_spec tes=where(finite(frac) eq 0) frac(tes)=0. -scopes=tag_names((*!dustem_plugin)) -IF scopes[0] NE 'NONE' THEN BEGIN - - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN - - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN - - QEXT_spec = (*(*!dustem_plugin).(i).spec)[*,1] - UEXT_spec = (*(*!dustem_plugin).(i).spec)[*,2] - +plugin_tags=(*!dustem_plugin).name +ind=where(plugin_tags NE 'NONE',Nplugins) +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN + QEXT_spec = (*(*!dustem_plugin)[i].spec)[*,1] + UEXT_spec = (*(*!dustem_plugin)[i].spec)[*,2] ENDIF - ENDFOR ENDIF @@ -125,16 +121,12 @@ IF ~isa(QEXT_spec) && ~isa(UEXT_spec) THEN BEGIN ENDIF -IF scopes[0] NE 'NONE' THEN BEGIN - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN - - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN - - QEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,1] - UEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,2] - +IF Nplugins NE 0 THEN BEGIN + FOR i=0L,Nplugins-1 DO BEGIN + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN + QEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,1] + UEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,2] ENDIF - ENDFOR ENDIF ;----------------------------------------- -- libgit2 0.21.2