Blame view

src/idl/dustem_run_readme.pro 3.04 KB
427f1205   Jean-Michel Glorian   version 4.2 merged
1
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PRO dustem_run_readme,postcript=postcript,mode=mode,help=help,plot_it=plot_it

;+
; NAME:
;    dustem_run_readme
; PURPOSE:
;    This is an example of how to run dustem SEDs with the dustem wrapper.
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    dustem_run_readme,mode=mode,help=help,/postcript,/help,/plot_it
; INPUTS:
;    None
; OPTIONAL INPUT PARAMETERS:
;    None
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    mode = Selects one of the dust mixture used by dustem
;           'COMPIEGNE_ETAL2010' from Compiegne et al 2010 (default)
;           'DBP90' from Desert et al 1990
;           'DL01' from Draine & Li 2001
;           'DL07' from Draine & Li 2007
;    postcript = if set, plot is done in DUSTEM/Docs/Figures/Last_dustem_fit.ps
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    The dustem fortran code must be installed
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; EXAMPLES
;    dustem_run_readme,mode='COMPIEGNE_ETAL2010'
; MODIFICATION HISTORY:
;    Written by J.P. Bernard April 1st 2011
;    see evolution details on the dustem cvs maintained at CESR
;    Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems.
;-

;This Readme shows how to run dustem from the wrapper
;Obviously, the dustem package must have been installed succesfully (see
;dustem_cvs_readme.txt for install instructions).

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_run_readme'
  goto,the_end
ENDIF

loadct,13

IF keyword_set(mode) THEN BEGIN
  use_mode=strupcase(mode)
ENDIF ELSE BEGIN
  use_mode='COMPIEGNE_ETAL2010'    ;Default is last dustem model
ENDELSE

;== This just initializes 
dustem_init,mode=use_mode
!dustem_verbose=1
!dustem_show_plot=1

IF not keyword_set(dir) THEN BEGIN
;  CASE getenv('DUSTEM_WHICH') OF
  CASE !dustem_which OF
    'DESERT':dir='DESERT_POST_ISO_MORE/'
    'COMPIEGNE': dir='MC_DAT/'
    'VERSTRAETE': dir='d_3.5/'
    'VERSTRAETE': dir='LV_DAT/'
;    'WEB3p8': dir_in='dustem3.8_web/'
    'WEB3p8': dir_in=!dustem_soft_dir
    ELSE: dir='les_DAT/'
  ENDCASE
ENDIF
;== This is the input directory selected for Dustem
;dir_in=getenv('DUSTEM_SOFT_DIR')+'/src/'+dir
;dir_in=!dustem_soft_dir+'/src/'+dir
;== The following structure contains the inputs to the model
st_model=dustem_read_all(dir_in)
help,st_model,/str

;=== You can here modify the model inputs
;=== e.g.
;stop
;st_model.G0=2.

;== The following line writes inputs to the Fortran
;dustem_write_all,st_model,getenv('DUSTEM_DAT')
dustem_write_all,st_model,!dustem_dat
;== The runs the Fortran. The ouput structure contains the results
st=dustem_run()
;== The following just plots the resulting emission SED
window,0
;dustem_plot_nuinu_em,st,yr=[1e-28,1.e-22],/ysty,xr=[1,5e3],/xsty
dustem_plot_nuinu_em,st,yr=[1e-11,6.e-7],/ysty,xr=[1,5e3],/xsty
;== The following just plots the resulting extinction
window,1
;dustem_plot_extinction,st,yr=[1.e-4,1.e7],/ysty,xr=[1.e-2,1e5],/xsty
dustem_plot_extinction,st,st_model,yr=[1.e-6,1.e0],/ysty,xr=[1.,400],/xsty

the_end:

END