Commit 30e1fede48fe650cade6675b70e5602fdba99204

Authored by Jean-Philippe Bernard
2 parents 21d1a616 6cde48ea
Exists in master

Merge branch 'master' of https://gitlab.irap.omp.eu/OV-GSO-DC/dustem-wrapper_idl

Showing 1 changed file with 92 additions and 0 deletions   Show diff stats
src/idl/dustem_plugin_modify_dust_pol.pro 0 → 100644
... ... @@ -0,0 +1,92 @@
  1 +Function dustem_plugin_modify_dust_pol, key=key, val=val, scope=scope,paramtag=paramtag,help=help
  2 +
  3 +;+
  4 +; NAME:
  5 +; dustem_plugin_modify_dust_pol
  6 +; PURPOSE:
  7 +; Produces stokes emission parameters for the dust and synchrotron components
  8 +; CATEGORY:
  9 +; DUSTEM Wrapper
  10 +; CALLING SEQUENCE:
  11 +; dustem_create_stokes(st,key=key,val=val)
  12 +; INPUTS:
  13 +;
  14 +; OPTIONAL INPUT PARAMETERS:
  15 +; key = input parameter number
  16 +; val = input parameter value
  17 +; OUTPUTS:
  18 +; out = array containing the stokes emission parameters associated to the dust/synchrotron component or a concatenated version for both
  19 +; OPTIONAL OUTPUT PARAMETERS:
  20 +; None
  21 +; ACCEPTED KEY-WORDS:
  22 +; help = if set, print this help
  23 +; COMMON BLOCKS:
  24 +; None
  25 +; SIDE EFFECTS:
  26 +; None
  27 +; RESTRICTIONS:
  28 +; The dustem fortran code must be installed
  29 +; The dustem idl wrapper must be installed
  30 +; PROCEDURE:
  31 +; This is a dustem plugin
  32 +;-
  33 +
  34 +IF keyword_set(help) THEN BEGIN
  35 + doc_library,'dustem_create_stokes'
  36 + out=0.
  37 + goto,the_end
  38 +ENDIF
  39 +
  40 +
  41 +paramtag=['p','Psi (deg)']
  42 +
  43 +IF ptr_valid((*!dustem_fit).CURRENT_PARAM_VALUES) THEN BEGIN
  44 + p_di=(*(*!dustem_fit).CURRENT_PARAM_VALUES)
  45 +
  46 +ENDIF ELSE BEGIN
  47 + p_di=(*(*!dustem_fit).PARAM_INIT_VALUES)
  48 + ENDELSE
  49 +
  50 +st=dustem_run(p_di)
  51 +;stop
  52 +
  53 +psi=0.
  54 +smallp=1.
  55 +IF keyword_set(key) THEN BEGIN
  56 + ind1=where(key EQ 1,count1)
  57 + ind2=where(key EQ 2,count2)
  58 + IF count1 NE 0 THEN smallp=val[ind1[0]] ; setting smallp from pd
  59 + IF count2 NE 0 THEN psi=val[ind2[0]] ; setting psi from pd
  60 +ENDIF
  61 +
  62 +
  63 +fact = 1.e4*(*!dustem_HCD)/(4.*!pi)/(3.e8/1.e-6/((st.polsed).wav))*1.e20/1.e7
  64 +P=((st.polsed).em_tot)*fact
  65 +I=((st.sed).em_tot)*fact
  66 +
  67 +
  68 +
  69 +Nwaves=(size(I))[1]
  70 +
  71 +frac=P/I*smallp
  72 +tes=where(finite(frac) eq 0)
  73 +frac(tes)=0.
  74 +
  75 +
  76 +polar_ippsi2iqu,I,Q,U,frac,replicate(psi,Nwaves)
  77 +
  78 +out=fltarr(Nwaves,3)
  79 +
  80 +out[*,0]=I
  81 +out[*,1]=Q
  82 +out[*,2]=U
  83 +
  84 +scope='REPLACE_QSED+REPLACE_USED'
  85 +
  86 +return, out
  87 +
  88 +the_end:
  89 +
  90 +
  91 +end
  92 +
... ...