dustem_save_sed_fit.pro 2.21 KB
PRO dustem_save_sed_fit,file,help=help

;+
; NAME:
;    dustem_save_sed_fit
; PURPOSE:
;    Save Dustem SED fit results in a file
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    dustem_save_sed_fit,file[,/help]
; INPUTS:
;    file      = File name
; OPTIONAL INPUT PARAMETERS:
;    None
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    File is stored.
;    The stored data are taken from !dustem_fit, !dustem_data,
;    !dustem_filters, !dustem_verbose and !run_ionfrac
; RESTRICTIONS:
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; EXAMPLES
;    
; MODIFICATION HISTORY:
;    Written by J.-Ph. Bernard
;    see evolution details on the dustem cvs maintained at CESR
;    Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems.
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_save_sed_fit'
  goto,the_end
ENDIF

;stop
;Save results of a SED fit into a save set.

;dustem_fit_sed=*!dustem_fit_sed
param_desc=*(*!dustem_fit).param_descs
init_value=*(*!dustem_fit).param_init_values

IF ptr_valid((*!dustem_fit).fixed_param_descs) THEN BEGIN
  fixed_param_desc=*(*!dustem_fit).fixed_param_descs
ENDIF ELSE BEGIN
  fixed_param_desc=!indef
ENDELSE
IF ptr_valid((*!dustem_fit).fixed_param_init_values) THEN BEGIN
  fixed_init_value=*(*!dustem_fit).fixed_param_init_values
ENDIF ELSE BEGIN
  fixed_init_value=!indef
ENDELSE
dustem_fit_chi2=(*!dustem_fit).chi2
dustem_fit_rchi2=(*!dustem_fit).rchi2
dfp=*(*!dustem_fit).current_param_values
func_ind=*(*!dustem_fit).param_func
run_ionfrac=!run_ionfrac
;VGb: dustem_data is now a structure containing sed, ext, polext
;dustem_data=*!dustem_data
dustem_data=!dustem_data
;VGe
dustem_filters=*!dustem_filters
dustem_verbose=!dustem_verbose
errors=*(*!dustem_fit).current_param_errors
;Modified JPB on Jul 9th 2010 because ext not recorded anymore.
;extinction=*!dustem_ext

save,param_desc,init_value,fixed_param_desc,fixed_init_value, $
     dustem_fit_chi2,dustem_fit_rchi2,dfp,func_ind, $
     ;lambda_sed, $
     run_ionfrac, $
     dustem_data,dustem_filters,dustem_verbose,errors, $
;     dustem_fit_sed, $
     file=file

the_end:

END