Blame view

src/idl/dustem_init_fixed_params.pro 2.82 KB
abb4c515   Annie Hughes   fixed logical bug...
1
PRO dustem_init_fixed_params,fpd,fiv,help=help,clear=clear
427f1205   Jean-Michel Glorian   version 4.2 merged
2

041ca6b6   Annie Hughes   updated help
3
4
5
6
7
8
9
10
11
12
13
14
;+
; 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:
13213423   Annie Hughes   updated help
15
;    dustem_init_fixed_params, fpd, fiv
041ca6b6   Annie Hughes   updated help
16
17
;  
; INPUTS:
13213423   Annie Hughes   updated help
18
19
;    fpd -- the fixed parameter description vector
;    fiv -- the initial values of the fixed parameters 
041ca6b6   Annie Hughes   updated help
20
21
22
;
; OPTIONAL INPUT PARAMETERS:
;    
041ca6b6   Annie Hughes   updated help
23
24
25
26
27
28
29
; OUTPUTS:
;    None
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
041ca6b6   Annie Hughes   updated help
30
;    help      = if set, print this help
abb4c515   Annie Hughes   fixed logical bug...
31
;    clear     = if set, clear all existing fixed parameters
041ca6b6   Annie Hughes   updated help
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
;
; 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
427f1205   Jean-Michel Glorian   version 4.2 merged
60

abb4c515   Annie Hughes   fixed logical bug...
61
62
63
64
65
66
67
68
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

427f1205   Jean-Michel Glorian   version 4.2 merged
69
70
;Save the values of fit parameter descriptions and values
need_save=0
0e608856   Jean-Philippe Bernard   improved
71
;This routine will use (*!dustem_fit).param_descs)
13213423   Annie Hughes   updated help
72
;Therefore, if the variable already exists, its content is saved, and will be put back in place later
427f1205   Jean-Michel Glorian   version 4.2 merged
73
74
75
IF ptr_valid((*!dustem_fit).param_descs) THEN BEGIN
  pd=*(*!dustem_fit).param_descs
  iv=*(*!dustem_fit).param_init_values
be6b622d   Jean-Philippe Bernard   Trimmed unused co...
76
  ;find=*(*!dustem_fit).param_func
427f1205   Jean-Michel Glorian   version 4.2 merged
77
78
79
  need_save=1
ENDIF

abb4c515   Annie Hughes   fixed logical bug...
80
81
;TEMPORARILY put FPD and FIV into the regular parameter system
;variables. This allows us to the use the dustem_set_params routine
427f1205   Jean-Michel Glorian   version 4.2 merged
82
83
(*!dustem_fit).param_descs=ptr_new(fpd)
(*!dustem_fit).param_init_values=ptr_new(fiv)
be6b622d   Jean-Philippe Bernard   Trimmed unused co...
84
85
;Trimmed JPB on 08 March 2024
;dustem_set_func_ind,fpd,fiv
427f1205   Jean-Michel Glorian   version 4.2 merged
86
ind=where(fpd NE '',count)
607060e5   Ilyes Choubani   test version
87

3c479f24   Ilyes Choubani   Allowing to fix p...
88
;fixing the parameters
abb4c515   Annie Hughes   fixed logical bug...
89
IF count NE 0 THEN $
427f1205   Jean-Michel Glorian   version 4.2 merged
90
  dustem_set_params,[fiv]
427f1205   Jean-Michel Glorian   version 4.2 merged
91

0e608856   Jean-Philippe Bernard   improved
92
;set the fixed system variables, used to keep memory of the fixed
427f1205   Jean-Michel Glorian   version 4.2 merged
93
94
95
96
;parameters description and values
(*!dustem_fit).fixed_param_descs=ptr_new(fpd)
(*!dustem_fit).fixed_param_init_values=ptr_new(fiv)

0e608856   Jean-Philippe Bernard   improved
97
;put back in place fit parameter descriptions and values into system variables, if needed.
427f1205   Jean-Michel Glorian   version 4.2 merged
98
99
100
IF need_save EQ 1 THEN BEGIN
  (*!dustem_fit).param_descs=ptr_new(pd)
  (*!dustem_fit).param_init_values=ptr_new(iv)
be6b622d   Jean-Philippe Bernard   Trimmed unused co...
101
  ;(*!dustem_fit).param_func=ptr_new(find)
607060e5   Ilyes Choubani   test version
102
ENDIF 
abb4c515   Annie Hughes   fixed logical bug...
103
104
105
106
107
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 
607060e5   Ilyes Choubani   test version
108

041ca6b6   Annie Hughes   updated help
109
the_end:
427f1205   Jean-Michel Glorian   version 4.2 merged
110
END