dustem_define_dustem_data.pro 2.26 KB
FUNCTION dustem_define_dustem_data,polarization=polarization,rchi2_weight=rchi2_weight
  
;+
; NAME:
;   dustem_define_dustem_data
;  
; PURPOSE:
;   Returns data structure with appropriate tags (format depends on polarized vs non polarized run)
;  
; CATEGORY:
;    DustEMWrap, Distributed, LowLevel
;  
; CALLING SEQUENCE:
;   dustem_data = dustem_define_dustem_data([/pol],[rchi2=outvar])
;
; INPUTS:
;    None
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    data structure with appropriate tags
;
; OPTIONAL OUTPUT PARAMETERS:
;    structure with the same tags for the corresponding reduced chi2 weights
;  
; ACCEPTED KEY-WORDS:
;
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;    The DustEMWrap idl code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;   
; EXAMPLES
;    dustem_data = dustem_define_dustem_data(pol=1)
;
; MODIFICATION HISTORY:
;    Written by JPB
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-


if keyword_set(polarization) then begin
    dustem_data_st ={    $ ;Structure contaning the data to fit
                                sed:    ptr_new(),      $ ; 
                                ext:    ptr_new(),      $ ;
                                qsed: ptr_new(),        $ ; 
                                used: ptr_new(),        $ ; 
                                polsed: ptr_new(),      $ ; 
                                polfrac: ptr_new(),     $ ;   
                                psi_em: ptr_new(),      $ ; 
                                qext: ptr_new(),        $ ; 
                                uext: ptr_new(),        $ ;
                                polext: ptr_new(),      $ ;
                                fpolext: ptr_new(),     $ ;  
                                psi_ext: ptr_new()      $ ; 
                                 
                         }
    rchi2_weight = {sed: 0.,ext: 0.,qsed:0.,used:0.,polsed:0.,polfrac:0.,psi_em:0.,qext:0.,uext:0.,polext:0.,psi_ext:0.}
         
endif else begin
    dustem_data_st = {    $ 
                                sed:    ptr_new(),      $
                                ext:    ptr_new()       $
                         }
	    rchi2_weight = {sed: 0.,ext: 0.}
endelse

RETURN,dustem_data_st

END