Blame view

src/idl/dustem_set_params.pro 2.37 KB
041ca6b6   Annie Hughes   updated help
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
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
427f1205   Jean-Michel Glorian   version 4.2 merged
55
56

;if empty description, do nothing
68d2f391   Jean-Philippe Bernard   modified to cope ...
57
58
59
60
61
62
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
427f1205   Jean-Michel Glorian   version 4.2 merged
63

d339db1c   Jean-Philippe Bernard   improved
64
;stop
427f1205   Jean-Michel Glorian   version 4.2 merged
65
Nparams=n_elements(*(*!dustem_fit).param_descs)
d339db1c   Jean-Philippe Bernard   improved
66
67
68
69
IF n_elements(params) NE Nparams THEN BEGIN
    message,'Inconsistent number of parameters passed',/info
    stop
ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
70

be6b622d   Jean-Philippe Bernard   Trimmed unused co...
71
72
;Trimmed JPB on 08 March 2024
;dustem_set_func_ind,*(*!dustem_fit).param_descs,params
427f1205   Jean-Michel Glorian   version 4.2 merged
73

427f1205   Jean-Michel Glorian   version 4.2 merged
74
75
;SET THE PARAMETER VALUES IN DUSTEM INPUT FILES
FOR i=0L,Nparams-1 DO BEGIN
5f04fa07   Ilyes Choubani   general update
76
    
0e608856   Jean-Philippe Bernard   improved
77
   status=dustem_parameter_description2type((*(*!dustem_fit).param_descs)[i],string_name=string_name)
dd194767   Jean-Philippe Bernard   removed some prints
78
79
80
   IF !dustem_verbose THEN BEGIN
        message,(*(*!dustem_fit).param_descs)[i]+' is '+status,/continue
   ENDIF
5f04fa07   Ilyes Choubani   general update
81
   
0e608856   Jean-Philippe Bernard   improved
82
83
84
85
86
87
88
   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
4fd64cbb   Ilyes Choubani   dustem_fit_sed_po...
89
        str=(*(*!dustem_fit).param_descs)(i)+'=params[i]';'=params['+strtrim(string(i),2)+']'
0e608856   Jean-Philippe Bernard   improved
90
91
92
        toto=execute(str)
        IF !dustem_verbose NE 0 THEN message,str,/info
    END
0068116a   Ilyes Choubani   General update + ...
93
94
95
96
    'PLUGIN': BEGIN 
    
    ;Not to be used for the moment.
    
0e608856   Jean-Philippe Bernard   improved
97
98
    END
   ENDCASE
427f1205   Jean-Michel Glorian   version 4.2 merged
99
ENDFOR
68d2f391   Jean-Philippe Bernard   modified to cope ...
100

d339db1c   Jean-Philippe Bernard   improved
101
;==== This writes the input files for the fortran
427f1205   Jean-Michel Glorian   version 4.2 merged
102
dustem_write_all,*!dustem_params,!dustem_dat
25a9c7a2   Ilyes Choubani   removing stops
103

427f1205   Jean-Michel Glorian   version 4.2 merged
104
105
106
the_end:

END