Blame view

src/idl/dustem_activate_plugins.pro 4 KB
5eebdedb   Jean-Philippe Bernard   changed plugin st...
1
PRO dustem_activate_plugins,p_min,st=st,help=help,use_previous_fortran=use_previous_fortran
4750086c   Ilyes Choubani   nouvelle philosph...
2
3
4
5

;+
; NAME:
;    dustem_activate_plugins
008ab3a3   Annie Hughes   unknown
6
;
4750086c   Ilyes Choubani   nouvelle philosph...
7
; PURPOSE:
5eebdedb   Jean-Philippe Bernard   changed plugin st...
8
;    activates the plugins invoked by the parameter description vector (pd) and the fixed parameter description vector (fpd)
008ab3a3   Annie Hughes   unknown
9
;
4750086c   Ilyes Choubani   nouvelle philosph...
10
; CATEGORY:
008ab3a3   Annie Hughes   unknown
11
12
;    DustEMWrapp, Distributed, Mid-Level, Plugins
;
4750086c   Ilyes Choubani   nouvelle philosph...
13
; CALLING SEQUENCE:
0c127f0f   Ilyes Choubani   correcting small ...
14
;    dustem_activate_plugins,p_min[,st][,/help] 
008ab3a3   Annie Hughes   unknown
15
;
4750086c   Ilyes Choubani   nouvelle philosph...
16
; INPUTS:
5eebdedb   Jean-Philippe Bernard   changed plugin st...
17
;    p_min = dustem parameter values normalized to initial parameter values
008ab3a3   Annie Hughes   unknown
18
;
4750086c   Ilyes Choubani   nouvelle philosph...
19
; OPTIONAL INPUT PARAMETERS:
008ab3a3   Annie Hughes   unknown
20
;
4750086c   Ilyes Choubani   nouvelle philosph...
21
; OUTPUTS:
01612ee4   Ilyes Choubani   General update: I...
22
;    None
008ab3a3   Annie Hughes   unknown
23
;
4750086c   Ilyes Choubani   nouvelle philosph...
24
; OPTIONAL OUTPUT PARAMETERS:
5eebdedb   Jean-Philippe Bernard   changed plugin st...
25
;    st = Dustem output structure, with contribution from pluggins taken into account
008ab3a3   Annie Hughes   unknown
26
;
4750086c   Ilyes Choubani   nouvelle philosph...
27
; ACCEPTED KEY-WORDS:
5eebdedb   Jean-Philippe Bernard   changed plugin st...
28
;    use_previous_fortran = if set, uses the output of the previous fortran run, and does not run the fortran.
4750086c   Ilyes Choubani   nouvelle philosph...
29
;    help                  = if set, print this help
008ab3a3   Annie Hughes   unknown
30
;
4750086c   Ilyes Choubani   nouvelle philosph...
31
32
; COMMON BLOCKS:
;    None
008ab3a3   Annie Hughes   unknown
33
;
4750086c   Ilyes Choubani   nouvelle philosph...
34
35
; SIDE EFFECTS:
;    None
008ab3a3   Annie Hughes   unknown
36
;
4750086c   Ilyes Choubani   nouvelle philosph...
37
; RESTRICTIONS:
50bb5343   Annie Hughes   minor changes to ...
38
39
;    The DustEM fortran code must be installed
;    The DustEMWrap idl code must be installed
008ab3a3   Annie Hughes   unknown
40
;
50bb5343   Annie Hughes   minor changes to ...
41
; PROCEDURES AND SUBROUTINES USED:
008ab3a3   Annie Hughes   unknown
42
;
50bb5343   Annie Hughes   minor changes to ...
43
; EXAMPLES
0c127f0f   Ilyes Choubani   correcting small ...
44
;    dustem_activate_plugins, p_min ,st=st
50bb5343   Annie Hughes   minor changes to ...
45
46
;
; MODIFICATION HISTORY:
57cdd991   Ilyes Choubani   updating sections...
47
;    Written by IC
50bb5343   Annie Hughes   minor changes to ...
48
49
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
4750086c   Ilyes Choubani   nouvelle philosph...
50
51
52
53
54
55
56
57
58
;-


IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_activate_plugins'
  goto,the_end
  output=0.
ENDIF

e7938fa3   Ilyes Choubani   Corrected02: Impl...
59
p_dim = p_min * (*(*!dustem_fit).param_init_values)
e7938fa3   Ilyes Choubani   Corrected02: Impl...
60

5eebdedb   Jean-Philippe Bernard   changed plugin st...
61
62
63
;This is to account for fixed parameters
;caution: this assumes there are variable parameters, could not always be the case ...
IF isa((*!dustem_fit).fixed_param_descs) THEN BEGIN 
3c479f24   Ilyes Choubani   Allowing to fix p...
64
65
    ;concatenating the parameter vectors
    param_descs =  [(*(*!dustem_fit).param_descs),(*(*!dustem_fit).fixed_param_descs)]  
3c479f24   Ilyes Choubani   Allowing to fix p...
66
    param_values = [p_dim,(*(*!dustem_fit).fixed_param_init_values)]
5eebdedb   Jean-Philippe Bernard   changed plugin st...
67
68
69
    param_values = param_values[sort(param_descs)] ;should we put it back to the way it was?
    param_descs = param_descs[sort(param_descs)]
    ;Taking care of the param_func vector (not sure if this is of any use anymore)
3c479f24   Ilyes Choubani   Allowing to fix p...
70
71
72
    dustem_set_func_ind, param_descs, param_values ; this sets  (*(*!dustem_fit).param_func)
    param_func = (*(*!dustem_fit).param_func)
    dustem_set_func_ind, (*(*!dustem_fit).param_descs), p_dim ;setting the pointers back to their original valyes 
5eebdedb   Jean-Philippe Bernard   changed plugin st...
73
ENDIF ELSE BEGIN
3c479f24   Ilyes Choubani   Allowing to fix p...
74
75
76
    param_descs = (*(*!dustem_fit).param_descs)
    param_values = p_dim
    param_func = (*(*!dustem_fit).param_func)
5eebdedb   Jean-Philippe Bernard   changed plugin st...
77
ENDELSE
3c479f24   Ilyes Choubani   Allowing to fix p...
78

f1a4f985   Jean-Philippe Bernard   improved
79
80
;stop

a84e0595   Jean-Philippe Bernard   modified plugin s...
81
;===== Run the plugins, according to their scopes (and the Fortran)
3c479f24   Ilyes Choubani   Allowing to fix p...
82

a84e0595   Jean-Philippe Bernard   modified plugin s...
83
84
85
;The 'ADD_SED' plugins are run first. Note that their output could be used by plugins run later. 
;The plugins related to 'ISRF' are run second, and the Fortrn is run at that stage, just after the corresponding plugins.
;The plugins which Replace the output of the fortran are run last.
0068116a   Ilyes Choubani   General update + ...
86

01612ee4   Ilyes Choubani   General update: I...
87
;IF /avoid is used the specified scopes are avoided. They're considered when /avoid is missing.
dc84fd94   Ilyes Choubani   Small corrections...
88
;using '**' so not to write the entire scope
5eebdedb   Jean-Philippe Bernard   changed plugin st...
89

a84e0595   Jean-Philippe Bernard   modified plugin s...
90
91
92
;=== This runs the plugins
;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_SED'], avoid=1,use_previous_fortran=use_previous_fortran
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 1, avoid=1,use_previous_fortran=use_previous_fortran
88872c38   Ilyes Choubani   small update. Cha...
93

a84e0595   Jean-Philippe Bernard   modified plugin s...
94
95
;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_ISRF','REPLACE_ISRF'] ,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step.
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 2,force_dustem_run=1,st=st,use_previous_fortran=use_previous_fortran ;dustem output is available at this step.
008ab3a3   Annie Hughes   unknown
96

a84e0595   Jean-Philippe Bernard   modified plugin s...
97
98
;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_SED'],use_previous_fortran=use_previous_fortran
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 3,use_previous_fortran=use_previous_fortran
0068116a   Ilyes Choubani   General update + ...
99

a84e0595   Jean-Philippe Bernard   modified plugin s...
100
101
;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['REPLACE_SED'],use_previous_fortran=use_previous_fortran
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 4,use_previous_fortran=use_previous_fortran
0068116a   Ilyes Choubani   General update + ...
102
103


4750086c   Ilyes Choubani   nouvelle philosph...
104
the_end:
e7938fa3   Ilyes Choubani   Corrected02: Impl...
105

4750086c   Ilyes Choubani   nouvelle philosph...
106
END