Blame view

src/idl/dustem_plugin_synchrotron.pro 2.48 KB
ad00126f   Annie Hughes   tidied comments
1
FUNCTION dustem_plugin_synchrotron,key=key,val=val,scope=scope,paramtag=paramtag,paramdefault=paramdefault,help=help
b5ccb706   Jean-Philippe Bernard   improved to fit p...
2
3
4

;+
; NAME:
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
5
;    dustem_plugin_synchrotron
eef37ef9   Annie Hughes   do not remember, ...
6
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
7
; PURPOSE:
ad00126f   Annie Hughes   tidied comments
8
;    DustEMWrap plugin to compute synchrotron emission
eef37ef9   Annie Hughes   do not remember, ...
9
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
10
; CATEGORY:
ad00126f   Annie Hughes   tidied comments
11
;    DustEM, Distributed, Mid-Level, Plugin
eef37ef9   Annie Hughes   do not remember, ...
12
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
13
; CALLING SEQUENCE:
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
14
;    synch=dustem_plugin_synchrotron([,key=][,val=])
eef37ef9   Annie Hughes   do not remember, ...
15
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
16
17
; INPUTS:
;    None
eef37ef9   Annie Hughes   do not remember, ...
18
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
19
20
21
; OPTIONAL INPUT PARAMETERS:
;    key  = input parameter number
;    val  = input parameter value
eef37ef9   Annie Hughes   do not remember, ...
22
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
23
24
; OUTPUTS:
;    synch = synch spectrum (on dustem wavelengths)
eef37ef9   Annie Hughes   do not remember, ...
25
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
26
; OPTIONAL OUTPUT PARAMETERS:
ad00126f   Annie Hughes   tidied comments
27
28
29
;    scope = scope of the plugin
;    paramdefault = default values of parameters
;    paramtag = plugin parameter names as strings
eef37ef9   Annie Hughes   do not remember, ...
30
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
31
32
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
eef37ef9   Annie Hughes   do not remember, ...
33
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
34
35
; COMMON BLOCKS:
;    None
eef37ef9   Annie Hughes   do not remember, ...
36
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
37
38
; SIDE EFFECTS:
;    None
eef37ef9   Annie Hughes   do not remember, ...
39
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
40
; RESTRICTIONS:
ad00126f   Annie Hughes   tidied comments
41
;    The DustEMWrap IDL code must be installed
eef37ef9   Annie Hughes   do not remember, ...
42
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
43
; PROCEDURE:
ad00126f   Annie Hughes   tidied comments
44
;    This is a DustEMWrap plugin
eef37ef9   Annie Hughes   do not remember, ...
45
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
46
; EXAMPLES
ad00126f   Annie Hughes   tidied comments
47
48
;    dustem_init
;    vec=dustem_plugin_sychrotron(scope=scope)
eef37ef9   Annie Hughes   do not remember, ...
49
;
b5ccb706   Jean-Philippe Bernard   improved to fit p...
50
; MODIFICATION HISTORY:
ad00126f   Annie Hughes   tidied comments
51
52
53
;    Written by JPB 2022 
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
b5ccb706   Jean-Philippe Bernard   improved to fit p...
54
55
56
;-

IF keyword_set(help) THEN BEGIN
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
57
  doc_library,'dustem_plugin_synchrotron'
b5ccb706   Jean-Philippe Bernard   improved to fit p...
58
59
60
61
62
63
  output=0.
  goto,the_end
ENDIF

;default values of input parameters
s=3           ;power spectrum of CR E distribution
452c334e   Ilyes Choubani   Implementation Of...
64
A=1           ;Synchrotron radiation amplitude at 10 mm
7f2b2149   Jean-Philippe Bernard   a Ilyes
65
psi=0.        ;default polarization angle
759a527d   Ilyes Choubani   general update
66
smallp=0.3;0.3    ;default polarization fraction
ad00126f   Annie Hughes   tidied comments
67
scope='ADD_SED+ADD_POLSED'
b1818a4d   Jean-Philippe Bernard   updated names and...
68
;paramtag=['s (plaw_index)','Amp','p','Psi (deg)']
1608acac   Annie Hughes   minor bug in para...
69
70
paramtag=[textoidl('\alpha_{CR}'),'Amp','p',textoidl('\psi')+' [deg]']
paramdefault=[s,A,smallp,psi]
b5ccb706   Jean-Philippe Bernard   improved to fit p...
71
IF keyword_set(key) THEN BEGIN 
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
72
  
7f2b2149   Jean-Philippe Bernard   a Ilyes
73
74
75
  ind1=where(key EQ 1,count1)
  ind2=where(key EQ 2,count2)
  ind3=where(key EQ 3,count3)
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
76
  ind4=where(key EQ 4,count4)
b5ccb706   Jean-Philippe Bernard   improved to fit p...
77
  
2e0d93fe   Jean-Philippe Bernard   fixed order of pa...
78
79
  IF count1 NE 0 then s=val[ind1[0]]
  IF count2 NE 0 then A=val[ind2[0]]
4fd64cbb   Ilyes Choubani   dustem_fit_sed_po...
80
  IF count3 NE 0 then smallp=val[ind3[0]] 
ba82c5cf   Ilyes Choubani   improved with mod...
81
  IF count4 NE 0 then psi=val[ind4[0]]
ad00126f   Annie Hughes   tidied comments
82
  
452c334e   Ilyes Choubani   Implementation Of...
83
84
ENDIF

7f2b2149   Jean-Philippe Bernard   a Ilyes
85
86
lambir=dustem_get_wavelengths()
Nwavs=n_elements(lambir)
452c334e   Ilyes Choubani   Implementation Of...
87

b5ccb706   Jean-Philippe Bernard   improved to fit p...
88
89
90
91
cmic=3.e14
nu=cmic/lambir
lambir_ref=10000.

ba82c5cf   Ilyes Choubani   improved with mod...
92
output=fltarr(Nwavs,3)
eef37ef9   Annie Hughes   do not remember, ...
93
94
95
96
97
98
99

;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.)

7f2b2149   Jean-Philippe Bernard   a Ilyes
100
101
norm=interpol(output[*,0],lambir,lambir_ref)
output[*,0]=A*output[*,0]/norm
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
102

7f2b2149   Jean-Philippe Bernard   a Ilyes
103
polar_ippsi2iqu,output[*,0],Q,U,replicate(smallp,Nwavs),replicate(psi,Nwavs)
7f2b2149   Jean-Philippe Bernard   a Ilyes
104
output[*,1]=Q
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
105
output[*,2]=U
b5ccb706   Jean-Philippe Bernard   improved to fit p...
106

ab718b08   Jean-Philippe Bernard   improved
107
;stop
ba82c5cf   Ilyes Choubani   improved with mod...
108

b5ccb706   Jean-Philippe Bernard   improved to fit p...
109
110
111
112
the_end:
RETURN,output
  
END