Blame view

src/idl/dustem_activate_plugins.pro 4.21 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

08e3260e   Jean-Philippe Bernard   cleaned unused ke...
3
4
5
;== 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 ...

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


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

746b3ee2   Jean-Philippe Bernard   fixed for REPLACE...
62
63
;stop

80386bb1   Jean-Philippe Bernard   removed need for ...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
IF ptr_valid((*!dustem_fit).param_descs) THEN BEGIN
    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)]
    ENDIF ELSE BEGIN
        param_descs = (*(*!dustem_fit).param_descs)
        param_values = p_dim
    ENDELSE
5eebdedb   Jean-Philippe Bernard   changed plugin st...
78
ENDIF ELSE BEGIN
80386bb1   Jean-Philippe Bernard   removed need for ...
79
80
81
    message,'(*!dustem_fit).param_descs not set',/continue
    stop
    ;JPB: not sure what to do then. pdim is needed below to run the fortran
5eebdedb   Jean-Philippe Bernard   changed plugin st...
82
ENDELSE
3c479f24   Ilyes Choubani   Allowing to fix p...
83

f1a4f985   Jean-Philippe Bernard   improved
84
85
;stop

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

a84e0595   Jean-Philippe Bernard   modified plugin s...
88
89
90
;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 + ...
91

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

a84e0595   Jean-Philippe Bernard   modified plugin s...
95
;=== This runs the plugins
be6b622d   Jean-Philippe Bernard   Trimmed unused co...
96
;JPB: Removed allusion to param_func not used in dustem_run_plugins.pro (08 March 2024)
a84e0595   Jean-Philippe Bernard   modified plugin s...
97
;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['ADD_SED'], avoid=1,use_previous_fortran=use_previous_fortran
be6b622d   Jean-Philippe Bernard   Trimmed unused co...
98
;dustem_run_plugins, p_dim ,param_descs, param_values, param_func, 1, avoid=1,use_previous_fortran=use_previous_fortran
80386bb1   Jean-Philippe Bernard   removed need for ...
99
100
;dustem_run_plugins, p_dim ,param_descs, param_values, 1
dustem_run_plugins, param_descs, param_values, 1
88872c38   Ilyes Choubani   small update. Cha...
101

746b3ee2   Jean-Philippe Bernard   fixed for REPLACE...
102
;===== This one is the one that runs the Fortran even if there is no plugin of type 2 invoked (!)
80386bb1   Jean-Philippe Bernard   removed need for ...
103
104
;dustem_run_plugins, p_dim ,param_descs, param_values, 2,st=st ;dustem output is available at this step.
dustem_run_plugins, param_descs, param_values, 2,st=st ;dustem output is available at this step.
008ab3a3   Annie Hughes   unknown
105

80386bb1   Jean-Philippe Bernard   removed need for ...
106
107
;dustem_run_plugins, p_dim ,param_descs, param_values, 3
dustem_run_plugins, param_descs, param_values, 3
0068116a   Ilyes Choubani   General update + ...
108

80386bb1   Jean-Philippe Bernard   removed need for ...
109
110
;dustem_run_plugins, p_dim ,param_descs, param_values, 4,/ask_for_st,st=st,N2be_run=N2be_run
dustem_run_plugins, param_descs, param_values, 4,/ask_for_st,st=st,N2be_run=N2be_run
a39f6d2a   Jean-Philippe Bernard   improved
111

0266152d   Jean-Philippe Bernard   fixed the way for...
112
113
114
115
116
117
;=== 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
0068116a   Ilyes Choubani   General update + ...
118

4750086c   Ilyes Choubani   nouvelle philosph...
119
the_end:
e7938fa3   Ilyes Choubani   Corrected02: Impl...
120

4750086c   Ilyes Choubani   nouvelle philosph...
121
END