Blame view

src/idl/dustem_plugin_modify_isrf.pro 1.73 KB
8dbb9ca6   Annie Hughes   fix bug with free...
1
FUNCTION dustem_plugin_modify_isrf, key=key, val=val, scope=scope, paramtag=paramtag,help=help 
ad369def   Ilyes Choubani   uploading modify_...
2
3
4
5

;+
; NAME:
;    dustem_plugin_modify_isrf
8dbb9ca6   Annie Hughes   fix bug with free...
6
;
ad369def   Ilyes Choubani   uploading modify_...
7
8
; PURPOSE:
;    REPLACES THE DEFAULT DUSTEM ISRF with a user-defined one  
8dbb9ca6   Annie Hughes   fix bug with free...
9
;
ad369def   Ilyes Choubani   uploading modify_...
10
11
; CATEGORY:
;    DUSTEM Wrapper
8dbb9ca6   Annie Hughes   fix bug with free...
12
;
ad369def   Ilyes Choubani   uploading modify_...
13
14
; CALLING SEQUENCE:
;    dustem_plugin_modify_isrf(key=key,val=val)
8dbb9ca6   Annie Hughes   fix bug with free...
15
;
ad369def   Ilyes Choubani   uploading modify_...
16
17
; INPUTS:
;    None
8dbb9ca6   Annie Hughes   fix bug with free...
18
;
ad369def   Ilyes Choubani   uploading modify_...
19
20
21
; OPTIONAL INPUT PARAMETERS:
;    key = input parameter number 
;    val = input parameter value
8dbb9ca6   Annie Hughes   fix bug with free...
22
;
ad369def   Ilyes Choubani   uploading modify_...
23
24
; OUTPUTS:
;    None
8dbb9ca6   Annie Hughes   fix bug with free...
25
;
ad369def   Ilyes Choubani   uploading modify_...
26
27
; OPTIONAL OUTPUT PARAMETERS:
;    None
8dbb9ca6   Annie Hughes   fix bug with free...
28
;
ad369def   Ilyes Choubani   uploading modify_...
29
30
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
8dbb9ca6   Annie Hughes   fix bug with free...
31
;
ad369def   Ilyes Choubani   uploading modify_...
32
33
; COMMON BLOCKS:
;    None
8dbb9ca6   Annie Hughes   fix bug with free...
34
;
ad369def   Ilyes Choubani   uploading modify_...
35
36
; SIDE EFFECTS:
;    None
8dbb9ca6   Annie Hughes   fix bug with free...
37
;
ad369def   Ilyes Choubani   uploading modify_...
38
; RESTRICTIONS:
8dbb9ca6   Annie Hughes   fix bug with free...
39
40
41
;    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.
ad369def   Ilyes Choubani   uploading modify_...
42
;    The user-defined ISRF needs to be on the same dustem ISRF grid.
8dbb9ca6   Annie Hughes   fix bug with free...
43
;
ad369def   Ilyes Choubani   uploading modify_...
44
; PROCEDURE:
8dbb9ca6   Annie Hughes   fix bug with free...
45
46
47
48
49
50
51
;    
; EXAMPLES
;    dustem_plugin_modify_isrf
;
; MODIFICATION HISTORY:
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
ad369def   Ilyes Choubani   uploading modify_...
52
;-
ad369def   Ilyes Choubani   uploading modify_...
53
54
55
56
57
58

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

6baf9f1f   Jean-Philippe Bernard   fixed a few issue...
59
60
IF keyword_set(scope) THEN BEGIN
    scope='REPLACE_ISRF'
ad369def   Ilyes Choubani   uploading modify_...
61
62
63
64
65
    out=0
    goto, the_end
ENDIF 

IF keyword_set(paramtag) THEN BEGIN
6baf9f1f   Jean-Philippe Bernard   fixed a few issue...
66
    paramtag=['Amplitude']
ad369def   Ilyes Choubani   uploading modify_...
67
68
69
70
71
    out=0
    goto, the_end 
ENDIF

out=0;?
f9089dc2   Ilyes Choubani   implementing the ...
72
amp=1.
5eebdedb   Jean-Philippe Bernard   changed plugin st...
73
IF keyword_set(key) THEN BEGIN
f9089dc2   Ilyes Choubani   implementing the ...
74
    ind1=where(key EQ 1,count1) ;amplitude of the chosen spectrum (if the user has the shape but lacks the amplitude)
ad369def   Ilyes Choubani   uploading modify_...
75
    IF count1 NE 0 then begin
f9089dc2   Ilyes Choubani   implementing the ...
76
       amp=val[ind1[0]]
ad369def   Ilyes Choubani   uploading modify_...
77
    ENDIF
ad369def   Ilyes Choubani   uploading modify_...
78
79
ENDIF
       
5eebdedb   Jean-Philippe Bernard   changed plugin st...
80
81
82
IF isa(!dustem_isrf_file) THEN user_ISRF = dustem_read_isrf(*!dustem_isrf_file)

out=amp*User_ISRF.isrf
ad369def   Ilyes Choubani   uploading modify_...
83

ad369def   Ilyes Choubani   uploading modify_...
84
the_end:
ad369def   Ilyes Choubani   uploading modify_...
85

5eebdedb   Jean-Philippe Bernard   changed plugin st...
86
87
RETURN, out
END