dustem_activate_plugins.pro
5.11 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
PRO dustem_activate_plugins,p_min,st=st,help=help,use_previous_fortran=use_previous_fortran
;== This code should actually be called dustem_run_the_whole_model (or something like this)
;== Note sure what the use_previous_fortran is actually usd for ...
;+
; NAME:
; dustem_activate_plugins
;
; PURPOSE:
; activates the plugins invoked by the parameter description vector (pd) and the fixed parameter description vector (fpd)
;
; CATEGORY:
; DustEMWrapp, Distributed, Mid-Level, Plugins
;
; CALLING SEQUENCE:
; dustem_activate_plugins,p_min[,st][,/help]
;
; INPUTS:
; p_min = dustem parameter values normalized to initial parameter values
;
; OPTIONAL INPUT PARAMETERS:
;
; OUTPUTS:
; None
;
; OPTIONAL OUTPUT PARAMETERS:
; st = Dustem output structure, with contribution from pluggins taken into account
;
; ACCEPTED KEY-WORDS:
; use_previous_fortran = if set, uses the output of the previous fortran run, and does not run the fortran.
; help = if set, print this help
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
; None
;
; RESTRICTIONS:
; The DustEM fortran code must be installed
; The DustEMWrap idl code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;
; EXAMPLES
; dustem_activate_plugins, p_min ,st=st
;
; MODIFICATION HISTORY:
; Written by IC
; Evolution details on the DustEMWrap gitlab.
; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
;-
IF keyword_set(help) THEN BEGIN
doc_library,'dustem_activate_plugins'
goto,the_end
output=0.
ENDIF
;stop
p_dim = p_min * (*(*!dustem_fit).param_init_values)
;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
;concatenating the parameter vectors
param_descs = [(*(*!dustem_fit).param_descs),(*(*!dustem_fit).fixed_param_descs)]
param_values = [p_dim,(*(*!dustem_fit).fixed_param_init_values)]
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)
;Trimmed JPB on 08 March 2024
;dustem_set_func_ind, param_descs, param_values ; this sets (*(*!dustem_fit).param_func)
;param_func = (*(*!dustem_fit).param_func)
;param_func =0 ;not used anyway later in dustem_run_plugins
;Trimmed JPB on 08 March 2024
;dustem_set_func_ind, (*(*!dustem_fit).param_descs), p_dim ;setting the pointers back to their original valyes
ENDIF ELSE BEGIN
param_descs = (*(*!dustem_fit).param_descs)
param_values = p_dim
;param_func = (*(*!dustem_fit).param_func)
;param_func=0 ;not used anyway later in dustem_run_plugins
ENDELSE
;stop
;===== Run the plugins, according to their scopes (and the Fortran)
;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.
;IF /avoid is used the specified scopes are avoided. They're considered when /avoid is missing.
;using '**' so not to write the entire scope
;=== This runs the plugins
;JPB: Removed allusion to param_func not used in dustem_run_plugins.pro (08 March 2024)
;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
dustem_run_plugins, p_dim ,param_descs, param_values, 1
;===== This one is the one that runs the Fortran even if there is no plugin of type 2 invoked (!)
;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.
dustem_run_plugins, p_dim ,param_descs, param_values, 2,st=st ;dustem output is available at this step.
;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
dustem_run_plugins, p_dim ,param_descs, param_values, 3
;stop
;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
dustem_run_plugins, p_dim ,param_descs, param_values, 4,/ask_for_st,st=st,N2be_run=N2be_run
;dustem_print_params,0
;=== If no type 4 plugin was dtected, run the Fortran
;=== This was previously done in dustem_run_plugins
IF N2be_run EQ 0 THEN BEGIN
st = dustem_run(p_dim,use_previous_fortran=use_previous_fortran)
!dustem_current = ptr_new(st)
ENDIF
the_end:
END