FUNCTION getBIAScols, fitsHdr, COMPLEMENT=complement, COUNT=count ;;----------------------------------------------------------------------------- ;; PURPOSE: ;; Determines which cols contain Bias values ;; ;; CALLING SEQUENCE: ;; RETURN = getBIAScols(fitsHdr, COMPLEMENT=complement, COUNT=cnt) ;; ;; REQUIRED INPUTS: ;; fitsHdr - The FITS header for the image that could contain BIAS cols ;; ;; OUTPUTS: ;; RETURN - An array of all the cols that contain Bias values. If there ;; are none, returns -1. ;; ;; OPTIONAL INPUT KEYWORDS: ;; COMPLEMENT - Returns the first and last cols that aren't BIAS cols ;; , ie. image cols ;; COUNT - the number of Bias cols found. ;; ;; EXAMPLE: ;; IDL> cols = getBIAScols(fitsHdr) ;; ;; PROCEDURES USED (i.e. called directly!): ;; SXPAR - Gets a parameter from a FITS header ;; ;; MODIFICATION HISTORY: ;; 2004-07-14 M. Desnoyer Created ;; ;;----------------------------------------------------------------------------- ;ON_ERROR, 2 ;; Default the return values COUNT = 0 COMPLEMENT = -1 ;; Get the FITS Parameters mode = SXPAR(fitsHdr, 'IMGH030', COUNT=cnt1) ncol = SXPAR(fitsHdr, 'NAXIS1', COUNT=cnt2) dtctr = SXPAR(fitsHdr, 'IMGH021', COUNT=cnt3) ;; Check that the header was valid IF NOT( (cnt1 EQ 1) AND (cnt2 EQ 1) AND (cnt3 EQ 1)) THEN $ message, 'Invalid FITS header', /NONAME ;; Find the number of cols on the right and left that are BIAS rows IF dtctr EQ 1 THEN BEGIN ;;IR images SWITCH mode OF 1: 2: 3: 5: BEGIN biasCnt = 2 BREAK END 4: 6: BEGIN biasCnt = 5 BREAK END ELSE: biasCnt = 0 ENDSWITCH ENDIF ELSE BEGIN ;; VIS images SWITCH mode OF 9: 1: BEGIN biasCnt = 8 BREAK END 2: 3: 4: BEGIN biasCnt = 4 BREAK END 5: 6: BEGIN biasCnt = 2 BREAK END ELSE: biasCnt = 0 ENDSWITCH ENDELSE ;; Determine the Bias cols IF biasCnt GT 0 THEN BEGIN bcols = indgen(biasCnt*2) bcols[biasCnt:*] = bcols[biasCnt:*]+ncol-2*biasCnt ENDIF ELSE bcols = -1 ;; Determine the other ouptuts COUNT = biasCnt*2 COMPLEMENT = [biasCnt,ncol-biasCnt-1] RETURN, bcols END