dustem_set_params.pro
2.37 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
PRO dustem_set_params,params,help=help
;+
; NAME:
; dustem_set_params
;
; PURPOSE:
; Initialise the *!dustem_fit system variable with the free
; parameters used in the fit and their general handling by DustEMWrap.
;
; CATEGORY:
; DustEMWrap, Mid-Level, Distributed, Initialization
;
; CALLING SEQUENCE:
; dustem_set_params,params[,/help]
;
; INPUTS:
; params -- free parameters to be used in the fit
;
; OPTIONAL INPUT PARAMETERS:
;
; OUTPUTS:
; None
;
; OPTIONAL OUTPUT PARAMETERS:
; None
;
; ACCEPTED KEY-WORDS:
; help = If set print this help
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
; initializes information in !dustem_fit
;
; RESTRICTIONS:
; The DustEMWrap IDL code must be installed
;
; PROCEDURE:
; None
;
; EXAMPLES
;
; MODIFICATION HISTORY:
; Written by J.-Ph. Bernard 2007
; 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_set_params'
goto,the_end
ENDIF
;if empty description, do nothing
ind=where(*(*!dustem_fit).param_descs EQ '',count)
IF count EQ n_elements(*(*!dustem_fit).param_descs) THEN BEGIN
message,'param_descs not set. Doing nothing',/continue
stop
goto,the_end
ENDIF
;stop
Nparams=n_elements(*(*!dustem_fit).param_descs)
IF n_elements(params) NE Nparams THEN BEGIN
message,'Inconsistent number of parameters passed',/info
stop
ENDIF
;Trimmed JPB on 08 March 2024
;dustem_set_func_ind,*(*!dustem_fit).param_descs,params
;SET THE PARAMETER VALUES IN DUSTEM INPUT FILES
FOR i=0L,Nparams-1 DO BEGIN
status=dustem_parameter_description2type((*(*!dustem_fit).param_descs)[i],string_name=string_name)
IF !dustem_verbose THEN BEGIN
message,(*(*!dustem_fit).param_descs)[i]+' is '+status,/continue
ENDIF
CASE status OF
'WRAPPER': BEGIN
str=(*(*!dustem_fit).param_descs)(i)+'=params[i]'
toto=execute(str)
IF !dustem_verbose NE 0 THEN message,str,/info
END
'FORTRAN': BEGIN
str=(*(*!dustem_fit).param_descs)(i)+'=params[i]';'=params['+strtrim(string(i),2)+']'
toto=execute(str)
IF !dustem_verbose NE 0 THEN message,str,/info
END
'PLUGIN': BEGIN
;Not to be used for the moment.
END
ENDCASE
ENDFOR
;==== This writes the input files for the fortran
dustem_write_all,*!dustem_params,!dustem_dat
the_end:
END