dustem_add_mod.pro 2.56 KB
FUNCTION DUSTEM_ADD_MOD, sf, tag, nsz, unit=unit
; adds a model tag to a existing SMDAT structure
; SF     (I): input SMDAT structure 
; TAG    (I): tag of model to be added
; NSZ    (I): int array(2) of sizes [nr of data pts, nr of grain types] 

  tag = STRLOWCASE(STRTRIM(tag,2))
  if n_elements(nsz) GT 1 then begin
     n1 = nsz(0) & n2 = nsz(1)
     if n_elements(nsz) EQ 3 then n3 = nsz(2) else n3 = 0
  endif else begin
     print,'(F) ADD_MOD: array of sizes must > 1D'
  endelse
  if TAG EQ 'emis' then begin
     if n_elements(unit) EQ 0 then unit='x(microns) SED(erg/s/cm2/sr)'
     s1 = { UNIT : unit,          $
            X :    dblarr(n1),    $ ; wave 
            Y :    dblarr(n1,n2), $ ; SED(wave, grain type) (index ntype is total)
            YP :   dblarr(n1,n2)  } ; polarized SED(wave, grain type) (index ntype is total)
  ENDIF else if TAG EQ 'ext' then begin
     if n_elements(unit) EQ 0 then unit='x(microns) sigma(cm2/H)'
     s1 = {UNIT :   unit,          $
           X :      dblarr(n1),    $ ; wave
           Y :      dblarr(n1,n2), $ ; sigma_ext(wave, grain type) (index ntype is total)
           ABS :    dblarr(n1,n2), $ ; sigma_abs(wave, grain type) 
           SCA :    dblarr(n1,n2), $ ; sigma_sca(wave, grain type)
           ABS_P :  dblarr(n1,n2), $ ; absorption sigma_pol(wave, grain type)
           SCA_P :  dblarr(n1,n2), $ ; scattering sigma_pol(wave, grain type)
           ALB :    dblarr(n1,n2), $ ; alb(wave, grain type)
           XR :     0d,            $ ; ref wave
           YR_ABS : dblarr(n2),    $ ; tau_abs/NH @ XR
           YR_SCA : dblarr(n2),    $ ; tau_sca/NH @ XR
           RV :   0d               }
;  ENDIF else if TAG EQ 'pol' then begin
;     if n_elements(unit) EQ 0 then unit='x(microns) SED(erg/s/cm2/sr)'
;     s1 = {UNIT :    unit,          $
;           X:        dblarr(n1),    $ ; wave
;           Y:        dblarr(n1,n2), $ ; polarized SED(wave, grain type) (index ntype is total)
;           POL:      dblarr(n1,n2)  } ; sigma_pol(wave, grain type) (ABS + SCAT)
  ENDIF else if tag EQ 'sdist' then begin
     if n3 EQ 0 then begin 
        print,'(F) ADD_MOD: 3d dimension missing '
        return,0
     endif
     if n_elements(unit) EQ 0 then unit='x(cm) a^4*dn/da(cm3/H)'     
     s1 = {UNIT :    unit,          $
           XTOT :    dblarr(n1),    $ ; grain size
           YTOT :    dblarr(n1,n2), $ ; size distribution
           XI :      dblarr(n3,n2), $ ; grain size per type
           YI :      dblarr(n3,n2)  } ; grain size dist per type
  ENDIF
  sm = CREATE_STRUCT( CREATE_STRUCT('M_'+tag,s1), sf )
  return, sm
END