dustem_init_plugins.pro 2.55 KB
PRO dustem_init_plugins, pd


;DEFINING THE SCOPES--------------------

varvar=create_struct('varvar',ptr_new())


for i=0L,n_elements(pd)-1 do begin

fi=strtrim(strmid(pd(i),0,6),2)

test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))

if fi eq 'dustem' then begin

fii=strtrim(strmid(pd(i),14,4),2)

j=0L
if i eq 0 then j+=2

trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2)


case fii of ;TESTING ON THE 4 FIRST LETTERS OF THE PLUGIN'S NAME

;starting a fresh structure or appending to a pre-existing one
'cont': begin

plugin_name='CONTINUUM' ; THIS STRING SHOULD MATCH THE NAME OF THE PLUGIN IN THE SCOPE LINE OF THE PLUGIN FUNCTION
if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED')
if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED')
print, varvar
end

'sync': begin

plugin_name='SYNCHROTRON'
if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED+ADD_POLSED')
if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED+ADD_POLSED')
end

'free': begin

plugin_name='FREE_FREE'
if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED')
if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED')
end

'stok': begin

plugin_name='STOKES'
if test && (~trl) then varvar=create_struct(plugin_name,'MODIFY'); plugin that allows the computation of Q_sed and U_sed and fitting of PSI_dust and PSI_synch
if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'MODIFY')
end

'stex':begin

print,'found'
plugin_name='STEXT' ;'stokes'+extinction
if test && (~trl) then varvar=create_struct(plugin_name,'MODIFY') ; plugin that allows the computation of Q_ext = sigext_q and U_ext=sigext_u and fitting of PSI_ext
if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'MODIFY')
print, varvar
end

;NEW PLUGIN TO BE ADDED HERE
endcase

endif

endfor


test=(n_tags(varvar) eq 1 && tag_exist(varvar,'varvar'))  
if test then varvar=create_struct('varvar','NULL')

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
;---------------------------------------------

end