function GENREADIMAGE, Filename, EXPDIV=EXPDIV ;+ ; NAME: ; GENREADIMAGE ; ; PURPOSE: ; This function reads a FITS image and returns an image structure. ; ; CATEGORY: ; Comet Nucleus Tour CRISP IR Spectrometer calibration pipeline. ; ; CALLING SEQUENCE: ; ; im = GENREADIMAGE(Filename) ; ; INPUTS: ; Filename FITS image file to read ; ; KEYWORD PARAMETERS: ; EXPDIV Set to convert data to counts per second. ; ; OUTPUTS: ; This function returns an anonymous structure representing the ; first header-data unit (HDU) in the named FITS file. The ; structure elements are: ; header the FITS header as a string array, one string per card ; data the data ; mask set to -1 (to be replaced at a later stage by a ; bad-pixel mask). This entry is here so that raw data ; can be fed to later routines without generating errors ; in those routines. ; ; PROCEDURE: ; ; NOTE: DOES NOT BSCALE/BZERO, because this entails a possible ; type conversion. To scale, do one of these in your program, ; as appropriate: ; data = double(im.data) * sxpar(header, 'BSCALE') + sxpar(header, 'BZERO') ; data = float(im.data) * sxpar(header, 'BSCALE') + sxpar(header, 'BZERO') ; ; EXAMPLE: ; ; im = GENREADIMAGE(Filename) ; header = im.header ; data = im.data ; print, sxpar(header, 'BSCALE') ; tvscl, data ; ; MODIFICATION HISTORY: ; Written by: Joseph Harrington, Cornell. 2002 Jan 30 ; jh@oobleck.astro.cornell.edu ;- data = mrdfits(filename, 0, header, /silent) mask = [-1] im = {header:header, data:data, mask:mask} if keyword_set(expdiv) then begin im = imexpdiv(im) endif return, im end