dustem_create_stokes.pro
1.94 KB
1
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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