Commit 9e6a6a33c6f057a7906dadb1328381a0890de664

Authored by Ilyes Choubani
1 parent 7f2b2149
Exists in master

a JP /BUT HAS FAULTY DUSTEM_CREATE_SYNCHROTRON

src/idl/dustem_activate_plugins.pro
... ... @@ -94,6 +94,8 @@ FOR i=0L,n_elements(p_min)-1 DO BEGIN
94 94 ; str='((*!dustem_scope).('+strtrim(k,2)+'))=ptr_new('+ftn+'(/scope)'+')'[0]
95 95 ;str=str(0)
96 96 toto=execute(str)
  97 +
  98 + print, scope
97 99 (*!dustem_scope).(k)=ptr_new(scope)
98 100 ;str='((*!dustem_scope).('+strtrim(k,2)+'))=ptr_new('+ftn+'(/scope)'+')'[0]
99 101  
... ...
src/idl/dustem_create_continuum.pro
... ... @@ -38,18 +38,12 @@ FUNCTION dustem_create_continuum,key=key,val=val,scope=scope,help=help
38 38  
39 39 IF keyword_set(help) THEN BEGIN
40 40 doc_library,'dustem_create_continuum'
41   - ;output=0.
  41 + output=0.
42 42 goto,the_end
43 43 ENDIF
44 44  
45 45  
46   -IF keyword_set(scope) THEN BEGIN
47 46 scope='ADD_SED'
48   -output=scope
49   -goto, the_end
50   -ENDIF
51   -
52   -
53 47  
54 48  
55 49 ;default values of input parameters
... ...
src/idl/dustem_init_plugins.pro
... ... @@ -7,6 +7,7 @@ varvar=create_struct('varvar',ptr_new())
7 7  
8 8 plugin_names=['']
9 9 plugind_detect_string='dustem_create'
  10 +
10 11 for i=0L,n_elements(pd)-1 do begin
11 12 fi=strtrim(strmid(pd(i),0,strlen(plugind_detect_string)),2)
12 13 if fi eq plugind_detect_string then begin
... ... @@ -17,55 +18,70 @@ for i=0L,n_elements(pd)-1 do begin
17 18 plugin_names=[plugin_names,ftn]
18 19 ENDIF
19 20 ENDFOR
  21 +
20 22 plugin_names=plugin_names[1:*]
21 23 order=sort(plugin_names)
22 24 plugin_names=plugin_names[order]
23 25 un=uniq(plugin_names)
24 26 plugin_names=plugin_names[un]
25   -Npluggins=n_elements(plugin_names)
26   -
27   -IF Npluggins NE 0 THEN BEGIN
28   -
29   - varvar=create_struct(plugin_names,ptr_new())
30   - defsysv, '!dustem_scope', ptr_new(varvar)
31   -ENDIF ELSE BEGIN
32   -
33   -ENDELSE
34   -
35   -defsysv, '!dustem_scope', ptr_new(varvar)
36   -
37   -for i=0L,n_elements(pd)-1 do begin
38   -
39   - fi=strtrim(strmid(pd(i),0,13),2)
40   -
41   - test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))
42   -
43   - if fi eq 'dustem_create' then begin
44   - stop
45   - ftn = strmid((*(*!dustem_fit).param_descs)(i),0) ; String containing the name of the plugin and the keyword used (ie: dustem_create_continuum_2)
46   - ii = strsplit(ftn,'_',count=countx)
47   - ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword
48   - ftn = strmid(ftn,14,ii-14) ; String containing the name of the plugin without the associated keyword
49   - plugin_name=ftn
50   -
51   - fii=strtrim(strmid(pd(i),14,4),2)
52   -
53   - j=0L
54   - if i eq 0 then j=2
55   - if i eq n_elements(pd)-1 then j=1
56   -
57   - trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)
58   -
59   - if i eq 0 && trl then trl=0 else trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)
60   -
61   -
62   - if test && (~trl) then varvar=create_struct(plugin_name,ptr_new())
63   - if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,ptr_new())
64   -
65   -
66   - endif
67   -
68   -endfor
  27 +Nplugins=n_elements(plugin_names)
  28 +
  29 +IF Nplugins NE 0 THEN BEGIN
  30 +
  31 + IF Nplugins GT 1 THEN BEGIN ;case of multiple plugins
  32 +
  33 + str_ptrs=replicate('ptr_new()',Nplugins)
  34 + str_ptrs=strjoin(ini,',')
  35 + str_plgnms=strjoin(plugin_names,',')
  36 +
  37 + str='varvar=create_struct('+str_plgnms+','+str_ptrs+')'
  38 + toto=execute(str)
  39 +
  40 + defsysv, '!dustem_scope', ptr_new(varvar)
  41 +
  42 + ENDIF ELSE BEGIN ;case of one plugin
  43 +
  44 + varvar=create_struct(plugin_names,ptr_new())
  45 + defsysv, '!dustem_scope', ptr_new(varvar)
  46 + ENDELSE
  47 +
  48 +ENDIF
  49 +
  50 +
  51 +
  52 +;
  53 +; for i=0L,n_elements(pd)-1 do begin
  54 +;
  55 +; fi=strtrim(strmid(pd(i),0,13),2)
  56 +;
  57 +; test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))
  58 +;
  59 +; if fi eq 'dustem_create' then begin
  60 +; stop
  61 +; ftn = strmid((*(*!dustem_fit).param_descs)(i),0) ; String containing the name of the plugin and the keyword used (ie: dustem_create_continuum_2)
  62 +; ii = strsplit(ftn,'_',count=countx)
  63 +; ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword
  64 +; ftn = strmid(ftn,14,ii-14) ; String containing the name of the plugin without the associated keyword
  65 +; plugin_name=ftn
  66 +;
  67 +; fii=strtrim(strmid(pd(i),14,4),2)
  68 +;
  69 +; j=0L
  70 +; if i eq 0 then j=2
  71 +; if i eq n_elements(pd)-1 then j=1
  72 +;
  73 +; trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)
  74 +;
  75 +; if i eq 0 && trl then trl=0 else trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)
  76 +;
  77 +;
  78 +; if test && (~trl) then varvar=create_struct(plugin_name,ptr_new())
  79 +; if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,ptr_new())
  80 +;
  81 +;
  82 +; endif
  83 +;
  84 +; endfor
69 85  
70 86  
71 87 test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))
... ...