Blame view

src/idl/dustem_activate_plugins.pro 3.49 KB
57cdd991   Ilyes Choubani   updating sections...
1
PRO dustem_activate_plugins,p_min,st=st,help=help
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:
13a0b9db   Ilyes Choubani   why was this modi...
8
;    activates the plugins present in 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:
57cdd991   Ilyes Choubani   updating sections...
17
;    p_min = (parameter values)/(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:
57cdd991   Ilyes Choubani   updating sections...
25
;    st = Dustem output structure
008ab3a3   Annie Hughes   unknown
26
;
4750086c   Ilyes Choubani   nouvelle philosph...
27
28
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
008ab3a3   Annie Hughes   unknown
29
;
4750086c   Ilyes Choubani   nouvelle philosph...
30
31
; COMMON BLOCKS:
;    None
008ab3a3   Annie Hughes   unknown
32
;
4750086c   Ilyes Choubani   nouvelle philosph...
33
34
; SIDE EFFECTS:
;    None
008ab3a3   Annie Hughes   unknown
35
;
4750086c   Ilyes Choubani   nouvelle philosph...
36
; RESTRICTIONS:
50bb5343   Annie Hughes   minor changes to ...
37
38
;    The DustEM fortran code must be installed
;    The DustEMWrap idl code must be installed
008ab3a3   Annie Hughes   unknown
39
;
50bb5343   Annie Hughes   minor changes to ...
40
; PROCEDURES AND SUBROUTINES USED:
008ab3a3   Annie Hughes   unknown
41
;
50bb5343   Annie Hughes   minor changes to ...
42
; EXAMPLES
0c127f0f   Ilyes Choubani   correcting small ...
43
;    dustem_activate_plugins, p_min ,st=st
50bb5343   Annie Hughes   minor changes to ...
44
45
;
; MODIFICATION HISTORY:
57cdd991   Ilyes Choubani   updating sections...
46
;    Written by IC
50bb5343   Annie Hughes   minor changes to ...
47
48
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
4750086c   Ilyes Choubani   nouvelle philosph...
49
50
51
52
53
54
55
56
57
;-


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

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

386ad2de   Jean-Philippe Bernard   cant remeber what...
60
if isa((*!dustem_fit).fixed_param_descs) then begin 
dc84fd94   Ilyes Choubani   Small corrections...
61
;THIS IS USED TO ACCOUNT FOR THE FREEZING OF PLUGIN PARAMETERS
3c479f24   Ilyes Choubani   Allowing to fix p...
62
63
64

    ;concatenating the parameter vectors
    param_descs =  [(*(*!dustem_fit).param_descs),(*(*!dustem_fit).fixed_param_descs)]  
3c479f24   Ilyes Choubani   Allowing to fix p...
65
66
    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?
1bc09467   Ilyes Choubani   fixed issue with ...
67
    param_descs = param_descs(sort(param_descs))
3c479f24   Ilyes Choubani   Allowing to fix p...
68
69
70
71
72
73
        ;Taking care of the param_func vector
    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 
    
endif else begin
3c479f24   Ilyes Choubani   Allowing to fix p...
74
75
76
77
78
79
    param_descs = (*(*!dustem_fit).param_descs)
    param_values = p_dim
    param_func = (*(*!dustem_fit).param_func)

endelse

01612ee4   Ilyes Choubani   General update: I...
80
;PART WHERE THE PLUGINS RUN ACCORDING TO THEIR SCOPES. 
3c479f24   Ilyes Choubani   Allowing to fix p...
81

01612ee4   Ilyes Choubani   General update: I...
82
83
84
;normal (additive) plugins come first as they can be used by other plugins 
;The ISRF plugin is next - we can always change its scope however we please to. DustEm runs here. This is with the /dustem_run keyword. 
;The plugins that use the DustEM output come next - we can always change their 'common' scope 
0068116a   Ilyes Choubani   General update + ...
85

01612ee4   Ilyes Choubani   General update: I...
86
;IF /avoid is used the specified scopes are avoided. They're considered when /avoid is missing.
dc84fd94   Ilyes Choubani   Small corrections...
87
;using '**' so not to write the entire scope
07a51917   Ilyes Choubani   updating help sec...
88
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*STELLAR*','*REPLACE*','*ISRF*'], avoid=1
88872c38   Ilyes Choubani   small update. Cha...
89

2bbb56cf   Jean-Philippe Bernard   modified to fix b...
90
91
;=== The line below makes fawlty go Segmentation fault. st is undefined at that stage
;=== it would run fine if avoid was set to 1
88872c38   Ilyes Choubani   small update. Cha...
92
;IC: I think the segmentation fault comes from the fact that the user wants to use models that have the /pol keyword in the GRAIN.DAT file without being in polarization mode.
008ab3a3   Annie Hughes   unknown
93

2a8e29d5   Ilyes Choubani   small corrections...
94
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*STELLAR*','*ISRF*'] ,dustem_run=1,st=st ;dustem output is available at this step.
0068116a   Ilyes Choubani   General update + ...
95

07a51917   Ilyes Choubani   updating help sec...
96
97
;added this small condition to ensure that dustem is run
;(if no ISRF plugin is used)  
88872c38   Ilyes Choubani   small update. Cha...
98
99
100
101
102
; if ~isa(st) then begin
;     st=dustem_run(p_dim)
;     !dustem_current=ptr_new(st)
; endif
;THE ABOVE CONDITION IS UNNECESSARY SINCE DUSTEM IS CALLED ABOVE WHETHER PLUGINS ARE RUN OR NOT.
0068116a   Ilyes Choubani   General update + ...
103

91e991b5   Ilyes Choubani   Applying correcti...
104
dustem_run_plugins, p_dim ,param_descs, param_values, param_func, ['*REPLACE*']
0068116a   Ilyes Choubani   General update + ...
105
106


4750086c   Ilyes Choubani   nouvelle philosph...
107
the_end:
e7938fa3   Ilyes Choubani   Corrected02: Impl...
108

4750086c   Ilyes Choubani   nouvelle philosph...
109
END