Blame view

src/idl/dustem_init_fixed_params.pro 3.14 KB
0e608856   Jean-Philippe Bernard   improved
1
PRO dustem_init_fixed_params,fpd,fiv
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
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
;+
; 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_params, pd, iv, [,fpd=fpd,fiv=fiv,ulimed=ulimed,llimed=llimed,ulims=ulims,lolims=llims,tied=tied,fixed=fixed]
;  
; INPUTS:
;    model -- the dust model
;    pd -- the parameter description vector
;    iv -- the initial values of the free parameters 
;
; OPTIONAL INPUT PARAMETERS:
;    
;
; OUTPUTS:
;    None
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
;    model = specifies the interstellar dust mixture used by DustEM
;           'MC10' model from Compiegne et al 2010 (default)
;           'DBP90' model from Desert et al 1990
;           'DL01' model from Draine & Li 2001
;           'WD01_RV5p5B' model from Weingartner & Draine 2002 with Rv=5.5
;           'DL07' model from Draine & Li 2007
;           'J13' model from Jones et al 2013, as updated in
;                 Koehler et al 2014
;           'G17_ModelA' model A from Guillet et al (2018). Includes
;                 polarisation. See Tables 2 and 3 of that paper for details.
;           'G17_ModelB' model B from Guillet et al (2018)
;           'G17_ModelC' model C from Guillet et al (2018)
;           'G17_ModelD' model A from Guillet et al (2018)
;    help      = if set, print this help
;
; 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
74
75
76

;Save the values of fit parameter descriptions and values
need_save=0
0e608856   Jean-Philippe Bernard   improved
77
78
79

;This routine will use (*!dustem_fit).param_descs)
;Therefore, if the variable already exists, it's content is saved, and will be put back in place later
427f1205   Jean-Michel Glorian   version 4.2 merged
80
81
82
83
84
85
86
87
88
89
90
91
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 use the regular parameter system variables to update
(*!dustem_fit).param_descs=ptr_new(fpd)
(*!dustem_fit).param_init_values=ptr_new(fiv)
dustem_set_func_ind,fpd,fiv
ind=where(fpd NE '',count)
607060e5   Ilyes Choubani   test version
92

3c479f24   Ilyes Choubani   Allowing to fix p...
93
;fixing the parameters
427f1205   Jean-Michel Glorian   version 4.2 merged
94
95
IF count NE 0 THEN BEGIN
  dustem_set_params,[fiv]
427f1205   Jean-Michel Glorian   version 4.2 merged
96
97
ENDIF

0e608856   Jean-Philippe Bernard   improved
98
;set the fixed system variables, used to keep memory of the fixed
427f1205   Jean-Michel Glorian   version 4.2 merged
99
100
101
102
;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
103
;put back in place fit parameter descriptions and values into system variables, if needed.
427f1205   Jean-Michel Glorian   version 4.2 merged
104
105
106
107
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)
607060e5   Ilyes Choubani   test version
108
109
ENDIF 

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