Blame view

src/idl/dustem_set_params.pro 3.66 KB
427f1205   Jean-Michel Glorian   version 4.2 merged
1
2
3
PRO dustem_set_params,params

;if empty description, do nothing
68d2f391   Jean-Philippe Bernard   modified to cope ...
4
5
6
7
8
9
ind=where(*(*!dustem_fit).param_descs EQ '',count)
IF count EQ n_elements(*(*!dustem_fit).param_descs) THEN BEGIN
  message,'param_descs not set. Doing nothing',/continue
  stop
  goto,the_end
ENDIF
427f1205   Jean-Michel Glorian   version 4.2 merged
10
11
12
13
14

Nparams=n_elements(*(*!dustem_fit).param_descs)

dustem_set_func_ind,*(*!dustem_fit).param_descs,params

4750086c   Ilyes Choubani   nouvelle philosph...
15

427f1205   Jean-Michel Glorian   version 4.2 merged
16
17
;SET THE PARAMETER VALUES IN DUSTEM INPUT FILES
FOR i=0L,Nparams-1 DO BEGIN
0e608856   Jean-Philippe Bernard   improved
18
19
20
21
22
23
24
25
26
   status=dustem_parameter_description2type((*(*!dustem_fit).param_descs)[i],string_name=string_name)
   IF !dustem_verbose THEN message,(*(*!dustem_fit).param_descs)[i]+' is '+status,/continue
   CASE status OF
    'WRAPPER': BEGIN
        str=(*(*!dustem_fit).param_descs)(i)+'=params[i]'
        toto=execute(str)
        IF !dustem_verbose NE 0 THEN message,str,/info
    END
    'FORTRAN': BEGIN
4fd64cbb   Ilyes Choubani   dustem_fit_sed_po...
27
        str=(*(*!dustem_fit).param_descs)(i)+'=params[i]';'=params['+strtrim(string(i),2)+']'
0e608856   Jean-Philippe Bernard   improved
28
29
30
31
        toto=execute(str)
        IF !dustem_verbose NE 0 THEN message,str,/info
    END
    'PLUGIN': BEGIN
4fd64cbb   Ilyes Choubani   dustem_fit_sed_po...
32

607060e5   Ilyes Choubani   test version
33
        ;IF !dustem_verbose NE 0 THEN message,str,/info
4fd64cbb   Ilyes Choubani   dustem_fit_sed_po...
34
        ;length=strlen((*(*!dustem_fit).param_descs)(i))
452c334e   Ilyes Choubani   Implementation Of...
35
        
4750086c   Ilyes Choubani   nouvelle philosph...
36
37
38
39
        strr = strmid((*(*!dustem_fit).param_descs)(i),14)
        ii = strsplit(strr,'_',count=countd) & ii = ii(countd-1)-1
        strr = strmid(strr,0,ii)
        
452c334e   Ilyes Choubani   Implementation Of...
40
41
        
        k=where(tag_names(*!dustem_scope) eq strupcase(strr), countt)
452c334e   Ilyes Choubani   Implementation Of...
42
        
4750086c   Ilyes Choubani   nouvelle philosph...
43
44
        ;is countt=countt(0) a solution to the error that JP had? 
        
4750086c   Ilyes Choubani   nouvelle philosph...
45
                  
452c334e   Ilyes Choubani   Implementation Of...
46
47
          IF countt EQ 0 THEN BEGIN
          
4750086c   Ilyes Choubani   nouvelle philosph...
48
49
50
51
          ; I DO NOT THINK THE ISRF TREATMENT IS NEEDED HERE AS THE PROCEDURE
          ; 'dustem_create_isrf.pro' IS NOWHERE TO BE FOUND IN THE NEW DUSTEM_WRAPPER VERSION
          
          IF strr eq 'isrf2' then strr = 'isrf' 
0e608856   Jean-Philippe Bernard   improved
52
53
54
55
56
57
          IF !dustem_which EQ 'VERSTRAETE' THEN BEGIN
            ddir=!dustem_dat+'les_DAT/'
          ENDIF ELSE BEGIN
            ddir=!dustem_dat
          ENDELSE
;         JPB: Caution this line reads ISRF.DAT through an execute statement
4750086c   Ilyes Choubani   nouvelle philosph...
58
          IF strr eq 'isrf' then begin
0e608856   Jean-Philippe Bernard   improved
59
60
61
62
63
64
          str='(*!dustem_params).'+strr+'=dustem_read_'+strr+'('+"'"+ddir+strupcase(strr)+'.DAT'+"'"+',/silent)'
          toto=execute(str)
          IF toto NE 1 then BEGIN
            message,'Could not execute ',str
          ENDIF
          IF !dustem_verbose NE 0 THEN message,str,/info
4750086c   Ilyes Choubani   nouvelle philosph...
65
          ENDIF      
0e608856   Jean-Philippe Bernard   improved
66
        ENDIF
4750086c   Ilyes Choubani   nouvelle philosph...
67
        
0e608856   Jean-Philippe Bernard   improved
68
69
    END
   ENDCASE
4fd64cbb   Ilyes Choubani   dustem_fit_sed_po...
70
71
72



4750086c   Ilyes Choubani   nouvelle philosph...
73
74
   ;goto,jump_this
   
0e608856   Jean-Philippe Bernard   improved
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
;    IF (*(*!dustem_fit).param_func)(i) EQ 0 THEN BEGIN ;set parameters which are not for functions
;      str=(*(*!dustem_fit).param_descs)(i)+'=params(i)'
;      toto=execute(str)
;      ;print,params[i]
;      IF !dustem_verbose NE 0 THEN message,str,/info
;    ENDIF ELSE BEGIN ;set parameters which are for functions
;      length=strlen((*(*!dustem_fit).param_descs)(i))
;      strr=strmid((*(*!dustem_fit).param_descs)(i),14,length-16)
; ;     stop
;      IF strr NE 'continuum' AND strr NE 'freefree' AND strr NE 'synchrotron' THEN BEGIN   ;This is not very clean programming ....
;        IF strr eq 'isrf2' then strr = 'isrf'
;        IF !dustem_which EQ 'VERSTRAETE' THEN BEGIN
;          ddir=!dustem_dat+'les_DAT/'
;        ENDIF ELSE BEGIN
;          ddir=!dustem_dat
;        ENDELSE
; ;      JPB: Caution this line reads ISRF.DAT through an execute statement
;        str='(*!dustem_params).'+strr+'=dustem_read_'+strr+'('+"'"+ddir+strupcase(strr)+'.DAT'+"'"+',/silent)'
;        toto=execute(str)
;        IF toto NE 1 then BEGIN
;          message,'Could not execute ',str
;        ENDIF
;        IF !dustem_verbose NE 0 THEN message,str,/info
;      ENDIF
;   ENDELSE
4750086c   Ilyes Choubani   nouvelle philosph...
100
;  jump_this:
427f1205   Jean-Michel Glorian   version 4.2 merged
101
ENDFOR
68d2f391   Jean-Philippe Bernard   modified to cope ...
102

0e608856   Jean-Philippe Bernard   improved
103
104
;stop

427f1205   Jean-Michel Glorian   version 4.2 merged
105
106
107
108
109
dustem_write_all,*!dustem_params,!dustem_dat

the_end:

END