dustem_get_param_values_default.pro
2.44 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
FUNCTION dustem_get_param_values_default,param_descs,param_current_values=param_current_values,verbose=verbose,help=help
;+
; NAME:
; dustem_get_param_values_default
; PURPOSE:
; returns the default values of dust model parameters for the model currently in use by dustemwrap
; CATEGORY:
; Dustem, Distributed, Mid-Level
; CALLING SEQUENCE:
; res=dustem_get_param_values_default(param_descs[,param_current_values=][,/verbose][,/help])
; INPUTS:
; param_descs = parameter description
; OPTIONAL INPUT PARAMETERS:
; None
; OUTPUTS:
; res: parameters default values
; OPTIONAL OUTPUT PARAMETERS:
; param_current_values : parameters current values
; ACCEPTED KEY-WORDS:
; help = If set, print this help
; verbose = If set, prints results
; COMMON BLOCKS:
; None
; SIDE EFFECTS:
; None
; RESTRICTIONS:
; The DustEM fortran code must be installed
; The DustEMWrap idl code must be installed
; dustem_init must have been run
; PROCEDURE:
; default parameter values are read using dustem_read_all.pro
; current parameter values are taken from !dustem_params
; EXAMPLES
; dustem_init,model='DBP90'
; res=dustem_get_param_values_default(/verbose,['(*!dustem_params).grains[0].MDUST_O_MH','(*!dustem_params).grains[1].MDUST_O_MH'],param_current_values=param_current_values)
; MODIFICATION HISTORY:
; Written by JPB Mai-2024
; 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_get_param_values_default'
param_default_values=0.
goto,the_end
ENDIF
use_param_descs=[param_descs]
Nparams=n_elements(use_param_descs)
;==== This reads the default parameter values into st_model
dir_in=!dustem_soft_dir
st_model=dustem_read_all(dir_in,/silent)
param_current_values=dblarr(Nparams)
param_default_values=dblarr(Nparams)
str_to_be_replaced='(*!dustem_params)'
str_to_replace='st_model'
FOR i=0L,Nparams-1 DO BEGIN
str='aa='+param_descs[i]
toto=execute(str)
param_current_values[i]=aa
str='aa='+textoidl_str_replace(param_descs[i],str_to_be_replaced,str_to_replace)
toto=execute(str)
param_default_values[i]=aa
ENDFOR
IF keyword_set(verbose) THEN BEGIN
message,'Default parameter values',/continue
FOR i=0L,Nparams-1 DO BEGIN
message,param_descs[i]+' current ='+strtrim(param_current_values[i],2)+' default ='+strtrim(param_default_values[i],2),/info
ENDFOR
ENDIF
the_end:
RETURN,param_default_values
END