Commit dad12758 authored by Carl Schaffer's avatar Carl Schaffer
Browse files

fixing history keywords in split files

parent 10621f44
......@@ -30,6 +30,8 @@ pro split_ifu,filebase
series_headers = List()
primed = 0 ; We want to skip the first ISERIE record, this flag ensures that
history_cards = List()
first_file = 1
foreach file_i, files do begin
print,"Processing "+file_i
fits_read,file_i,data,header,/header_only
......@@ -38,6 +40,9 @@ pro split_ifu,filebase
; extract keyword
key = repstr(strtrim(strmid(field,0,8)),"-","_")
if key eq "HISTORY" then begin
if first_file then history_cards.add,field
endif
; Trigger storage of intermediate header
if key eq "ISERIE" then begin
; print, "New map!"
......@@ -63,6 +68,7 @@ pro split_ifu,filebase
header_dict[key]=field
endif
endforeach; keywords
first_file=0
endforeach; files
; Header storage block, triggered after last file
......@@ -120,8 +126,13 @@ pro split_ifu,filebase
outdir=file_search(folder+'/level1_split',count=cntdir)
outpath = outdir+'/'+filename
; Add provenance information to header
sxdelpar,head_i,'HISTORY'
foreach hist_field, history_cards do begin
val = sxpar([hist_field], "HISTORY")
sxaddpar,head_i, "HISTORY", val
endforeach
sxaddpar,head_i,'HISTORY','split_ifu run on: '+string(systime(0))
sxaddpar,head_i,'HISTORY','split_ifu git revision: '+gitrev[0]
sxaddpar,head_i,'HISTORY','split_ifu git repo: '+gitrev[2]
......@@ -130,6 +141,7 @@ pro split_ifu,filebase
; Write split file
print,"Writing: "+outpath
fits_write, outpath, im[*,*,*,*,i_map], head_i
endfor; maps
end; split ifu
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment