dustem_fill_sed_dependent_columns.pro 1.82 KB
FUNCTION dustem_fill_sed_dependent_columns,sed,help=help

;+
; NAME:
;    dustem_fill_sed_dependent_columns
;
; PURPOSE:
;    fill up columns of a DustEMWrap SED that are depednent on I,Q,U and associated (co-)variances
;
; CATEGORY:
;    DustEMWrap, Distributed, High-Level, User-convenience
;
; CALLING SEQUENCE:
;    output=dustem_fill_sed_dependent_columns(sed[,/help])
;
; INPUTS:
;    sed    : a valid dustemwrap sed
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    None
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; 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
;    filled_sed=dustem_fill_sed_dependent_columns(sed)
;
; MODIFICATION HISTORY:
;    Written by JPB June-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_fill_sed_dependent_columns'
  output=0
  goto,the_end
ENDIF

output=sed

polar_iqu2ippsi,sed.stokesI,sed.stokesQ,sed.stokesU,p,psi,p2=p2,/lac
output.smallp=p
output.psi=psi
output.largep=la_mul(output.smallp,output.stokesI)

polar_variance_iqu2ippsi,sed.stokesI,sed.stokesQ,sed.stokesU,sed.sigmaII,sed.sigmaQQ,sed.sigmaUU,sed.sigmaIQ,sed.sigmaIU,sed.sigmaQU, $
						variance_smallp,variance_psi,variance_largep,/lac

xx=where(finite(variance_largep) eq 0, nanct)
if nanct gt 0 then variance_largep[xx]=la_undef()
xx=where(finite(variance_smallp) eq 0, nanct)
if nanct gt 0 then variance_smallp[xx]=la_undef()
xx=where(finite(variance_psi) eq 0, nanct)
if nanct gt 0 then variance_psi[xx]=la_undef()

output.sigma_largep=variance_largep
output.sigma_smallp=variance_smallp
output.sigma_psi=variance_psi


the_end:

RETURN,output
END