Commit b3f6f0166d5f0018193a595c674d6bc367c3dd91
1 parent
daa89ea5
Exists in
master
implemented changes due to plugin structure
Showing
5 changed files
with
69 additions
and
85 deletions
Show diff stats
src/idl/dustem_compute_polext.pro
@@ -90,27 +90,29 @@ frac=POLEXT_spec/EXT_spec | @@ -90,27 +90,29 @@ frac=POLEXT_spec/EXT_spec | ||
90 | tes=where(finite(frac) eq 0) | 90 | tes=where(finite(frac) eq 0) |
91 | frac(tes)=0. | 91 | frac(tes)=0. |
92 | 92 | ||
93 | - | ||
94 | -scopes=tag_names((*!dustem_plugin)) | ||
95 | -IF scopes[0] NE 'NONE' THEN BEGIN | 93 | +plugin_tags=(*!dustem_plugin).name |
94 | +ind=where(plugin_tags NE 'NONE',Nplugins) | ||
95 | +IF Nplugins NE 0 THEN BEGIN | ||
96 | ;IF ptr_valid(!dustem_plugin) THEN BEGIN | 96 | ;IF ptr_valid(!dustem_plugin) THEN BEGIN |
97 | - for i=0L,n_tags(*!dustem_plugin)-1 do begin | ||
98 | - if total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) eq 'ADD_EXT') then EXT_spec+=(*(*!dustem_plugin).(i).spec)[*,0] | 97 | + for i=0L,Nplugins-1 do begin |
98 | + if total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) eq 'ADD_EXT') then EXT_spec+=(*(*!dustem_plugin)[i].spec)[*,0] | ||
99 | endfor | 99 | endfor |
100 | ENDIF | 100 | ENDIF |
101 | 101 | ||
102 | - | ||
103 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
104 | - | ||
105 | - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN | ||
106 | - | ||
107 | - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN | ||
108 | - | ||
109 | - QEXT_spec=(*(*!dustem_plugin).(i).spec)[*,1] | ||
110 | - UEXT_spec=(*(*!dustem_plugin).(i).spec)[*,2] | ||
111 | - | 102 | +;scopes=tag_names((*!dustem_plugin)) |
103 | +;IF scopes[0] NE 'NONE' THEN BEGIN | ||
104 | +;IF ptr_valid(!dustem_plugin) THEN BEGIN | ||
105 | +; for i=0L,n_tags(*!dustem_plugin)-1 do begin | ||
106 | +; if total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) eq 'ADD_EXT') then EXT_spec+=(*(*!dustem_plugin).(i).spec)[*,0] | ||
107 | +; endfor | ||
108 | +;ENDIF | ||
109 | + | ||
110 | +IF Nplugins NE 0 THEN BEGIN | ||
111 | + FOR i=0L,Nplugins-1 DO BEGIN | ||
112 | + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN | ||
113 | + QEXT_spec=(*(*!dustem_plugin)[i].spec)[*,1] | ||
114 | + UEXT_spec=(*(*!dustem_plugin)[i].spec)[*,2] | ||
112 | ENDIF | 115 | ENDIF |
113 | - | ||
114 | ENDFOR | 116 | ENDFOR |
115 | ENDIF | 117 | ENDIF |
116 | 118 | ||
@@ -119,19 +121,13 @@ ENDIF | @@ -119,19 +121,13 @@ ENDIF | ||
119 | SPEXT_spec = frac | 121 | SPEXT_spec = frac |
120 | ENDIF | 122 | ENDIF |
121 | 123 | ||
122 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
123 | - | ||
124 | - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN | ||
125 | - | ||
126 | - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN | ||
127 | - | ||
128 | - QEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,1] | ||
129 | - UEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,2] | ||
130 | - | 124 | +IF Nplugins NE 0 THEN BEGIN |
125 | + FOR i=0L,Nplugins-1 DO BEGIN | ||
126 | + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN | ||
127 | + QEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,1] | ||
128 | + UEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,2] | ||
131 | ENDIF | 129 | ENDIF |
132 | - | ||
133 | ENDFOR | 130 | ENDFOR |
134 | - | ||
135 | ENDIF | 131 | ENDIF |
136 | 132 | ||
137 | POLEXT_spec=sqrt(QEXT_spec^2+UEXT_spec^2) | 133 | POLEXT_spec=sqrt(QEXT_spec^2+UEXT_spec^2) |
src/idl/dustem_compute_polsed.pro
@@ -93,29 +93,29 @@ frac(tes)=0. | @@ -93,29 +93,29 @@ frac(tes)=0. | ||
93 | ;NB: if plugins that replace the total emission given by the fortran executable exist, | 93 | ;NB: if plugins that replace the total emission given by the fortran executable exist, |
94 | ;the need to add a block with a 'REPLPACE_SED' scope as for the 'REPLACE_POLSED' below, may arise. | 94 | ;the need to add a block with a 'REPLPACE_SED' scope as for the 'REPLACE_POLSED' below, may arise. |
95 | 95 | ||
96 | -scopes=tag_names((*!dustem_plugin)) | ||
97 | -IF scopes[0] NE 'NONE' THEN BEGIN | 96 | +;scopes=tag_names((*!dustem_plugin)) |
97 | +;IF scopes[0] NE 'NONE' THEN BEGIN | ||
98 | ;IF ptr_valid(!dustem_plugin) THEN BEGIN | 98 | ;IF ptr_valid(!dustem_plugin) THEN BEGIN |
99 | - for i=0L,n_tags(*!dustem_plugin)-1 do begin | ||
100 | - if total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) eq 'ADD_SED') then stI+=(*(*!dustem_plugin).(i).spec)[*,0] | 99 | +; for i=0L,n_tags(*!dustem_plugin)-1 do begin |
100 | + | ||
101 | +plugin_tags=(*!dustem_plugin).name | ||
102 | +ind=where(plugin_tags NE 'NONE',Nplugins) | ||
103 | +IF Nplugins NE 0 THEN BEGIN | ||
104 | +;IF ptr_valid(!dustem_plugin) THEN BEGIN | ||
105 | + for i=0L,Nplugins-1 do begin | ||
106 | + if total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) eq 'ADD_SED') then stI+=(*(*!dustem_plugin)[i].spec)[*,0] | ||
101 | endfor | 107 | endfor |
102 | ENDIF | 108 | ENDIF |
103 | 109 | ||
104 | 110 | ||
105 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
106 | - | ||
107 | - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN | ||
108 | - | ||
109 | - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN | ||
110 | - | 111 | +IF Nplugins NE 0 THEN BEGIN |
112 | + FOR i=0L,Nplugins-1 DO BEGIN | ||
113 | + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN | ||
111 | Q_spec=(*(*!dustem_plugin).(i).spec)[*,1] | 114 | Q_spec=(*(*!dustem_plugin).(i).spec)[*,1] |
112 | U_spec=(*(*!dustem_plugin).(i).spec)[*,2] | 115 | U_spec=(*(*!dustem_plugin).(i).spec)[*,2] |
113 | ;make sure sti hasn't been replaced. But this is not happening in the near future | 116 | ;make sure sti hasn't been replaced. But this is not happening in the near future |
114 | - | ||
115 | ENDIF | 117 | ENDIF |
116 | - | ||
117 | ENDFOR | 118 | ENDFOR |
118 | - | ||
119 | ENDIF | 119 | ENDIF |
120 | 120 | ||
121 | IF ~isa(Q_spec) && ~isa(U_spec) THEN BEGIN | 121 | IF ~isa(Q_spec) && ~isa(U_spec) THEN BEGIN |
@@ -123,27 +123,19 @@ ENDIF | @@ -123,27 +123,19 @@ ENDIF | ||
123 | SP_spec = frac | 123 | SP_spec = frac |
124 | ENDIF | 124 | ENDIF |
125 | 125 | ||
126 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
127 | - | ||
128 | - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN | ||
129 | - | ||
130 | - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN | ||
131 | - | ||
132 | - Q_spec+=(*(*!dustem_plugin).(i).spec)[*,1] | ||
133 | - U_spec+=(*(*!dustem_plugin).(i).spec)[*,2] | ||
134 | - | 126 | +IF Nplugins NE 0 THEN BEGIN |
127 | + FOR i=0L,Nplugins-1 DO BEGIN | ||
128 | + IF total(strsplit(((*!dustem_plugin)[i].scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN | ||
129 | + Q_spec+=(*(*!dustem_plugin)[i].spec)[*,1] | ||
130 | + U_spec+=(*(*!dustem_plugin)[i].spec)[*,2] | ||
135 | ENDIF | 131 | ENDIF |
136 | - | ||
137 | ENDFOR | 132 | ENDFOR |
138 | - | ||
139 | ENDIF | 133 | ENDIF |
140 | 134 | ||
141 | P_spec=sqrt(Q_spec^2+U_spec^2) | 135 | P_spec=sqrt(Q_spec^2+U_spec^2) |
142 | SP_spec=P_spec/Sti | 136 | SP_spec=P_spec/Sti |
143 | 137 | ||
144 | - | ||
145 | dustem_polsed = (*(*!dustem_data).qsed).values * 0. | 138 | dustem_polsed = (*(*!dustem_data).qsed).values * 0. |
146 | - | ||
147 | 139 | ||
148 | 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 | 140 | 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 |
149 | 141 |
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 | @@ -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 | ||
69 | SED_spec = st.sed.em_tot * fact | 69 | SED_spec = st.sed.em_tot * fact |
70 | 70 | ||
71 | ;===== Adding plugin output to spectrum ---------------- | 71 | ;===== Adding plugin output to spectrum ---------------- |
72 | -Nplugins=n_elements(*!dustem_plugin) | ||
73 | -scopes=(*!dustem_plugin).scope | 72 | +;Nplugins=n_elements(*!dustem_plugin) |
73 | +;scopes=(*!dustem_plugin).scope | ||
74 | 74 | ||
75 | +plugin_tags=(*!dustem_plugin).name | ||
76 | +ind=where(plugin_tags NE 'NONE',Nplugins) | ||
77 | +IF Nplugins NE 0 THEN BEGIN | ||
75 | ;stop | 78 | ;stop |
76 | -IF scopes[0] NE 'NONE' THEN BEGIN | 79 | +;IF scopes[0] NE 'NONE' THEN BEGIN |
77 | FOR i=0L,Nplugins-1 DO BEGIN | 80 | FOR i=0L,Nplugins-1 DO BEGIN |
78 | IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) eq 'ADD_SED') THEN BEGIN | 81 | IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) eq 'ADD_SED') THEN BEGIN |
79 | SED_spec+=(*(*!dustem_plugin)[i].spec)[*,0] | 82 | SED_spec+=(*(*!dustem_plugin)[i].spec)[*,0] |
src/idl/dustem_compute_stokes.pro
@@ -82,14 +82,13 @@ frac=P/stI | @@ -82,14 +82,13 @@ frac=P/stI | ||
82 | tes=where(finite(frac) eq 0) | 82 | tes=where(finite(frac) eq 0) |
83 | frac(tes)=0. | 83 | frac(tes)=0. |
84 | 84 | ||
85 | -scopes=(*!dustem_plugin).scope | ||
86 | -n_plugins=n_elements(scopes) | ||
87 | - | ||
88 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
89 | - FOR i=0L,n_plugins-1 DO BEGIN | 85 | +plugin_tags=(*!dustem_plugin).name |
86 | +ind=where(plugin_tags NE 'NONE',Nplugins) | ||
87 | +IF Nplugins NE 0 THEN BEGIN | ||
88 | + FOR i=0L,nplugins-1 DO BEGIN | ||
90 | ;IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN | 89 | ;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 | 90 | ;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 | 91 | + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN |
93 | Q_spec = (*(*!dustem_plugin)[i].spec)[*,1] | 92 | Q_spec = (*(*!dustem_plugin)[i].spec)[*,1] |
94 | U_spec = (*(*!dustem_plugin)[i].spec)[*,2] | 93 | U_spec = (*(*!dustem_plugin)[i].spec)[*,2] |
95 | ENDIF | 94 | ENDIF |
@@ -100,11 +99,13 @@ ENDIF | @@ -100,11 +99,13 @@ ENDIF | ||
100 | polar_ippsi2iqu,stI,Q_spec,U_spec,frac,replicate(!dustem_psi,Nwaves); | 99 | polar_ippsi2iqu,stI,Q_spec,U_spec,frac,replicate(!dustem_psi,Nwaves); |
101 | ENDIF | 100 | ENDIF |
102 | 101 | ||
103 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
104 | - FOR i=0L,n_plugins-1 DO BEGIN | 102 | +plugin_tags=(*!dustem_plugin).name |
103 | +ind=where(plugin_tags NE 'NONE',Nplugins) | ||
104 | +IF Nplugins NE 0 THEN BEGIN | ||
105 | + FOR i=0L,Nplugins-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 |
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_POLSED') THEN BEGIN |
107 | - IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_SED') THEN BEGIN | 108 | + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_POLSED') THEN BEGIN |
108 | Q_spec+=(*(*!dustem_plugin)[i].spec)[*,1] | 109 | Q_spec+=(*(*!dustem_plugin)[i].spec)[*,1] |
109 | U_spec+=(*(*!dustem_plugin)[i].spec)[*,2] | 110 | U_spec+=(*(*!dustem_plugin)[i].spec)[*,2] |
110 | ENDIF | 111 | ENDIF |
src/idl/dustem_compute_stokext.pro
@@ -105,18 +105,14 @@ frac=POLEXT_spec/EXT_spec | @@ -105,18 +105,14 @@ frac=POLEXT_spec/EXT_spec | ||
105 | tes=where(finite(frac) eq 0) | 105 | tes=where(finite(frac) eq 0) |
106 | frac(tes)=0. | 106 | frac(tes)=0. |
107 | 107 | ||
108 | -scopes=tag_names((*!dustem_plugin)) | ||
109 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
110 | - | ||
111 | - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN | ||
112 | - | ||
113 | - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN | ||
114 | - | ||
115 | - QEXT_spec = (*(*!dustem_plugin).(i).spec)[*,1] | ||
116 | - UEXT_spec = (*(*!dustem_plugin).(i).spec)[*,2] | ||
117 | - | 108 | +plugin_tags=(*!dustem_plugin).name |
109 | +ind=where(plugin_tags NE 'NONE',Nplugins) | ||
110 | +IF Nplugins NE 0 THEN BEGIN | ||
111 | + FOR i=0L,Nplugins-1 DO BEGIN | ||
112 | + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'REPLACE_POLEXT') THEN BEGIN | ||
113 | + QEXT_spec = (*(*!dustem_plugin)[i].spec)[*,1] | ||
114 | + UEXT_spec = (*(*!dustem_plugin)[i].spec)[*,2] | ||
118 | ENDIF | 115 | ENDIF |
119 | - | ||
120 | ENDFOR | 116 | ENDFOR |
121 | ENDIF | 117 | ENDIF |
122 | 118 | ||
@@ -125,16 +121,12 @@ IF ~isa(QEXT_spec) && ~isa(UEXT_spec) THEN BEGIN | @@ -125,16 +121,12 @@ IF ~isa(QEXT_spec) && ~isa(UEXT_spec) THEN BEGIN | ||
125 | ENDIF | 121 | ENDIF |
126 | 122 | ||
127 | 123 | ||
128 | -IF scopes[0] NE 'NONE' THEN BEGIN | ||
129 | - FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN | ||
130 | - | ||
131 | - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN | ||
132 | - | ||
133 | - QEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,1] | ||
134 | - UEXT_spec+=(*(*!dustem_plugin).(i).spec)[*,2] | ||
135 | - | 124 | +IF Nplugins NE 0 THEN BEGIN |
125 | + FOR i=0L,Nplugins-1 DO BEGIN | ||
126 | + IF total(strsplit((*!dustem_plugin)[i].scope,'+',/extract) EQ 'ADD_POLEXT') THEN BEGIN | ||
127 | + QEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,1] | ||
128 | + UEXT_spec+=(*(*!dustem_plugin)[i].spec)[*,2] | ||
136 | ENDIF | 129 | ENDIF |
137 | - | ||
138 | ENDFOR | 130 | ENDFOR |
139 | ENDIF | 131 | ENDIF |
140 | ;----------------------------------------- | 132 | ;----------------------------------------- |