dustem_initialize_sed.pro 3.7 KB
FUNCTION dustem_initialize_sed,Nsed,comments=comments,help=help

;+
; NAME:
;    dustem_initialize_sed
; PURPOSE:
;    Initializes an empty Dustem SED structure
; CATEGORY:
;    DUSTEM Wrapper
; CALLING SEQUENCE:
;    st=dustem_initialize_sed(Nsed[,/help])
; INPUTS:
;    Nsed: Number of elements/filters in the SED structure
; OPTIONAL INPUT PARAMETERS:
;    None
; OUTPUTS:
;    st = SED structure
;    The structure contains the following tags
;      instru  : name of the instrument. Actually not used by DustemWrap.
;      filter  : name of the filter. Actually defines the wavelength, the flux convention, etc ...
;      wave    : wavelength in microns. Actually not used by DustemWrap. [microns]
;      spec    : Total intensity Intensity (a.k.a. Stokes I) [MJy/sr]
;      error   : uncertainty on spec = sqrt(variance) on spec (a.k.a. sqrt(sigmaII)) [MJy/sr]
;      StokesQ : Stokes Q intensity [MJy/sr]
;      StokesU : Stokes U intensity [MJy/sr]
;      largeP  : polarized intensity [MJy/sr] (computed from StokesQ,StokesU)
;      smallp  : polarization fraction [] (computed from StokesI, StokesQ,StokesU)
;      psi     : polarization angle [deg] (computed from StokesQ,StokesU)
;      sigmaII : = error^2 (for completness on sigmas) [MJy/sr^2]
;      sigmaQQ : variance on Q [MJy/sr^2]
;      sigmaUU : variance on U [MJy/sr^2]
;      sigmaIQ : IQ covariance [MJy/sr^2]
;      sigmaIU : IU covariance [MJy/sr^2]
;      sigmaQU : QU covariance [MJy/sr^2]
;      sigma_largep : uncertainty on largep [MJy/sr]
;      sigma_smallp: uncertainty on smallp []
;      sigma_psi  : uncertainty on psi [deg]
; OPTIONAL OUTPUT PARAMETERS:
;    comments : string comments about the SED
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    None
; PROCEDURE:
;    Straightforward
; EXAMPLES
;    st=dustem_initialize_sed(10)
;    help,st
; MODIFICATION HISTORY:
;    Written by JPB 
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_initialize_sed'
  sed=0.
  goto,the_end
ENDIF

;one_st={instru:'',filter:'',wave:0.,spec:0.,error:0.}
iv=la_undef(4)
one_st={instru:'',filter:'',wave:iv,StokesI:iv,StokesQ:iv,StokesU:iv,largeP:iv,smallp:iv,psi:iv,sigmaII:iv,sigmaQQ:iv,sigmaUU:iv,sigmaIQ:iv,sigmaIU:iv,sigmaQU:iv,sigma_largep:iv,sigma_smallp:iv,sigma_psi:iv}
;one_st={instru:'',filter:'',wave:iv,spec:iv,error:iv,StokesQ:iv,StokesU:iv,largeP:iv,smallp:iv,psi:iv,sigmaII:iv,sigmaQQ:iv,sigmaUU:iv,sigmaIQ:iv,sigmaIU:iv,sigmaQU:iv,sigma_largep:iv,sigma_smallp:iv,sigma_psi:iv}
comments=['Dustem-Wrap SED']
comments=[comments,'instru: Instrument name']
comments=[comments,'filter: Instrument filter']
comments=[comments,'wave: Filter reference wavelength [mic]']
comments=[comments,'StokesI: SED intensity [MJy/sr]']
comments=[comments,'StokesQ: Q Stokes parameter intensity [MJy/sr]']
comments=[comments,'StokesU: U Stokes parameter intensity [MJy/sr]']
comments=[comments,'largeP: Polarized intensity P [MJy/sr]']
comments=[comments,'smallp: polarization fraction []']
comments=[comments,'psi: polarization angle [deg]']
comments=[comments,'sigmaII: variance on Stokes I [(MJy/sr)^2]']
comments=[comments,'sigmaQQ: variance on Stokes Q [(MJy/sr)^2]']
comments=[comments,'sigmaUU: variance on Stokes U [(MJy/sr)^2]']
comments=[comments,'sigmaIQ: covariance on Stokes I and Q [(MJy/sr)^2]']
comments=[comments,'sigmaIU: covariance on Stokes I and U [(MJy/sr)^2]']
comments=[comments,'sigmaQU: covariance on Stokes Q and U [(MJy/sr)^2]']
comments=[comments,'sigma_largep: 1 sigma uncertainty on P [MJy/sr]']
comments=[comments,'sigma_smallp: 1 sigma uncertainty on p []']
comments=[comments,'sigma_psi: 1 sigma uncertainty on psi [deg]']

sed=replicate(one_st,Nsed)

the_end:
RETURN,sed

END