dustem_plugin_modify_isrf.pro 1.82 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 DustEMWrap IDL code 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:
;    
; EXAMPLES
;    dustem_plugin_modify_isrf
;
; MODIFICATION HISTORY:
;    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_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