Commit 4c8f226026942ff605560b2728c8ec4343942a2a

Authored by Jean-Philippe Bernard
1 parent 56f461b1
Exists in master

improved

src/idl/dustem_compute_stokes.pro
... ... @@ -62,34 +62,41 @@ frac=P/stI
62 62 tes=where(finite(frac) eq 0)
63 63 frac(tes)=0.
64 64  
65   -FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
66   -
67   - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN
68   -
69   - Q_spec = (*(*!dustem_plugin).(i).spec)[*,1]
70   - U_spec = (*(*!dustem_plugin).(i).spec)[*,2]
71   - PSI_spec = (*(*!dustem_plugin).(i).spec)[*,4]
72   -
73   - ENDIF
74   -
75   -ENDFOR
76   -
77   -IF ~isa(Q_spec) && ~isa(U_spec) THEN BEGIN
78   - polar_ippsi2iqu,stI,Q_spec,U_spec,frac,replicate(!dustem_psi,Nwaves);PSI_spec
79   - PSI_spec = 0.5*atan(U_spec,Q_spec)/degtorad
80   -ENDIF
81   -
82   -FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
83   -
84   - IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN
85   -
86   - Q_spec+=(*(*!dustem_plugin).(i).spec)[*,1]
87   - U_spec+=(*(*!dustem_plugin).(i).spec)[*,2]
88   - PSI_spec+= (*(*!dustem_plugin).(i).spec)[*,4]
89   -
90   - ENDIF
91   -
92   -ENDFOR
  65 +scopes=tag_names((*!dustem_plugin))
  66 +IF scopes[0] NE 'NONE' THEN BEGIN
  67 + FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
  68 +
  69 + IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'REPLACE_POLSED') THEN BEGIN
  70 +
  71 + Q_spec = (*(*!dustem_plugin).(i).spec)[*,1]
  72 + U_spec = (*(*!dustem_plugin).(i).spec)[*,2]
  73 + PSI_spec = (*(*!dustem_plugin).(i).spec)[*,4]
  74 +
  75 + ENDIF
  76 +
  77 + ENDFOR
  78 +
  79 + IF ~isa(Q_spec) && ~isa(U_spec) THEN BEGIN
  80 + polar_ippsi2iqu,stI,Q_spec,U_spec,frac,replicate(!dustem_psi,Nwaves);PSI_spec
  81 + PSI_spec = 0.5*atan(U_spec,Q_spec)/degtorad
  82 + ENDIF
  83 +
  84 + FOR i=0L,n_tags(*!dustem_plugin)-1 DO BEGIN
  85 +
  86 + IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN BEGIN
  87 +
  88 + Q_spec+=(*(*!dustem_plugin).(i).spec)[*,1]
  89 + U_spec+=(*(*!dustem_plugin).(i).spec)[*,2]
  90 + PSI_spec+= (*(*!dustem_plugin).(i).spec)[*,4]
  91 +
  92 + ENDIF
  93 +
  94 + ENDFOR
  95 +ENDIF ELSE BEGIN
  96 + Q_spec=(*!dustem_data.qsed).values
  97 + U_spec=(*!dustem_data.qsed).values
  98 +ENDELSE
  99 +
93 100 ;-----------------------------------------
94 101  
95 102 ;INITIALIZING THE STOKES SEDS
... ... @@ -103,27 +110,27 @@ if not isarray(stI) THEN stop ; I don't get this test. It is unnecessary.
103 110 IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN
104 111 message,'DOING color correction calculations',/info
105 112 ENDIF ELSE BEGIN
106   - message,'SKIPPING color correction calculations',/info
107   - ENDELSE
  113 + message,'SKIPPING color correction calculations',/info
  114 +ENDELSE
108 115  
109 116 ind_qsed=where((*!dustem_data.qsed).filt_names NE 'SPECTRUM',count_qsed)
110 117 ind_used=where((*!dustem_data.used).filt_names NE 'SPECTRUM',count_used)
111 118  
112 119  
113 120 IF count_qsed NE 0 THEN BEGIN
114   - filter_names=((*!dustem_data.qsed).filt_names)(ind_qsed)
  121 + filter_names=((*!dustem_data.qsed).filt_names)[ind_qsed]
115 122 if isa(dustem_qsed) then begin
116 123 sqsed=dustem_cc(st.polsed.wav,Q_spec,filter_names,cc=cc)
117   - dustem_qsed(ind_qsed)=sqsed
  124 + dustem_qsed[ind_qsed]=sqsed
118 125 endif
119 126 ENDIF
120 127  
121 128 IF count_used NE 0 THEN BEGIN
122   -filter_names=((*!dustem_data.used).filt_names)(ind_used)
123   -if isa(dustem_used) then begin
124   - sused=dustem_cc(st.polsed.wav,U_spec,filter_names,cc=cc)
125   - dustem_used(ind_used)=sused
126   -endif
  129 + filter_names=((*!dustem_data.used).filt_names)[ind_used]
  130 + if isa(dustem_used) then begin
  131 + sused=dustem_cc(st.polsed.wav,U_spec,filter_names,cc=cc)
  132 + dustem_used[ind_used]=sused
  133 + endif
127 134 ENDIF
128 135  
129 136  
... ... @@ -135,11 +142,11 @@ ind_qspec=where((*!dustem_data.qsed).filt_names EQ 'SPECTRUM',count_qspec)
135 142 ind_uspec=where((*!dustem_data.used).filt_names EQ 'SPECTRUM',count_uspec)
136 143  
137 144 IF count_qspec NE 0 THEN BEGIN
138   - if isa(dustem_qsed) then dustem_qsed(ind_qspec)=interpol(Q_spec,st.polsed.wav,(((*!dustem_data.qsed).wav)(ind_qspec)))
  145 + if isa(dustem_qsed) then dustem_qsed[ind_qspec]=interpol(Q_spec,st.polsed.wav,(((*!dustem_data.qsed).wav)[ind_qspec]))
139 146 ENDIF
140 147  
141 148 IF count_uspec NE 0 THEN BEGIN
142   - if isa(dustem_used) then dustem_used(ind_uspec)=interpol(U_spec,st.polsed.wav,(((*!dustem_data.used).wav)(ind_uspec)))
  149 + if isa(dustem_used) then dustem_used[ind_uspec]=interpol(U_spec,st.polsed.wav,(((*!dustem_data.used).wav)[ind_uspec]))
143 150 ENDIF
144 151  
145 152 out_st=st
... ...
src/idl/dustem_set_data.pro
... ... @@ -83,7 +83,7 @@ defsysv,'!dustem_f_HI',f_HI
83 83 if !run_pol then begin
84 84  
85 85 if keyword_set(m_fit) then begin
86   -
  86 + ;stop
87 87 teststks = isa(qsed) and isa(used)
88 88  
89 89 IF ~teststks then message, 'Stokes parameters are not set correctly. Please check the input structure. Aborting...'
... ...