Blame view

src/idl/dustem_plugin_modify_spinning_polarization.pro 1.93 KB
ba82c5cf   Ilyes Choubani   improved with mod...
1
FUNCTION dustem_plugin_modify_spinning_polarization, key=key, val=val, scope=scope, help=help
7d2d66e7   Ilyes Choubani   replacing polsed,...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

;+
; NAME:
;    dustem_create_stext
; PURPOSE:
;    MODIFIES THE SPINNING DUST SED BY INTRODUCING A POLARIZATION FRACTION p AND A POLARIZATION ANGLE psi
; CATEGORY:
;    DUSTEM Wrapper
; CALLING SEQUENCE:
;    dustem_plugin_modify_spinning_sed(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 extinction stokes parameters
; 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
ba82c5cf   Ilyes Choubani   improved with mod...
35
  doc_library,'dustem_plugin_modify_spinning_polarization'
7d2d66e7   Ilyes Choubani   replacing polsed,...
36
37
38
39
  goto,the_end
ENDIF


ba82c5cf   Ilyes Choubani   improved with mod...
40
scope='ADD_QSED+ADD_USED'
7d2d66e7   Ilyes Choubani   replacing polsed,...
41
42
43
44
45
46
47

IF  ptr_valid((*!dustem_fit).CURRENT_PARAM_VALUES) THEN BEGIN
    p_dii=(*(*!dustem_fit).CURRENT_PARAM_VALUES)    
    st=dustem_run(p_dii)
    
ENDIF ELSE BEGIN
          p_dii=(*(*!dustem_fit).PARAM_INIT_VALUES)  
ba82c5cf   Ilyes Choubani   improved with mod...
48
          st=dustem_run(p_dii)
7d2d66e7   Ilyes Choubani   replacing polsed,...
49
50
51

      ENDELSE 

ba82c5cf   Ilyes Choubani   improved with mod...
52
;stop
7d2d66e7   Ilyes Choubani   replacing polsed,...
53
54
55
56

psi=0.
smallp=0. ;supposing the spinning dust is 
IF keyword_set(key) THEN BEGIN 
ba82c5cf   Ilyes Choubani   improved with mod...
57
  
7d2d66e7   Ilyes Choubani   replacing polsed,...
58
59
  ind1=where(key EQ 1,count1)
  ind2=where(key EQ 2,count2)
ba82c5cf   Ilyes Choubani   improved with mod...
60
  IF count1 NE 0 THEN smallp=val[ind1[0]] ; setting smallp from pd   
7d2d66e7   Ilyes Choubani   replacing polsed,...
61
  IF count2 NE 0 THEN psi=val[ind2[0]] ; setting psi from pd
ba82c5cf   Ilyes Choubani   improved with mod...
62

7d2d66e7   Ilyes Choubani   replacing polsed,...
63
64
65
ENDIF


ba82c5cf   Ilyes Choubani   improved with mod...
66
fact = 1.e4*1.E20/(4.*!pi)/(3.e8/1.e-6/(st.sed).wav)*1.e20/1.e7
7d2d66e7   Ilyes Choubani   replacing polsed,...
67
68
69


SpinningI=(st.sed.em_grain_1)+(st.sed.em_grain_2)*fact
ba82c5cf   Ilyes Choubani   improved with mod...
70
71
72
73

;760
SpinningI[0:760]=0.

7d2d66e7   Ilyes Choubani   replacing polsed,...
74
75
76

Nwaves=(size(SpinningI))[1]

ba82c5cf   Ilyes Choubani   improved with mod...
77

7d2d66e7   Ilyes Choubani   replacing polsed,...
78
79
polar_ippsi2iqu,SpinningI,SpinningQ,SpinningU,replicate(smallp,Nwaves),replicate(psi,Nwaves) 

ba82c5cf   Ilyes Choubani   improved with mod...
80
out=fltarr(Nwaves,3)
7d2d66e7   Ilyes Choubani   replacing polsed,...
81
82
83
84

out[*,0]=SpinningI
out[*,1]=SpinningQ
out[*,2]=SpinningU
ba82c5cf   Ilyes Choubani   improved with mod...
85

7d2d66e7   Ilyes Choubani   replacing polsed,...
86
87
88
89
90
91
92

return, out

the_end:


end