dustem_plugin_continuum.pro 1.69 KB
FUNCTION dustem_plugin_continuum,key=key,val=val,scope=scope,paramtag=paramtag,paramdefault=paramdefault,help=help

;+
; NAME:
;    dustem_plugin_continuum
; PURPOSE:
;    DUSTEM plugin to compute a blackbody continuum
; CATEGORY:
;    DUSTEM Wrapper
; CALLING SEQUENCE:
;    cont=dustem_plugin_continuum([,key=][,val=])
; INPUTS:
;    
; OPTIONAL INPUT PARAMETERS:
;    key  = input parameter number
;    val  = input parameter value
; OUTPUTS:
;    cont = continuum spectrum (on dustem wavelengths)
; OPTIONAL OUTPUT PARAMETERS:
;    scope = scope of the plugin
;    paramdefault = default values of parameters
;    paramtag = plugin parameter names as strings
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    None
; PROCEDURE:
;    This is a dustem plugin
; EXAMPLES
;
;
; MODIFICATION HISTORY:
;    Written by JPB 
;-


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

IF keyword_set(scope) THEN BEGIN
    scope='ADD_SED'
    output=0
    goto, the_end
ENDIF 

IF keyword_set(paramtag) THEN BEGIN
    paramtag=[textoidl('T_{BB}')+' [K]','Amp']
    output=0
    goto, the_end 
ENDIF


;default values of input parameters
temp=1000.
ampl=1.d-2
paramdefault=[temp,ampl]

IF keyword_set(key) THEN BEGIN 
  a=where(key EQ 1,count1)
  b=where(key EQ 2,count2)
  
  IF count1 NE 0 then temp=(val(a))(0)
  IF count2 NE 0 then ampl=(val(b))(0)
   
ENDIF
  
lambir=dustem_get_wavelengths()

;=== normalize spectrum to the requested amplitude.
norm = max(dustem_planck_function(temp,lambir))
output = ampl*dustem_planck_function(temp,lambir)/norm

the_end:
RETURN,output
  
END