Blame view

src/idl/dustem_plot_nuinu_em.pro 3.54 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
   IF ptr_valid((*!dustem_data).sed) THEN BEGIN
7d3f28dc   Jean-Philippe Bernard   not sure what I d...
89
90
91
92
93
     sed=(*(*!dustem_data).sed)
     stop

     ind_filt=where(sed.filt_names NE 'SPECTRUM',count_filt)
     ind_spec=where(sed.filt_names EQ 'SPECTRUM',count_spec)
427f1205   Jean-Michel Glorian   version 4.2 merged
94

6730c3f8   Jean-Philippe Bernard   modified to be co...
95
     ;=== Plot the data
9ccf7615   Jean-Philippe Bernard   modified to fit u...
96
97
98
99
     ;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...
100
     IF count_spec NE 0 THEN BEGIN
9ccf7615   Jean-Philippe Bernard   modified to fit u...
101
102
       ;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
7d3f28dc   Jean-Philippe Bernard   not sure what I d...
103
104
       ;cgoplot,(sed.wav)[ind_spec],((sed.values)[ind_spec])*(3.e8/1.e-6/(sed.wav[ind_spec])/1.d20,psym='Filled Circle',_extra=_extra,color=use_col_data_spec
       ;err_bar,(sed.wav)[ind_spec],((sed.values)[ind_spec])*(3.e8/1.e-6/(sed.wav[ind_spec])/1.d20,yrms=3.*(sed.sigma)[ind_spec]/2.*(3.e8/1.e-6/(sed.wav[ind_spec])/1.d20,color=use_col_data_spec
6730c3f8   Jean-Philippe Bernard   modified to be co...
105
106
     ENDIF
     IF count_filt NE 0 THEN BEGIN
7d3f28dc   Jean-Philippe Bernard   not sure what I d...
107
       stop
6730c3f8   Jean-Philippe Bernard   modified to be co...
108
       plotsym,0,/fill
7d3f28dc   Jean-Philippe Bernard   not sure what I d...
109
       facts=3.e8/1.e-6/(sed.wav[ind_filt])/1.d20
9ccf7615   Jean-Philippe Bernard   modified to fit u...
110
       ;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
7d3f28dc   Jean-Philippe Bernard   not sure what I d...
111
       cgoplot,(sed.wav)[ind_filt],(sed.values)[ind_filt]*facts,psym=8,_extra=_extra,color=use_col_data_filt
8709270c   Jean-Philippe Bernard   modified for new ...
112
       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...
113
     ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
114
   ENDIF
6730c3f8   Jean-Philippe Bernard   modified to be co...
115
ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
116
117
118
119

the_end:

END