dustem_init_fixed_params.pro 1.49 KB
PRO dustem_init_fixed_params,fpd,fiv

;This routine is used to update the model input files with fixed
;parameters

;Save the values of fit parameter descriptions and values
need_save=0
;stop
;toto=dustem_parameter_description2type(fpd[0],string_name=string_name)

;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
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)


IF count NE 0 THEN BEGIN
  dustem_set_params,[fiv]
  ;dustem_create_functions,[fiv]/(*(*!dustem_fit).param_init_values)
  ;dustem_init_plugins,fpd
  dustem_activate_plugins,[fiv]/(*(*!dustem_fit).param_init_values)
  ;dustem_set_params,[fiv]
ENDIF


;set the fixed system variables, used to keep memory of the fixed
;parameters description and values
(*!dustem_fit).fixed_param_descs=ptr_new(fpd)
(*!dustem_fit).fixed_param_init_values=ptr_new(fiv)


;put back in place fit parameter descriptions and values into system variables, if needed.
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)
ENDIF 




END