;+ ; NAME: cube_read ; PURPOSE: ; Read in a data cube into a standardized structure ; ; INPUTS: ; KEYWORDS: ; OUTPUTS: ; ; HISTORY: ; Began 2007-07-16 18:34:14 by Marshall Perrin ;- function cube_read, filename h = headfits(filename) if strc(sxpar(h,'INSTRUME')) eq 'GMOS-N' then begin ; read from EXTENSION 1, but INHERIT keywords from header 1, too. ;fits_read, filename, exten=extension, cube, hdr, /PDU ; MODIFICATION: Don't inherit. This doesn't actually have INHERIT=T, ; though perhaps it should... fits_read, filename, exten=extension, cube, hdr ; need to delete duplicate keywords from first header: CTYPE1,2, ; CRVAL1,2, CRPIX1,2 ; remove blank lines. Purely cosmetic! wblank = where(strmatch(strmid(hdr,0,8),' '), comp=wnotblank) hdr = hdr[wnotblank] sxaddpar, hdr, "COADDS", 1 ; no coadds keyword present by default... sxaddpar, hdr, 'INSTRUME', "GMOS-N" ; was in primary header endif if strc(sxpar(h,'CURRINST')) eq 'OSIRIS' and strc(sxpar(h,'INSTR')) eq 'spec' then begin cube = readfits(filename,hdr) extast3, hdr, astr if ~(keyword_set(astr)) then astr = {ctype: ['WAVE', "RA---TAN", "DEC--TAN"]} endif if ~(keyword_set(cube)) then message, "Don't know how to read that kind of cube!" if ~(keyword_set(astr)) then extast3, hdr, astr if ~(keyword_set(astr)) then astr=-1 return, {cube: cube, header: hdr, astr: astr} end