Blame view

src/idl/dustem_plot_nuinu_em.pro 3.68 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
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

;+
; NAME:
;     dustem_plot_nuinu_em
; PURPOSE:
;    Plots a Dustem spectrum
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    dustem_plot_fit_sed,st[,/help][,_extra=]
; INPUTS:
;    st        = Dustem model output structure
; OPTIONAL INPUT PARAMETERS:
;    _extra    = extra parameters for the plot routine
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    model is plotted
; RESTRICTIONS:
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; 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
; MODIFICATION HISTORY:
;    Written by J.-Ph. Bernard
;    see evolution details on the dustem cvs maintained at CESR
;    Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems.
;-

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...
47
colors=dustem_grains_colors(Ngrains,/cgplot)
427f1205   Jean-Michel Glorian   version 4.2 merged
48

e69bf245   Jean-Philippe Bernard   improved
49
50
;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
51

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

427f1205   Jean-Michel Glorian   version 4.2 merged
53
i=1L
9ccf7615   Jean-Philippe Bernard   modified to fit u...
54
;plot_oo,st.sed.wav,st.sed.(i)*fact,/nodata,_Extra=extra,xtit=xtit,ytit=ytit,tit=tit
e69bf245   Jean-Philippe Bernard   improved
55
56
;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
57
FOR i=1L,Ngrains DO BEGIN
9ccf7615   Jean-Philippe Bernard   modified to fit u...
58
59
60
  ;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
61
ENDFOR
9ccf7615   Jean-Philippe Bernard   modified to fit u...
62
63
64
65
66
67
;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
68

427f1205   Jean-Michel Glorian   version 4.2 merged
69
defsysv,'!dustem_data',exists=exists
8709270c   Jean-Philippe Bernard   modified for new ...
70
71
72

;stop

6730c3f8   Jean-Philippe Bernard   modified to be co...
73
IF exists THEN BEGIN
8709270c   Jean-Philippe Bernard   modified for new ...
74
75
76
   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
77

6730c3f8   Jean-Philippe Bernard   modified to be co...
78
     ;=== Plot the data
9ccf7615   Jean-Philippe Bernard   modified to fit u...
79
80
81
82
     ;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...
83
     IF count_spec NE 0 THEN BEGIN
9ccf7615   Jean-Philippe Bernard   modified to fit u...
84
85
       ;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 ...
86
87
       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...
88
89
90
     ENDIF
     IF count_filt NE 0 THEN BEGIN
       plotsym,0,/fill
9ccf7615   Jean-Philippe Bernard   modified to fit u...
91
       ;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 ...
92
93
       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...
94
     ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
95
   ENDIF
6730c3f8   Jean-Philippe Bernard   modified to be co...
96
ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
97
98
99
100

the_end:

END