;+ ; function pickfits,header,instrument=instrument,filenames=filesnames ; ; NAME: pickfits ; PURPOSE: ; pick one or more fits files using the GUI and then load them. ; NOTES: ; returns the images and headers as multidimensional arrays, if ; you select more than one file. ; ; This is basically just a GUI frontend to fitsloader.pro, which handles ; any scaling rules for coadds or nreads for different images. ; ; INPUTS: ; filenames a list of filenames to load. If not supplied, then ; you will be prompted with a file selection dialog box ; ; KEYWORDS: ; instrument the name of the instrument these files are from; passed ; to fitsloader.pro ; ; OUTPUTS: ; returns the selected image(s) as a 2d image or 3d cube, as appropriate ; ; headers returns the fits headers for the image(s) as a 1d ; or 2d string array, as appropriate. ; ; HISTORY: ; Began 2002-10-30 23:02:46 by Marshall Perrin ;- function pickfits,outheader,instrument=instrument,filenames=filesnames if not(keyword_set(filenames)) then begin filenames = dialog_pickfile(filter="*.fits",/multiple_files,/must_exist,$ title="Select FITS file(s) to load.") endif if filenames[0] eq "" then return,!values.f_nan ; use fitsloader to do all the work. if n_elements(filenames) gt 0 then begin if not(keyword_set(instrument)) then begin header0 = headfits(filenames[0]) instrument = sxpar(header0,"INSTRUME") if instrument eq 'IRCAL ' then instrument="IRCAL" ; add other checks here? endif fitsloader,[0],outimage,outheader,imlist=filenames,instrument=instrument return,outimage endif ; nothing valid selected.... return,!values.f_nan end