From ab7bdcb33c68b2eb3f610757e4c4f1c4e83c9ba5 Mon Sep 17 00:00:00 2001 From: Annie Hughes Date: Mon, 19 Feb 2024 14:31:05 +0100 Subject: [PATCH] Updated write and read methods for binary FITS outputs to be consistent with new plugin structure --- src/idl/dustem_read_fits_table.pro | 7 ++++--- src/idl/dustem_write_fits_table.pro | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/idl/dustem_read_fits_table.pro b/src/idl/dustem_read_fits_table.pro index 86e2b7e..c970a6e 100644 --- a/src/idl/dustem_read_fits_table.pro +++ b/src/idl/dustem_read_fits_table.pro @@ -317,7 +317,7 @@ IF Nplugin NE 0 THEN BEGIN FOR i=0L,Nplugin-1 DO BEGIN ;stop ;(*!dustem_plugin).(i).spec=ptr_new(str_plugin[i]) - (*!dustem_plugin).(i).spec=str_plugin[i] + (*!dustem_plugin)[i].spec=str_plugin[i] header=*headers_plugin[i] pluggin_name=strtrim(sxpar(header,'PLUGIN'),2) pluggin_scope=strtrim(sxpar(header,'SCOPE'),2) @@ -329,8 +329,9 @@ IF Nplugin NE 0 THEN BEGIN ii=ii+1 ENDWHILE paramtags=paramtags[1:*] - (*!dustem_plugin).(i).scope=ptr_new(pluggin_scope) - (*!dustem_plugin).(i).PARAMTAG=ptr_new(paramtags) + ;(*!dustem_plugin).(i).scope=ptr_new(pluggin_scope) + (*!dustem_plugin)[i].scope=pluggin_scope + (*!dustem_plugin)[i].PARAMTAG=ptr_new(paramtags) ENDFOR ENDIF diff --git a/src/idl/dustem_write_fits_table.pro b/src/idl/dustem_write_fits_table.pro index 86475e5..74b4566 100755 --- a/src/idl/dustem_write_fits_table.pro +++ b/src/idl/dustem_write_fits_table.pro @@ -188,16 +188,20 @@ ENDIF ELSE BEGIN unit_predicted_spectra_pol=-1 unit_predicted_extinctions_pol=-1 ENDELSE -;==== add the pluggins spectra -plugin_tags=tag_names(*!dustem_plugin) +;==== add the spectra from plugins +plugin_tags=(*!dustem_plugin).name ind=where(plugin_tags NE 'NONE',Nplugins) + +;;stop IF Nplugins NE 0 THEN BEGIN unit_plugins=lonarr(Nplugins) str_plugins=strarr(Nplugins) FOR i=0L,Nplugins-1 DO BEGIN - mwrfits,*((*!dustem_plugin).(i).spec),file + ;mwrfits,*((*!dustem_plugin).(i).spec),file + mwrfits,*((*!dustem_plugin)[i].spec),file unit_plugins[i]=unit - str_plugins[i]=plugin_tags[i] +; str_plugins[i]=plugin_tags[i] + str_plugins[i]=(*!dustem_plugin)[i].name unit=unit+1 ENDFOR ENDIF ELSE BEGIN ;This is the case where there are no plugins involved @@ -371,10 +375,10 @@ sxaddpar,header_predicted_extinctions,'TITLE','OUTPUT BEST FIT PER-GRAIN AND TOT FOR i=0L,Nplugins-1 DO BEGIN header=*header_plugins[i] sxaddpar,header,'PLUGIN',str_plugins[i],'Plugin name' - sxaddpar,header,'SCOPE',*((*!dustem_plugin).(i).scope),'Plugin scope' - tags=*((*!dustem_plugin).(i).paramtag) + sxaddpar,header,'SCOPE',(*!dustem_plugin)[i].scope,'Plugin scope' + tags=*((*!dustem_plugin)[i].paramtag) FOR j=0L,n_elements(tags)-1 DO BEGIN - sxaddpar,header,'TAGN'+strtrim(j+1,2),(*((*!dustem_plugin).(i).paramtag))[j],'Plugin parameter tag' + sxaddpar,header,'TAGN'+strtrim(j+1,2),(*((*!dustem_plugin)[i].paramtag))[j],'Plugin parameter tag' ENDFOR header_plugins[i]=ptr_new(header) ENDFOR @@ -423,7 +427,7 @@ IF !run_pol EQ 1 THEN BEGIN mwrfits,dustem_st.polext,file ENDIF FOR i=0L,Nplugins-1 DO BEGIN - mwrfits,*((*!dustem_plugin).(i).spec),file,*header_plugins[i] + mwrfits,*((*!dustem_plugin)[i].spec),file,*header_plugins[i] ENDFOR message,'================================================',/info -- libgit2 0.21.2