dustem_plugin_modify_isrf.pro 1.65 KB
Function dustem_plugin_modify_isrf, key=key, val=val, scope=scope, paramtag=paramtag,help=help 

;+
; NAME:
;    dustem_plugin_modify_isrf
; PURPOSE:
;    REPLACES THE DEFAULT DUSTEM ISRF with a user-defined one  
; CATEGORY:
;    DUSTEM Wrapper
; CALLING SEQUENCE:
;    dustem_plugin_modify_isrf(key=key,val=val)
; INPUTS:
;    None
; OPTIONAL INPUT PARAMETERS:
;    key = input parameter number 
;    val = input parameter value
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    The dustem fortran code must be installed
;    The dustem idl wrapper must be installed
;    The path of the ISRF must be assigned to one of the dustemwrap free pointers.
;    The user-defined ISRF needs to be on the same dustem ISRF grid.
; PROCEDURE:
;    This is a dustem plugin
;-
;- 

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_plugin_modify_isrf'
  goto,the_end
ENDIF

IF keyword_set(scope) THEN BEGIN 
    out=0
    goto, the_end
ENDIF 

IF keyword_set(paramtag) THEN BEGIN
    out=0
    goto, the_end 
ENDIF

out=0;?
amp=1.
IF keyword_set(key) THEN BEGIN 
         
    ind1=where(key EQ 1,count1) ;amplitude of the chosen spectrum (if the user has the shape but lacks the amplitude)
         
    IF count1 NE 0 then begin
    
       amp=val[ind1[0]]
       
    ENDIF
   
ENDIF
       
if isa(!dustem_isrf_file) then user_ISRF = dustem_read_isrf(*!dustem_isrf_file)

out=amp*User_ISRF.isrf     
   
the_end:
scope='USER_ISRF'

;paramtag will only matter if G0 is fitted through the plugin. 
paramtag=['Ampitude']

return, out
end