dustem_plugin_mbbdy.pro
2.33 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
93
94
95
96
97
98
99
100
FUNCTION dustem_plugin_mbbdy ,key=key,val=val,scope=scope,paramtag=paramtag,help=help
;+
; NAME:
; dustem_plugin_mbbdy
; PURPOSE:
; DUSTEM plugin to compute modified black-body emission
; CATEGORY:
; DUSTEM Wrapper
; CALLING SEQUENCE:
; output=dustem_plugin_mbbdy([,key=][,val=])
; INPUTS:
; None
; OPTIONAL INPUT PARAMETERS:
; key = input parameter number
; val = input parameter value
; OUTPUTS:
; output = MBB spectrum (on dustem wavelengths) (output[*,0] is Stokes I, output[*,1] Stokes Q and output[*,2] Stokes U)
; OPTIONAL OUTPUT PARAMETERS:
; None
; ACCEPTED KEY-WORDS:
; help = if set, print this help
; COMMON BLOCKS:
; None
; SIDE EFFECTS:
; None
; RESTRICTIONS:
; None
; PROCEDURE:
; This is a dustem plugin
; EXAMPLES
;
; MODIFICATION HISTORY:
; Written by JPB
;-
IF keyword_set(help) THEN BEGIN
doc_library,'dustem_plugin_mbbdy'
output=0.
goto,the_end
ENDIF
;default values of input parameters
amp = 0.5 ; Amplitude of the modified black-body emission
temp = 20.0 ; Temperature of the dust
beta = 1.8 ; Emissivity index
w0=100. ; Theoretical wavelength (3THz) where optical depth equals unity
;check formula of modified black body in the optically thin case
;default polarization values
smallp=0.
psi=0.
;scope='ADD_SED+ADD_POLSED'
scope='ADD_SED'
paramtag=['Amp',textoidl('T_{MBB}')+' [K]',textoidl('\beta'),'p','Psi [deg]']
IF keyword_set(key) THEN BEGIN
ind1=where(key EQ 1,count1) ; reading amp
ind2=where(key EQ 2,count2) ; reading temp
ind3=where(key EQ 3,count3) ; reading beta
;In the case this plugin is used in polarization
ind4=where(key EQ 4,count4) ; reading smallp
ind5=where(key EQ 5,count5) ; reading psi
IF count1 NE 0 then amp=val[ind1[0]] ;else default value
IF count2 NE 0 then temp=val[ind2[0]] ; // //
IF count3 NE 0 then beta=val[ind3[0]] ; // //
IF count4 NE 0 then smallp=val[ind4[0]] ; // //
IF count5 NE 0 then psi=val[ind5[0]] ; // //
ENDIF
lambir=dustem_get_wavelengths()
Nwavs=n_elements(lambir)
spec=amp*(lambir/w0)^(-1.*beta)*dustem_planck_function(temp,lambir)
;see Deschenes et al 2008, eq 6
output=fltarr(Nwavs,3)
output[*,0]=spec
;polarization this actually need to
polar_ippsi2iqu,output[*,0],Q,U,replicate(smallp,Nwavs),replicate(psi,Nwavs)
output[*,1]=Q
output[*,2]=U
the_end:
RETURN,output
END