Blame view

src/idl/dustem_plugin_synchrotron.pro 2.35 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
b5ccb706   Jean-Philippe Bernard   improved to fit p...
6
; PURPOSE:
ad00126f   Annie Hughes   tidied comments
7
;    DustEMWrap plugin to compute synchrotron emission
b5ccb706   Jean-Philippe Bernard   improved to fit p...
8
; CATEGORY:
ad00126f   Annie Hughes   tidied comments
9
;    DustEM, Distributed, Mid-Level, Plugin
b5ccb706   Jean-Philippe Bernard   improved to fit p...
10
; CALLING SEQUENCE:
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
11
;    synch=dustem_plugin_synchrotron([,key=][,val=])
b5ccb706   Jean-Philippe Bernard   improved to fit p...
12
13
14
15
16
17
18
19
; INPUTS:
;    None
; OPTIONAL INPUT PARAMETERS:
;    key  = input parameter number
;    val  = input parameter value
; OUTPUTS:
;    synch = synch spectrum (on dustem wavelengths)
; OPTIONAL OUTPUT PARAMETERS:
ad00126f   Annie Hughes   tidied comments
20
21
22
;    scope = scope of the plugin
;    paramdefault = default values of parameters
;    paramtag = plugin parameter names as strings
b5ccb706   Jean-Philippe Bernard   improved to fit p...
23
24
25
26
27
28
29
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
ad00126f   Annie Hughes   tidied comments
30
;    The DustEMWrap IDL code must be installed
b5ccb706   Jean-Philippe Bernard   improved to fit p...
31
; PROCEDURE:
ad00126f   Annie Hughes   tidied comments
32
;    This is a DustEMWrap plugin
b5ccb706   Jean-Philippe Bernard   improved to fit p...
33
; EXAMPLES
ad00126f   Annie Hughes   tidied comments
34
35
;    dustem_init
;    vec=dustem_plugin_sychrotron(scope=scope)
b5ccb706   Jean-Philippe Bernard   improved to fit p...
36
; MODIFICATION HISTORY:
ad00126f   Annie Hughes   tidied comments
37
38
39
;    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...
40
41
42
;-

IF keyword_set(help) THEN BEGIN
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
43
  doc_library,'dustem_plugin_synchrotron'
b5ccb706   Jean-Philippe Bernard   improved to fit p...
44
45
46
47
48
49
  output=0.
  goto,the_end
ENDIF

;default values of input parameters
s=3           ;power spectrum of CR E distribution
452c334e   Ilyes Choubani   Implementation Of...
50
A=1           ;Synchrotron radiation amplitude at 10 mm
7f2b2149   Jean-Philippe Bernard   a Ilyes
51
psi=0.        ;default polarization angle
759a527d   Ilyes Choubani   general update
52
smallp=0.3;0.3    ;default polarization fraction
ad00126f   Annie Hughes   tidied comments
53
scope='ADD_SED+ADD_POLSED'
b1818a4d   Jean-Philippe Bernard   updated names and...
54
55
;paramtag=['s (plaw_index)','Amp','p','Psi (deg)']
paramtag=[textoidl('\alpha_{CR}'),'Amp','p','Psi [deg]']
ad00126f   Annie Hughes   tidied comments
56
paramdefault=[s,A,psi,smallp]
b5ccb706   Jean-Philippe Bernard   improved to fit p...
57
IF keyword_set(key) THEN BEGIN 
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
58
  
7f2b2149   Jean-Philippe Bernard   a Ilyes
59
60
61
  ind1=where(key EQ 1,count1)
  ind2=where(key EQ 2,count2)
  ind3=where(key EQ 3,count3)
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
62
  ind4=where(key EQ 4,count4)
b5ccb706   Jean-Philippe Bernard   improved to fit p...
63
  
2e0d93fe   Jean-Philippe Bernard   fixed order of pa...
64
65
  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...
66
  IF count3 NE 0 then smallp=val[ind3[0]] 
ba82c5cf   Ilyes Choubani   improved with mod...
67
  IF count4 NE 0 then psi=val[ind4[0]]
ad00126f   Annie Hughes   tidied comments
68
  
452c334e   Ilyes Choubani   Implementation Of...
69
70
ENDIF

7f2b2149   Jean-Philippe Bernard   a Ilyes
71
72
lambir=dustem_get_wavelengths()
Nwavs=n_elements(lambir)
452c334e   Ilyes Choubani   Implementation Of...
73

b5ccb706   Jean-Philippe Bernard   improved to fit p...
74
75
76
77
cmic=3.e14
nu=cmic/lambir
lambir_ref=10000.

b5ccb706   Jean-Philippe Bernard   improved to fit p...
78
;see Deschenes et al 2008, eq 6
ba82c5cf   Ilyes Choubani   improved with mod...
79
output=fltarr(Nwavs,3)
7f2b2149   Jean-Philippe Bernard   a Ilyes
80
81
82
output[*,0]=nu^(-(s+3.)/2.)
norm=interpol(output[*,0],lambir,lambir_ref)
output[*,0]=A*output[*,0]/norm
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
83

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

ab718b08   Jean-Philippe Bernard   improved
88
;stop
ba82c5cf   Ilyes Choubani   improved with mod...
89

b5ccb706   Jean-Philippe Bernard   improved to fit p...
90
91
92
93
the_end:
RETURN,output
  
END