dustem_compute_polext.pro 1.52 KB
FUNCTION dustem_compute_polext ,p_dim,sti,_extra=extra,out_st=out_st,dustem_qext,dustem_uext,Q_ext,U_ext 

;CREATED AS A CONSEQUENCE OF THE INCLUSION OF THE PLUGINS


;written to homogonize DustEM

IF not keyword_set(sti) THEN BEGIN
  sti=dustem_run(p_dim)
  dustem_activate_plugins,p_dim/(*(*!dustem_fit).param_init_values),res=res,sti
ENDIF


 ;ADDING PLUGIN TO SPECTRUM----------------
 ;if n_tags(!dustem_data.polext) gt 1 then begin
 for i=0L,n_tags(*!dustem_scope)-1 do begin
 if total(strsplit((*!dustem_scope).(i),'+',/extract) eq 'ADD_POLEXT') then sti.polext.ext_tot+=(*(*!dustem_plugin).(i))
 endfor
 ;endif
 ;------------------------------------------
 
 ;MODIFYING VIA PLUGIN-------------- THIS BLOCK NEEDS TO BE UNDER THE DUSTEM_POLSED LINE 

 for i=0L,n_tags(*!dustem_scope)-1 do begin

 if total(strsplit((*!dustem_scope).(i),'+',/extract) eq 'MODIFY') then begin

 ;making sure it's the stokes plugin that gets used here

 iidx=where(tag_names(*!dustem_scope) eq 'STEXT')


 IF iidx eq i THEN BEGIN ;not sure about this condition but you get the spirit

 Q_ext=(*(*!dustem_plugin).(i))(0:n_elements((*(*!dustem_plugin).(i)))/2-1)
 U_ext=(*(*!dustem_plugin).(i))(n_elements((*(*!dustem_plugin).(i)))/2:*)
 dustem_qext=interpol(Q_ext,sti.polext.wav,(*!dustem_data.polext).wav)
 dustem_uext=interpol(U_ext,sti.polext.wav,(*!dustem_data.polext).wav)
 
 endif 
 endif
 endfor
 ;endif
 ;-------------------------------------------

dustem_polext = interpol(sti.polext.ext_tot,sti.polext.wav,(*!dustem_data.polext).wav) 


return, dustem_polext


END