dustem_plugin_synchrotron.pro
2.85 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
FUNCTION dustem_plugin_synchrotron,key=key $
,val=val $
,scope=scope $
,paramtag=paramtag $
,paramdefault=paramdefault $
,help=help
;+
; NAME:
; dustem_plugin_synchrotron
;
; PURPOSE:
; DustEMWrap plugin to compute synchrotron emission
;
; CATEGORY:
; DustEM, Distributed, Mid-Level, Plugin
;
; CALLING SEQUENCE:
; synch=dustem_plugin_synchrotron([,key=][,val=])
;
; INPUTS:
; None
;
; OPTIONAL INPUT PARAMETERS:
; key = input parameter number
; 1: s, power spectrum of CR E distribution
; 2 : Amplitude []
; 3 : polarization fraction [%] (default=0)
; 4 : polarization angle [deg]
; val = input parameter value
;
; OUTPUTS:
; synch = synch spectrum (on dustem wavelengths)
;
; OPTIONAL OUTPUT PARAMETERS:
; scope = scope of the plugin
; paramdefault = default values of parameters
; paramtag = plugin parameter names as strings
;
; ACCEPTED KEY-WORDS:
; help = if set, print this help
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
; None
;
; RESTRICTIONS:
; The DustEMWrap IDL code must be installed
;
; PROCEDURE:
; This is a DustEMWrap plugin
;
; EXAMPLES
; dustem_init
; vec=dustem_plugin_sychrotron(scope=scope)
;
; MODIFICATION HISTORY:
; Written by JPB 2022
; Evolution details on the DustEMWrap gitlab.
; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
;-
IF keyword_set(help) THEN BEGIN
doc_library,'dustem_plugin_synchrotron'
output=0.
goto,the_end
ENDIF
;default values of input parameters
s=3 ;power spectrum of CR E distribution
A=1 ;Synchrotron radiation amplitude at 10 mm
psi=0. ;default polarization angle
smallp=0.3;0.3 ;default polarization fraction
;scope='ADD_SED+ADD_POLSED'
scope='ADD_SED'
;paramtag=['s (plaw_index)','Amp','p','Psi (deg)']
paramtag=[textoidl('\alpha_{CR}'),'Amp','p',textoidl('\psi')+' [deg]']
paramdefault=[s,A,smallp,psi]
IF keyword_set(key) THEN BEGIN
ind1=where(key EQ 1,count1)
ind2=where(key EQ 2,count2)
ind3=where(key EQ 3,count3)
ind4=where(key EQ 4,count4)
IF count1 NE 0 then s=val[ind1[0]]
IF count2 NE 0 then A=val[ind2[0]]
IF count3 NE 0 then smallp=val[ind3[0]]
IF count4 NE 0 then psi=val[ind4[0]]
ENDIF
lambir=dustem_get_wavelengths()
Nwavs=n_elements(lambir)
cmic=3.e14
nu=cmic/lambir
lambir_ref=10000.
output=fltarr(Nwavs,3)
;following eqn is Deschenes et al 2008, eq 6
;output[*,0]=nu^(-(s+3.)/2.)
; following is Condon 1992 page 590 (in text)
output[*,0]=nu^((1.-s)/2.)
norm=interpol(output[*,0],lambir,lambir_ref)
output[*,0]=A*output[*,0]/norm
polar_ippsi2iqu,output[*,0],Q,U,replicate(smallp,Nwavs),replicate(psi,Nwavs)
output[*,1]=Q
output[*,2]=U
;stop
the_end:
RETURN,output
END