dustem_init_fixed_params.pro
2.82 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
PRO dustem_init_fixed_params,fpd,fiv,help=help,clear=clear
;+
; NAME:
; dustem_init_fixed_params
;
; PURPOSE:
; This routine updates the fixed parameters of both the
; dust models and plugins in the input files
;
; CATEGORY:
; DustEMWrap, Distributed, Low-Level, Initialization
;
; CALLING SEQUENCE:
; dustem_init_fixed_params, fpd, fiv
;
; INPUTS:
; fpd -- the fixed parameter description vector
; fiv -- the initial values of the fixed parameters
;
; OPTIONAL INPUT PARAMETERS:
;
; OUTPUTS:
; None
;
; OPTIONAL OUTPUT PARAMETERS:
; None
;
; ACCEPTED KEY-WORDS:
; help = if set, print this help
; clear = if set, clear all existing fixed parameters
;
; 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:
; dustem_init_parinfo
; dustem_init_plugins
; dustem_init_fixed_params
;
; EXAMPLES
;
; MODIFICATION HISTORY:
; Written by AH October-2022
; 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_init_fixed_params'
goto,the_end
END
if keyword_set(clear) then begin
; message,'Clearing the fixed parameters',/info
; stop
(*!dustem_fit).fixed_param_descs=ptr_new()
(*!dustem_fit).fixed_param_init_values=ptr_new()
goto,the_end
end
;Save the values of fit parameter descriptions and values
need_save=0
;This routine will use (*!dustem_fit).param_descs)
;Therefore, if the variable already exists, its content is saved, and will be put back in place later
IF ptr_valid((*!dustem_fit).param_descs) THEN BEGIN
pd=*(*!dustem_fit).param_descs
iv=*(*!dustem_fit).param_init_values
;find=*(*!dustem_fit).param_func
need_save=1
ENDIF
;TEMPORARILY put FPD and FIV into the regular parameter system
;variables. This allows us to the use the dustem_set_params routine
(*!dustem_fit).param_descs=ptr_new(fpd)
(*!dustem_fit).param_init_values=ptr_new(fiv)
;Trimmed JPB on 08 March 2024
;dustem_set_func_ind,fpd,fiv
ind=where(fpd NE '',count)
;fixing the parameters
IF count NE 0 THEN $
dustem_set_params,[fiv]
;set the fixed system variables, used to keep memory of the fixed
;parameters description and values
(*!dustem_fit).fixed_param_descs=ptr_new(fpd)
(*!dustem_fit).fixed_param_init_values=ptr_new(fiv)
;put back in place fit parameter descriptions and values into system variables, if needed.
IF need_save EQ 1 THEN BEGIN
(*!dustem_fit).param_descs=ptr_new(pd)
(*!dustem_fit).param_init_values=ptr_new(iv)
;(*!dustem_fit).param_func=ptr_new(find)
ENDIF
IF need_save EQ 0 THEN BEGIN
(*!dustem_fit).param_descs=ptr_new()
(*!dustem_fit).param_init_values=ptr_new()
;(*!dustem_fit).param_func=ptr_new(find)
ENDIF
the_end:
END