FUNCTION dustem_make_fits_predicted_ext ,syst_var $ ,dustem_predicted_ext $ ,str_input_ext=str_input_ext $ ,dustem_predicted_Qext=dustem_predicted_Qext, $ ,dustem_predicted_Uext=dustem_predicted_Uext, $ ,help=help ;+ ; NAME: ; dustem_make_fits_predicted_ext ; PURPOSE: ; extracts dustemwrap predicted extinction SED from dustem system variable syst_var, to be put into fits files ; CATEGORY: ; DustEMWrap, Distributed, High-Level, User Convenience ; CALLING SEQUENCE: ; str_predicted_EXT=dustem_make_fits_predicted_ext(syst_var,dustem_predicted_ext[,str_input_ext=]) ; see dustem_write_fits_table.pro ; INPUTS: ; syst_var : dustem system variable (*!dustem_data or *!dustem_show) ; dustem_predicted_ext : dustemwrap predicted extinction SED as output by dustem_compute_ext.pro ; OPTIONAL INPUT PARAMETERS: ; dustem_predicted_Qext : Stokes Q extinction SED ; dustem_predicted_Uext : Stokes U extinction SED ; OUTPUTS: ; str_predicted_EXT : dustemwrap predicted extinction SED as used to store into fits file ; OPTIONAL OUTPUT PARAMETERS: ; str_input_ext : dustem wrap input extinction SED ; ACCEPTED KEY-WORDS: ; help = If set, print this help ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; None ; RESTRICTIONS: ; The DustEMWrap IDL code must be installed ; PROCEDURE: ; None ; EXAMPLES: ; str_predicted_EXT=dustem_make_fits_predicted_ext(*!dustem_data,dustem_predicted_ext,str_input_ext=str_input_ext) ; MODIFICATION HISTORY: ; Written by J.-Ph. Bernard Dec 2022 ; Evolution details on the DustEMWrap gitlab. ; See http://dustemwrap.irap.omp.eu/ for FAQ and help. ;- IF keyword_set(help) THEN BEGIN doc_library,'dustem_make_fits_predicted_ext' str_predicted_SED=-1 goto,the_end ENDIF ;===== define structures containing results one_str_input_EXT={FILTER:'',Wavelength:la_undef(4),I:la_undef(5),Q:la_undef(5),U:la_undef(5),varianceII:la_undef(5),varianceQQ:la_undef(5),varianceUU:la_undef(5)} one_str_predicted_EXT={FILTER:'',Wavelength:la_undef(4),I:la_undef(5),Q:la_undef(5),U:la_undef(5)} Next=n_elements((*syst_var.ext).filt_names) str_input_EXT=replicate(one_str_input_EXT,Next) str_input_EXT.FILTER=(*syst_var.ext).filt_names str_input_EXT.Wavelength=(*syst_var.ext).wav str_input_EXT.I=(*syst_var.ext).values str_input_EXT.varianceII=la_power((*syst_var.ext).sigma,2.) ;N_predicted_ext=n_elements(dustem_predicted_polext[0]) N_predicted_ext=n_elements(dustem_predicted_ext) str_predicted_EXT=replicate(one_str_predicted_EXT,N_predicted_EXT) fully_undefined_ext=str_predicted_ext IF N_predicted_ext NE Next THEN BEGIN ;This is for cases when the extinction data to fit did not have the dimension of computed extinction curve message,'I have a problem with dimensions ...',/continue stop ENDIF ELSE BEGIN str_predicted_EXT.FILTER=(*syst_var.ext).filt_names ;taken from input SED str_predicted_EXT.Wavelength=(*syst_var.ext).wav ;taken from input SED str_predicted_EXT.I=dustem_predicted_ext ENDELSE ;stop IF !run_pol THEN BEGIN str_predicted_EXT.Q=interpol(dustem_predicted_Qext,(*syst_var.qext).wav,(*syst_var.ext).wav) str_predicted_EXT.U=interpol(dustem_predicted_Uext,(*syst_var.uext).wav,(*syst_var.ext).wav) ENDIF ELSE BEGIN str_predicted_EXT.Q=fully_undefined_ext.Q str_predicted_EXT.U=fully_undefined_ext.U ENDELSE RETURN,str_predicted_EXT END