dustem_print_params.pro 4.47 KB
PRO dustem_print_params,bidon,verbose=verbose

;help,!dustem_params,/str
;** Structure <5f85ea08>, 14 tags, length=5672, data length=5652, refs=1:
;   NGRAINS         LONG                 3
;   G0              FLOAT       1.00000e+07
;   KEYWORDS        STRING    'quiet sdist zdistf tempf'
;   GRAINS          STRUCT    -> <Anonymous> Array[3]
;   ISRF            STRUCT    -> <Anonymous> Array[200]
;   QABS            POINTER   Array[3]
;   CALOR           POINTER   Array[3]
;   LAMBDA          STRUCT    -> <Anonymous> Array[800]
;   SIZE            POINTER   Array[3]
;   MIX             POINTER   Array[3]
;   CHRG            POINTER   Array[3]
;   GAS             STRUCT    -> <Anonymous> Array[1]
;   SPIN            POINTER   Array[3]
;   TLS             STRUCT    -> <Anonymous> Array[3]

;help,*!dustem_fit,/str
;** Structure <689050c8>, 13 tags, length=80, data length=76, refs=1:
;   DATA            POINTER   <NullPointer>
;   PARAM_DESCS     POINTER   <PtrHeapVar4567>
;   PARAM_INIT_VALUES
;                   POINTER   <PtrHeapVar4568>
;   FIXED_PARAM_DESCS
;                   POINTER   <PtrHeapVar4547>
;   FIXED_PARAM_INIT_VALUES
;                   POINTER   <PtrHeapVar4548>
;   CHI2            DOUBLE           0.0000000
;   RCHI2           DOUBLE           0.0000000
;   QCHI2           DOUBLE           0.0000000
;   QRCHI2          DOUBLE           0.0000000
;   UCHI2           DOUBLE           0.0000000
;   URCHI2          DOUBLE           0.0000000
;   CURRENT_PARAM_VALUES
;                   POINTER   <PtrHeapVar4569>
;   CURRENT_PARAM_ERRORS
;                   POINTER   <NullPointer>


;help,*!dustem_parinfo,/str
;** Structure <6890d878>, 9 tags, length=80, data length=72, refs=1:
;   VALUE           DOUBLE           1.0000000
;   FIXED           INT              0
;   LIMITED         INT       Array[2]
;   LIMITS          DOUBLE    Array[2]
;   PARNAME         STRING    '(*!dustem_params).G0'
;   RELSTEP         FLOAT           0.00000
;   STEP            FLOAT           0.00000
;   MPSIDE          INT              0
;   TIED            STRING    '       0'

message,'=================================================',/info

;stop


message,'======= content of !dustem_fit:',/continue
;=== make a structure for a noce display
N_variable_par=n_elements(*(*!dustem_fit).param_descs)
IF ptr_valid((*!dustem_fit).fixed_param_descs) THEN BEGIN
	N_fixed_par=n_elements(*(*!dustem_fit).fixed_param_descs)
ENDIF ELSE BEGIN
	N_fixed_par=0
ENDELSE
Npar=N_variable_par+N_fixed_par
one_st={Parameter_name:'',Parameter_init_value:0.D0,Parameter_fixed:0L,status:'',Parameter_fortran_value:la_undef(5)}
st=replicate(one_st,Npar)

status_params=strarr(N_variable_par)
IF N_fixed_par NE 0 THEN BEGIN
	status_fixed_params=strarr(N_fixed_par)
	fortran_fixed_values=dblarr(N_fixed_par)+la_undef(5)
ENDIF
fortran_values=dblarr(N_variable_par)+la_undef(5)
FOR i=0L,N_variable_par-1 DO BEGIN
	status_params[i]=dustem_parameter_description2type((*(*!dustem_fit).param_descs)[i],string_name=string_name)
	IF status_params[i] EQ 'FORTRAN' THEN BEGIN
		str='fortran_values[i]='+(*(*!dustem_fit).param_descs)[i]
		IF keyword_set(verbose) THEN message,'executing '+str,/continue
		toto=execute(str)
	ENDIF
ENDFOR
FOR i=0L,N_fixed_par-1 DO BEGIN
	status_fixed_params[i]=dustem_parameter_description2type((*(*!dustem_fit).fixed_param_descs)[i],string_name=string_name)
	IF status_fixed_params[i] EQ 'FORTRAN' THEN BEGIN
		str='fortran_fixed_values[i]='+(*(*!dustem_fit).fixed_param_descs)[i]
		IF keyword_set(verbose) THEN message,'executing '+str,/continue
		toto=execute(str)
	ENDIF
ENDFOR

;stop

st[0:N_variable_par-1].Parameter_name=*(*!dustem_fit).param_descs
st[0:N_variable_par-1].Parameter_init_value=*(*!dustem_fit).param_init_values
st[0:N_variable_par-1].Parameter_fixed=0
st[0:N_variable_par-1].status=status_params
st[0:N_variable_par-1].Parameter_fortran_value=fortran_values
IF N_fixed_par NE 0 THEN BEGIN
	st[N_variable_par:Npar-1].Parameter_name=*(*!dustem_fit).fixed_param_descs
	st[N_variable_par:Npar-1].Parameter_init_value=*(*!dustem_fit).fixed_param_init_values
	st[N_variable_par:Npar-1].Parameter_fixed=1
	st[N_variable_par:Npar-1].status=status_fixed_params
	st[N_variable_par:Npar-1].Parameter_fortran_value=fortran_fixed_values
ENDIF

write_xcat,st,'/tmp/bidon.xcat'

;message,'======= content of !dustem_parinfo:',/continue
;Npar=n_elements(*!dustem_parinfo)
;FOR i=0L,Npar-1 DO BEGIN
;	print,(*!dustem_parinfo)[i].parname,(*!dustem_parinfo)[i].value
;ENDFOR

message,'=================================================',/info

END