Blame view

src/idl/dustem_init_parinfo.pro 2.94 KB
427f1205   Jean-Michel Glorian   version 4.2 merged
1
2
3
4
5
PRO dustem_init_parinfo,pd,iv, $
                        fixed=fixed,tied=tied, $
                        up_limited=up_limited,lo_limited=lo_limited,up_limits=up_limits,lo_limits=lo_limits, $
                        relstep=relstep,step=step

3b575d69   Annie Hughes   added empty help
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
;+
; NAME:
;    dustem_init_parinfo
;
; PURPOSE:
;
; CATEGORY:
;    DustEMWrap, Distributed, Low-Level, Initialization
;
; CALLING SEQUENCE:
;    dustem_init_parinfo
;  
; INPUTS:
;
; OPTIONAL INPUT PARAMETERS:
;
; OUTPUTS:
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
;
; COMMON BLOCKS:
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;    
; EXAMPLES
;
; MODIFICATION HISTORY:
;    Written by 
;    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_parinfo'
  goto,the_end
END


b5ccb706   Jean-Philippe Bernard   improved to fit p...
52
(*!dustem_fit).param_descs=ptr_new(pd)
452c334e   Ilyes Choubani   Implementation Of...
53

b5ccb706   Jean-Philippe Bernard   improved to fit p...
54
(*!dustem_fit).param_init_values=ptr_new(iv)
4b745987   Ilyes Choubani   minor update
55

e52e8a3e   Jean-Philippe Bernard   improved
56
(*!dustem_fit).current_param_values = ptr_new(iv/iv)  ;These are normalized to the initial values  
b5ccb706   Jean-Philippe Bernard   improved to fit p...
57
;stop
427f1205   Jean-Michel Glorian   version 4.2 merged
58
59
60
dustem_set_func_ind,pd,iv


ef1e3d9d   Annie Hughes   corrections for TLS
61
one_parinfo={value:0.D0, fixed:0, limited:[0,0], limits:[0.D0,0], parname:'', relstep:0., step:0.0, mpside:0, tied:''}
427f1205   Jean-Michel Glorian   version 4.2 merged
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Npar=n_elements(pd)
dustem_parinfo=replicate(one_parinfo,Npar)
FOR i=0L,Npar-1 DO BEGIN
;  dustem_parinfo[i].value=iv(i)/(*!init_value)(i)
  dustem_parinfo[i].value=iv(i)/(*(*!dustem_fit).param_init_values)(i)
  IF keyword_set(fixed) THEN dustem_parinfo[i].fixed=fixed[i]
  dustem_parinfo[i].limited[0]=0
  dustem_parinfo[i].limited[1]=0
  dustem_parinfo[i].limits[0]=0.
  dustem_parinfo[i].limits[1]=0.
  dustem_parinfo[i].parname=pd[i]
  IF keyword_set(relstep) THEN dustem_parinfo[i].relstep=relstep[i]
  IF keyword_set(step) THEN dustem_parinfo[i].step=step[i]
  dustem_parinfo[i].mpside=0
  IF keyword_set(tied) THEN dustem_parinfo[i].tied=tied[i]
ENDFOR

IF keyword_set(up_limited) THEN BEGIN
  ind=where(up_limited EQ 1,countup)
  IF countup EQ 0 THEN goto,suite1
  IF NOT keyword_set(up_limits) THEN BEGIN
5c25cf19   Annie Hughes   removed stops
83
    message,'upper limits must be provided with up_limited',/info
427f1205   Jean-Michel Glorian   version 4.2 merged
84
85
86
87
88
89
90
91
92
93
94
    stop
  ENDIF
  IF countup NE 0 THEN BEGIN
    FOR i=0L,countup-1 DO BEGIN
      dustem_parinfo[ind(i)].limited[1]=1
      dustem_parinfo[ind(i)].limits[1]=up_limits[ind(i)]/(*(*!dustem_fit).param_init_values)(ind(i))
    ENDFOR
  ENDIF
ENDIF
suite1:
IF keyword_set(lo_limited) THEN BEGIN
3b575d69   Annie Hughes   added empty help
95
96
97
98
99
100
101
102
103
104
105
106
   ind=where(lo_limited EQ 1,countlo)
   IF countlo EQ 0 THEN goto,suite2
   IF NOT keyword_set(lo_limits) THEN BEGIN
      message,'lower limits must be provided with lo_limited', /info
      stop
   ENDIF
   IF countlo NE 0 THEN BEGIN
      FOR i=0L,countlo-1 DO BEGIN
         dustem_parinfo[ind(i)].limited[0]=1
         dustem_parinfo[ind(i)].limits[0]=lo_limits[ind(i)]/(*(*!dustem_fit).param_init_values)(ind(i))
      ENDFOR
   ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
107
108
109
110
ENDIF
suite2:

defsysv,'!dustem_parinfo',ptr_new(dustem_parinfo)
ef1e3d9d   Annie Hughes   corrections for TLS
111

266ae799   Ilyes Choubani   General update
112
;stop
3b575d69   Annie Hughes   added empty help
113
the_end:
427f1205   Jean-Michel Glorian   version 4.2 merged
114
END