function eit_readcal, file, hdr, nonorm=nonorm ;+ ;NAME ; eit_readcal ;PURPOSE ; reads a calibration lamp ;INPUTS ; file = file name ;OPTIONAL INPUTS ; hdr = a variable to recieve the FITS header ;OUTPUTS ; returns a calibration lamp ;KEYWORDS ; nonorm : if present, then does not normalize to exposure time. ;CREATION ; 18-May-2001. F. Auchere ;MODIFICATIONS ; ; 29-Jul-2002. F. Auchere Takes into account the calibration lamp exposure time correction ; 30-Jul-2002. F. Auchere Added the optional "hdr" parameter to return the header of the file ; 23-Aug-2002. F. Auchere Added /nonorm keyword ;- pos = strpos(file, 'EFZ') if pos eq -1 then pos = strpos(file, 'EFR') name = strmid(file, pos, 18) if strlowcase(name) eq 'efz19951209.035503' then begin cal = readfits(eit_file2path('efz19951209.035503'), hdr, /silent) cal = transpose(cal - eit_dark('01-jan-1996')) if keyword_set(nonorm) then cal = cal/eit_lampexpt(eit_fxpar(hdr, 'EXPTIME')) endif else begin cal = readfits(eit_file2path(name), hdr, /silent) case eit_fxpar(hdr, 'NAXIS') of 2 : begin cal = cal - eit_dark(eit_fxpar(hdr, 'DATE_OBS')) if keyword_set(nonorm) then cal = cal/eit_lampexpt(eit_fxpar(hdr, 'EXPTIME')) end 3 : begin sz = size(cal) nx = sz[1] ny = sz[2] for nimg = 0, sz[3] - 1 do begin cal[*, *, nimg] = cal[*, *, nimg] - eit_dark(eit_fxpar(hdr, 'DATE_OBS')) if keyword_set(nonorm) then cal = cal/eit_lampexpt(eit_fxpar(hdr, 'EXPTIME', image_no=nimg)) endfor cal = rebin(cal, nx, ny, 1)/float(rebin(cal gt 0, nx, ny, 1)) end endcase endelse cal = rebin(cal, 1024, 1024) cal[*, 0:1] = cal[*, 2:3] cal[1022:1023, *] = cal[1020:1021, *] return, cal>0 end