FUNCTION getPOCrows, fitsHdr, COMPLEMENT=complement, COUNT=count ;;----------------------------------------------------------------------------- ;; PURPOSE: ;; Determines which rows contain Parallel Overclocked Pixels (POC) values ;; ;; CALLING SEQUENCE: ;; RETURN = getPOCrows(fitsHdr, COMPLEMENT=complement, COUNT=cnt) ;; ;; REQUIRED INPUTS: ;; fitsHdr - The FITS header for the image that could contain POC values ;; ;; OUTPUTS: ;; RETURN - An array of all the rows that contain POC values. If there ;; are none, returns -1. ;; ;; OPTIONAL INPUT KEYWORDS: ;; COMPLEMENT - Returns the first and last that aren't POC values, ;; ie. image rows ;; COUNT - the number of POC rows found. ;; ;; EXAMPLE: ;; IDL> rows = getPOCrows(fitsHdr) ;; ;; PROCEDURES USED (i.e. called directly!): ;; SXPAR - Gets a parameter from a FITS header ;; ;; MODIFICATION HISTORY: ;; 2004-05-26 M. Desnoyer Created ;; ;;----------------------------------------------------------------------------- ON_ERROR, 2 ;; Default the return values COUNT = 0 COMPLEMENT = -1 ;; Get the FITS Parameters mode = SXPAR(fitsHdr, 'IMGH030', COUNT=cnt1) nrow = SXPAR(fitsHdr, 'NAXIS2', 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 rows on the top and bottom that are POC IF dtctr EQ 1 THEN BEGIN ;;IR image SWITCH mode OF 1: 5: BEGIN pocCnt = 3 BREAK END 2: BEGIN pocCnt = 1 BREAK END 4: 6: BEGIN pocCnt = 6 BREAK END ELSE: pocCnt = 0 ENDSWITCH ENDIF ELSE BEGIN SWITCH mode OF ;;VIS images 9: 1: BEGIN ;; Special different count of rows because only the furthest five have ;; useful POC data. But other three don't contain image data pocCnt = 5 notImgCnt = 8 BREAK END 2: 3: 4: BEGIN pocCnt = 4 BREAK END 5: 6: BEGIN pocCnt = 2 BREAK END 7: BEGIN pocCnt = 0 notImgCnt = 1 BREAK END ELSE: pocCnt = 0 ENDSWITCH ENDELSE ;; Identify how many rows are non-image rows IF n_elements(notImgCnt) EQ 0 THEN notImgCnt=pocCnt ;; Determine the POC rows IF pocCnt GT 0 THEN BEGIN IF dtctr EQ 1 THEN prows = indgen(pocCnt) ELSE BEGIN prows = indgen(pocCnt*2) prows[pocCnt:*] = prows[pocCnt:*]+nrow-2*pocCnt ENDELSE ENDIF ELSE prows = -1 ;; Determine the other ouptuts COUNT = (dtctr EQ 1)?pocCnt:pocCnt*2 COMPLEMENT = [notImgCnt,(dtctr EQ 1)?nrow-1:nrow-notImgCnt-1] RETURN, prows END