Blame view

src/idl/dustem_init_plugins.pro 3.35 KB
5816c74c   Annie Hughes   made fpd a keyword
1
PRO dustem_init_plugins,pd,fpd=fpd,help=help
392ede91   Jean-Philippe Bernard   included an help ...
2
3
4
5
6
7
8
9
10

;+
; NAME:
;    dustem_init_plugins
; PURPOSE:
;    initializes variable !dustem_plugin
; CATEGORY:
;    DustEMWrap
; CALLING SEQUENCE:
90047618   Annie Hughes   made fpd a keyword
11
;    dustem_init_plugins,pd,[fpd=fpd,help=help]
392ede91   Jean-Philippe Bernard   included an help ...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; INPUTS:
;    pd : variable parameters description
; OPTIONAL INPUT PARAMETERS:
;    fpd : fixed parameters description
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    !dustem_plugin is set
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
; PROCEDURES AND SUBROUTINES USED:
;
; EXAMPLES
;    
; MODIFICATION HISTORY:
;    Written by Ilyes Choubani
;    Evolution details on the DustEMWrap gitlab.
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_init_plugins'
  goto,the_end
END
e7938fa3   Ilyes Choubani   Corrected02: Impl...
42

e7938fa3   Ilyes Choubani   Corrected02: Impl...
43

7f2b2149   Jean-Philippe Bernard   a Ilyes
44
plugin_names=['']
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
45
plugind_detect_string='dustem_plugin'
83b3ddee   Jean-Philippe Bernard   modified with Ily...
46
Nplugins=0L
607060e5   Ilyes Choubani   test version
47

7f2b2149   Jean-Philippe Bernard   a Ilyes
48
49
50
for i=0L,n_elements(pd)-1 do begin
    fi=strtrim(strmid(pd(i),0,strlen(plugind_detect_string)),2)
    if fi eq plugind_detect_string then begin
3c479f24   Ilyes Choubani   Allowing to fix p...
51
        ftn = strmid(pd(i),0);strmid((*(*!dustem_fit).param_descs)(i),0) ;Try replacing this  ;String containing the name of the plugin and the keyword used (ie: dustem_create_continuum_2)    
7f2b2149   Jean-Philippe Bernard   a Ilyes
52
53
54
55
        ii = strsplit(ftn,'_',count=countx)
        ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword
        ftn = strmid(ftn,14,ii-14) ; String containing the name of the plugin without the associated keyword
        plugin_names=[plugin_names,ftn]
83b3ddee   Jean-Philippe Bernard   modified with Ily...
56
        Nplugins=Nplugins+1
7f2b2149   Jean-Philippe Bernard   a Ilyes
57
58
    ENDIF
ENDFOR
9e6a6a33   Ilyes Choubani   a JP /BUT HAS FAU...
59

607060e5   Ilyes Choubani   test version
60

3c479f24   Ilyes Choubani   Allowing to fix p...
61
62
63
64
65
66
67
68
69
70
71
72
73
IF KEYWORD_SET(fpd) THEN BEGIN
    for i=0L,n_elements(fpd)-1 do begin
          fi=strtrim(strmid(fpd(i),0,strlen(plugind_detect_string)),2)          
          if fi eq plugind_detect_string then begin
              ftn = strmid(fpd(i),0) ; String containing the name of the plugin and the keyword used (ie: dustem_create_continuum_2)                                 
              ii = strsplit(ftn,'_',count=countx)
              ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword
              ftn = strmid(ftn,14,ii-14) ; String containing the name of the plugin without the associated keyword
              plugin_names=[plugin_names,ftn]        
              Nplugins+=1  
        ENDIF
    ENDFOR
ENDIF
607060e5   Ilyes Choubani   test version
74

759a527d   Ilyes Choubani   general update
75

83b3ddee   Jean-Philippe Bernard   modified with Ily...
76
77
78
79
80
81
82
83
84
85
86
87
IF Nplugins EQ 0 THEN BEGIN
    plugin_names=['NONE']
    Nplugins=1
ENDIF ELSE BEGIN
    plugin_names=plugin_names[1:*]
    order=sort(plugin_names)
    plugin_names=plugin_names[order]
    un=uniq(plugin_names)
    plugin_names=plugin_names[un]
    Nplugins=n_elements(plugin_names)
ENDELSE

cbf75ef0   Ilyes Choubani   dustem_init_plugi...
88

3c479f24   Ilyes Choubani   Allowing to fix p...
89
90
91
92
93
94
95
96
97
IF Nplugins NE 0 THEN BEGIN
    for i=0L, Nplugins-1 do begin    
        If i EQ 0 then begin ;probably won't need the freezing part.
            strct = create_struct(plugin_names(i),{spec:ptr_new(),scope:ptr_new(),paramtag:ptr_new()});,freeze:{key:ptr_new(),val:ptr_new()}}) 
        endif else begin ;IF i GE 1
            strct = create_struct(strct,plugin_names(i),{spec:ptr_new(),scope:ptr_new(),paramtag:ptr_new()});,freeze:{key:ptr_new(),val:ptr_new()}})
        endelse         
    ENDFOR   
ENDIF
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
98
99


4750086c   Ilyes Choubani   nouvelle philosph...
100

3c479f24   Ilyes Choubani   Allowing to fix p...
101
;---------------------------------------------
e7938fa3   Ilyes Choubani   Corrected02: Impl...
102

e7938fa3   Ilyes Choubani   Corrected02: Impl...
103

3c479f24   Ilyes Choubani   Allowing to fix p...
104
defsysv, '!dustem_plugin', ptr_new(strct)  ; Need the use of the pointer because dustem_init_plugins is called in dustem_init (avoid conflicting structures error). 
e7938fa3   Ilyes Choubani   Corrected02: Impl...
105

392ede91   Jean-Philippe Bernard   included an help ...
106
the_end:
e7938fa3   Ilyes Choubani   Corrected02: Impl...
107

392ede91   Jean-Philippe Bernard   included an help ...
108
END