dustem_init_fixed_params.pro 1.15 KB
PRO dustem_init_fixed_params,fpd,fiv;,func_ind

;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
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_set_params,[fiv]
ENDIF

;set the !fixed system varibles, 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 fit parameter descriptions and values into system variables
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