Function dustem_create_stokes, st, key=key, val=val, scope,help=help ;+ ; NAME: ; dustem_create_stokes ; PURPOSE: ; Produces stokes emission parameters for the dust and synchrotron components ; CATEGORY: ; DUSTEM Wrapper ; CALLING SEQUENCE: ; dustem_create_stokes(st,key=key,val=val) ; INPUTS: ; st (st = dustem_run(p_dim)) ; OPTIONAL INPUT PARAMETERS: ; key = input parameter number ; val = input parameter value ; OUTPUTS: ; out = array containing the stokes emission parameters associated to the dust/synchrotron component or a concatenated version for both ; OPTIONAL OUTPUT PARAMETERS: ; None ; ACCEPTED KEY-WORDS: ; help = if set, print this help ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; None ; RESTRICTIONS: ; The dustem fortran code must be installed ; The dustem idl wrapper must be installed ; PROCEDURE: ; This is a dustem plugin ;- IF keyword_set(help) THEN BEGIN doc_library,'dustem_create_stokes' goto,the_end ENDIF psi_ref_dust=0 psi_ref_synch=0 out=[''] IF keyword_set(key) THEN BEGIN a=where(key EQ 1,count1) b=where(key EQ 2,count2) c=where(key EQ 3,count3) IF count3 NE 0 then begin frac_synch=(val(c))(0) endif else frac_synch=0.7 ;default value for synchrotron polarization fraction IF count1 NE 0 then begin psi_ref_dust=(val(a))(0) ;test to not devide by zero frac=st.polsed.em_tot/st.sed.em_tot tes=where(finite(frac) eq 0) frac(tes)=0. polar_ippsi2iqu,((st.sed).em_tot),Q_dust,U_dust,frac,psi_ref_dust out=[out,Q_dust,U_dust] endif IF count2 NE 0 then begin psi_ref_synch=(val(b))(0) frac=(*(*!dustem_plugin).synchrotron)/(*(*!dustem_plugin).synchrotron) tes=where(finite(frac) eq 0) frac(tes)=0. frac*=frac_synch polar_ippsi2iqu,(*(*!dustem_plugin).synchrotron),Q_synch,U_synch,frac,psi_ref_synch out=[out,Q_synch,U_synch] endif ENDIF scope=((*!dustem_scope).stokes) return, out[1:*] the_end: end