dustem_init_plugins.pro
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
PRO dustem_init_plugins, pd
;INITIALIZING THE SCOPES DATA ARRAYS--------------------
varvar=create_struct('varvar',ptr_new())
plugin_names=['']
plugind_detect_string='dustem_create'
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
ftn = strmid((*(*!dustem_fit).param_descs)(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]
ENDIF
ENDFOR
plugin_names=plugin_names[1:*]
order=sort(plugin_names)
plugin_names=plugin_names[order]
un=uniq(plugin_names)
plugin_names=plugin_names[un]
Npluggins=n_elements(plugin_names)
IF Npluggins NE 0 THEN BEGIN
varvar=create_struct(plugin_names,ptr_new())
defsysv, '!dustem_scope', ptr_new(varvar)
ENDIF ELSE BEGIN
ENDELSE
defsysv, '!dustem_scope', ptr_new(varvar)
for i=0L,n_elements(pd)-1 do begin
fi=strtrim(strmid(pd(i),0,13),2)
test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))
if fi eq 'dustem_create' then begin
stop
ftn = strmid((*(*!dustem_fit).param_descs)(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_name=ftn
fii=strtrim(strmid(pd(i),14,4),2)
j=0L
if i eq 0 then j=2
if i eq n_elements(pd)-1 then j=1
trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)
if i eq 0 && trl then trl=0 else trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)
if test && (~trl) then varvar=create_struct(plugin_name,ptr_new())
if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,ptr_new())
endif
endfor
test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))
if test then varvar=create_struct('varvar','ERROR IN DUSTEM_INIT_PLUGINS!')
defsysv, '!dustem_scope', ptr_new(varvar)
;---------------------------------------------
;INITIALIZING THE PLUGIN DATA ARRAYS----------
tgnms=tag_names(varvar)
for i=0L, n_tags(varvar)-1 do begin
if i eq 0 then strct= create_struct(tgnms(i),ptr_new())
if i ge 1 then strct= create_struct(strct, tgnms(i),ptr_new())
endfor
defsysv, '!dustem_plugin', ptr_new(strct) ; structure that will contain the spectra associated to each plugin ; how do I insert a whole structure as a fucking tag?
;---------------------------------------------
end