Blame view

src/idl/dustem_plot_nuinu_em.pro 3.67 KB
e69bf245   Jean-Philippe Bernard   improved
1
PRO dustem_plot_nuinu_em,st,_extra=_extra,help=help
427f1205   Jean-Michel Glorian   version 4.2 merged
2
3
4
5

;+
; NAME:
;     dustem_plot_nuinu_em
5d7f6687   Annie Hughes   tidied help
6
;
427f1205   Jean-Michel Glorian   version 4.2 merged
7
; PURPOSE:
5d7f6687   Annie Hughes   tidied help
8
9
;    Plots a DustEM emission spectrum
;
427f1205   Jean-Michel Glorian   version 4.2 merged
10
11
; CATEGORY:
;    Dustem
5d7f6687   Annie Hughes   tidied help
12
;
427f1205   Jean-Michel Glorian   version 4.2 merged
13
; CALLING SEQUENCE:
5d7f6687   Annie Hughes   tidied help
14
15
;    dustem_plot_nuinu_em,st[,/help][,_extra=]
;
427f1205   Jean-Michel Glorian   version 4.2 merged
16
17
; INPUTS:
;    st        = Dustem model output structure
5d7f6687   Annie Hughes   tidied help
18
;
427f1205   Jean-Michel Glorian   version 4.2 merged
19
20
; OPTIONAL INPUT PARAMETERS:
;    _extra    = extra parameters for the plot routine
5d7f6687   Annie Hughes   tidied help
21
;
427f1205   Jean-Michel Glorian   version 4.2 merged
22
23
; OUTPUTS:
;    None
5d7f6687   Annie Hughes   tidied help
24
;
427f1205   Jean-Michel Glorian   version 4.2 merged
25
26
; OPTIONAL OUTPUT PARAMETERS:
;    None
5d7f6687   Annie Hughes   tidied help
27
;
427f1205   Jean-Michel Glorian   version 4.2 merged
28
29
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
5d7f6687   Annie Hughes   tidied help
30
;
427f1205   Jean-Michel Glorian   version 4.2 merged
31
32
; COMMON BLOCKS:
;    None
5d7f6687   Annie Hughes   tidied help
33
;
427f1205   Jean-Michel Glorian   version 4.2 merged
34
; SIDE EFFECTS:
5d7f6687   Annie Hughes   tidied help
35
;
427f1205   Jean-Michel Glorian   version 4.2 merged
36
; RESTRICTIONS:
5d7f6687   Annie Hughes   tidied help
37
38
;    The DustEMWrap IDL code must be installed
;
427f1205   Jean-Michel Glorian   version 4.2 merged
39
40
; PROCEDURE:
;    None
5d7f6687   Annie Hughes   tidied help
41
;
427f1205   Jean-Michel Glorian   version 4.2 merged
42
43
44
45
46
; EXAMPLES
;    dustem_init,/wrap
;    dir=getenv('DUSTEM_RES')
;    st=dustem_read_all_res(dir)
;    dustem_plot_nuinu_em,st,yr=[1e-28,1.e-22],/ysty,xr=[1,5e3],/xsty
5d7f6687   Annie Hughes   tidied help
47
;
427f1205   Jean-Michel Glorian   version 4.2 merged
48
; MODIFICATION HISTORY:
5d7f6687   Annie Hughes   tidied help
49
50
51
;    Written by J.-Ph. Bernard 2007
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
427f1205   Jean-Michel Glorian   version 4.2 merged
52
53
;-

5d7f6687   Annie Hughes   tidied help
54

427f1205   Jean-Michel Glorian   version 4.2 merged
55
56
57
58
59
60
IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_plot_nuinu_em'
  goto,the_end
ENDIF

Ngrains=n_tags(st.sed)-2
9ccf7615   Jean-Philippe Bernard   modified to fit u...
61
colors=dustem_grains_colors(Ngrains,/cgplot)
427f1205   Jean-Michel Glorian   version 4.2 merged
62

e69bf245   Jean-Philippe Bernard   improved
63
64
;This is to go to units of W/m^2/sr for N_H=1.e20 H/cm^2
fact=1./4./!pi*1.e4/1.e7*1.e20
427f1205   Jean-Michel Glorian   version 4.2 merged
65

9ccf7615   Jean-Philippe Bernard   modified to fit u...
66

427f1205   Jean-Michel Glorian   version 4.2 merged
67
i=1L
9ccf7615   Jean-Philippe Bernard   modified to fit u...
68
;plot_oo,st.sed.wav,st.sed.(i)*fact,/nodata,_Extra=extra,xtit=xtit,ytit=ytit,tit=tit
e69bf245   Jean-Philippe Bernard   improved
69
70
;cgplot,st.sed.wav,st.sed.(i)*fact,/nodata,_Extra=extra,xtit=xtit,ytit=ytit,tit=tit,/xlog,/ylog
cgplot,st.sed.wav,st.sed.(i)*fact,/nodata,_extra=_extra
427f1205   Jean-Michel Glorian   version 4.2 merged
71
FOR i=1L,Ngrains DO BEGIN
9ccf7615   Jean-Philippe Bernard   modified to fit u...
72
73
74
  ;oplot,st.sed.wav,st.sed.(i)*fact,color=colors(i-1),psym=psym
  cgoplot,st.sed.wav,st.sed.(i)*fact,color=colors[i-1],psym=psym
  ;stop
427f1205   Jean-Michel Glorian   version 4.2 merged
75
ENDFOR
9ccf7615   Jean-Philippe Bernard   modified to fit u...
76
77
78
79
80
81
;oplot,st.sed.wav,st.sed.(i)*fact,color=255,psym=psym
cgoplot,st.sed.wav,st.sed.(i)*fact,color='black',psym=psym

;stop

;Remarks: not sure that the plot of the sed below actually works. See dustem_sed_plot.pro
36e8b879   Jean-Michel Glorian   update from deborah
82

427f1205   Jean-Michel Glorian   version 4.2 merged
83
defsysv,'!dustem_data',exists=exists
8709270c   Jean-Philippe Bernard   modified for new ...
84
85
86

;stop

6730c3f8   Jean-Philippe Bernard   modified to be co...
87
IF exists THEN BEGIN
8709270c   Jean-Philippe Bernard   modified for new ...
88
89
90
   IF ptr_valid((*!dustem_data).sed) THEN BEGIN
     ind_filt=where((*!dustem_data).sed.filt_names NE 'SPECTRUM',count_filt)
     ind_spec=where((*!dustem_data).sed.filt_names EQ 'SPECTRUM',count_spec)
427f1205   Jean-Michel Glorian   version 4.2 merged
91

6730c3f8   Jean-Philippe Bernard   modified to be co...
92
     ;=== Plot the data
9ccf7615   Jean-Philippe Bernard   modified to fit u...
93
94
95
96
     ;use_col_data_spec=255
     ;use_col_data_filt=100
     use_col_data_spec='blue'
     use_col_data_filt='red'
6730c3f8   Jean-Philippe Bernard   modified to be co...
97
     IF count_spec NE 0 THEN BEGIN
9ccf7615   Jean-Philippe Bernard   modified to fit u...
98
99
       ;plotsym,0,/fill
       ;oplot,((*!dustem_data.sed).wav)(ind_spec),((*!dustem_data.sed).values)(ind_spec)*(3.e8/1.e-6/(*!dustem_data.sed).wav(ind_spec))/1.d20,psym=8,_extra=extra,color=use_col_data_spec,syms=0.5
8709270c   Jean-Philippe Bernard   modified for new ...
100
101
       cgoplot,((*!dustem_data).sed.wav)[ind_spec],((*!dustem_data).sed.values)[ind_spec]*(3.e8/1.e-6/(*!dustem_data).sed.wav[ind_spec])/1.d20,psym='Filled Circle',_extra=extra,color=use_col_data_spec
       err_bar,((*!dustem_data).sed.wav)(ind_spec),((*!dustem_data).sed.values)(ind_spec)*(3.e8/1.e-6/(*!dustem_data).sed.wav(ind_spec))/1.d20,yrms=3.*((*!dustem_data).sed.sigma)(ind_spec)/2.*(3.e8/1.e-6/(*!dustem_data).sed.wav(ind_spec))/1.d20,color=use_col_data_spec
6730c3f8   Jean-Philippe Bernard   modified to be co...
102
103
104
     ENDIF
     IF count_filt NE 0 THEN BEGIN
       plotsym,0,/fill
9ccf7615   Jean-Philippe Bernard   modified to fit u...
105
       ;oplot,((*!dustem_data.sed).wav)(ind_filt),((*!dustem_data.sed).values)(ind_filt)*(3.e8/1.e-6/(*!dustem_data.sed).wav(ind_filt))/1.d20,psym=8,_extra=extra,color=use_col_data_filt
8709270c   Jean-Philippe Bernard   modified for new ...
106
107
       cgoplot,((*!dustem_data).sed.wav)(ind_filt),((*!dustem_data).sed.values)(ind_filt)*(3.e8/1.e-6/(*!dustem_data).sed.wav(ind_filt))/1.d20,psym=8,_extra=extra,color=use_col_data_filt
       err_bar,((*!dustem_data).sed.wav)(ind_filt),((*!dustem_data).sed.values)(ind_filt)*(3.e8/1.e-6/(*!dustem_data).sed.wav(ind_filt))/1.d20,yrms=3.*((*!dustem_data).sed.sigma)(ind_filt)/2*(3.e8/1.e-6/(*!dustem_data).sed.wav(ind_filt))/1.d20,color=use_col_data_filt
6730c3f8   Jean-Philippe Bernard   modified to be co...
108
     ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
109
   ENDIF
6730c3f8   Jean-Philippe Bernard   modified to be co...
110
ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
111
112
113
114

the_end:

END