| 1 |
! @(#)ccdscan.prg 19.1 (ESO-DMD) 02/25/03 14:16:02 |
| 2 |
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 3 |
!.COPYRIGHT (C) 1993 European Southern Observatory |
| 4 |
!.IDENT ccdscan.prg |
| 5 |
!.AUTHOR Rein H. Warmels, ESO-Garching |
| 6 |
!.KEYWORDS Direct imaging, CCD package |
| 7 |
!.PURPOSE High level procedure for overscan correction |
| 8 |
!.USE @s ccdscan p1 p2 p3 p4 p5 |
| 9 |
!. p1 = input frame; |
| 10 |
!. p2 = output frame; |
| 11 |
!. p3 = overscan area |
| 12 |
!. p4 = readout direction of the CCD |
| 13 |
!. p5 = mode of operation |
| 14 |
!.METHOD The procedure use the prep_scan lower level procedure to make |
| 15 |
!. the overscan frame |
| 16 |
!.NOTE The following descriptors are set in case a correction has |
| 17 |
!. been done. |
| 18 |
!. CCDSTAT(1) for overscan correction |
| 19 |
!. CCDSTAT(2) for trimming the frame |
| 20 |
!. CCDSTAT(3) for bad pixel correction |
| 21 |
!. CCDSTAT(4) for bias subtraction |
| 22 |
!. CCDSTAT(5) for dark current subtraction |
| 23 |
!. CCDSTAT(6) for flat fielding |
| 24 |
!. CCDSTAT(7) for bad pixel correction |
| 25 |
!. CCDSTAT(8) for fringing correction |
| 26 |
!.VERSION 930503 RHW Creation |
| 27 |
!.VERSION 980128 SW table output of fit implemented |
| 28 |
!------------------------------------------------------- |
| 29 |
DEFINE/PARAM P1 ? I "Enter input frame:" |
| 30 |
DEFINE/PARAM P2 ? I "Enter output frame:" |
| 31 |
DEFINE/PARAM P3 {OV_SEC} C "Enter overscan area:" |
| 32 |
DEFINE/PARAM P4 {DIRECT} C "Readout direction of the CCD:" |
| 33 |
DEFINE/PARAM P5 {OV_IMODE} C "Enter mode of operation:" |
| 34 |
! |
| 35 |
! *** set the processing keywords |
| 36 |
DEFINE/LOCAL OVSEC/C/1/40 {OV_SEC} |
| 37 |
OV_SEC = P3 |
| 38 |
DEFINE/LOCAL OVDIR/C/1/3 {DIRECT} |
| 39 |
DIRECT = P4 |
| 40 |
DEFINE/LOCAL OVMOD/C/1/10 {OV_IMODE} |
| 41 |
OV_IMODE = P5 |
| 42 |
DEFINE/LOCAL OVFUN/C/1/20 {OV_FUNCT} ! fitting function |
| 43 |
DEFINE/LOCAL OVORD/I/1/1 {OV_ORDER} ! number of polynomial terms |
| 44 |
DEFINE/LOCAL OVAVE/I/1/1 {OV_AVER} ! number of points to combine |
| 45 |
DEFINE/LOCAL OVITE/I/1/1 {OV_ITER} ! number of iterations |
| 46 |
DEFINE/LOCAL OVREJ/R/1/1 {OV_REJEC} ! sigma rejection factor |
| 47 |
DEFINE/LOCAL IDXT/I/1/1 0 !index in P2 of ',table' |
| 48 |
! |
| 49 |
! *** check if overscan has been corrected for |
| 50 |
IF M$EXISTD(P1,"CCDSTAT") .EQ. 0 THEN |
| 51 |
WRITE/OUT "{P1}: *** WARNING: No check on CCD reduction status possible" |
| 52 |
WRITE/DESCR {P1} CCDSTAT/I/1/10 0 ALL |
| 53 |
ELSE |
| 54 |
IF {{P1},CCDSTAT(1)} .EQ. 1 THEN |
| 55 |
WRITE/OUT |
| 56 |
"{P1}: *** WARNING: Overscan already subtracted; nothing done ..." |
| 57 |
RETURN |
| 58 |
ENDIF |
| 59 |
ENDIF |
| 60 |
! |
| 61 |
! *** check if output (P2) is a table |
| 62 |
IDXT = M$INDEX(P2,",t") !test for name,table |
| 63 |
IF {IDXT} .LT. 1 IDXT = M$INDEX(P2,",T") |
| 64 |
IDXT = {IDXT} - 1 |
| 65 |
! |
| 66 |
! *** column or row readout direction |
| 67 |
IF P4(1:1) .EQ. "C" .OR. P4(1:1) .EQ. "Y" THEN |
| 68 |
DIRECT = "Y" |
| 69 |
ELSE IF P4(1:1) .EQ. "R" .OR. P4(1:1) .EQ. "X" THEN |
| 70 |
DIRECT = "X" |
| 71 |
ELSE |
| 72 |
WRITE/OUT "*** FATAL: Unknown readout direction; " |
| 73 |
WRITE/OUT " Use C or Y (for column) and R or X (for row)" |
| 74 |
RETURN/EXIT |
| 75 |
ENDIF |
| 76 |
! |
| 77 |
! *** interactive of batch mode |
| 78 |
IF P5(1:1) .EQ. "I" .OR. P5(1:1) .EQ. "y" THEN |
| 79 |
OV_IMODE = "yes" |
| 80 |
ELSE |
| 81 |
OV_IMODE = "no" |
| 82 |
ENDIF |
| 83 |
! |
| 84 |
! *** determine the overscan and correct |
| 85 |
DEFINE/LOCAL SCSAV/C/1/3 {SC_SCAN} |
| 86 |
SC_SCAN = "yes" |
| 87 |
@s prep_scan {P1} ! determine the overscan |
| 88 |
SC_SCAN = SCSAV |
| 89 |
IF {IDXT} .GE. 1 THEN ! save only scan-table |
| 90 |
RENAME/TABLE {Q2} {P2(1:{IDXT})} ! rename to specified tablename |
| 91 |
ELSE |
| 92 |
COMPUTE/IMAGE {P2} = {P1} - {CCDSCAN} ! do the subtraction |
| 93 |
! |
| 94 |
WRITE/DESCR {P2} CCDSTAT/I/1/1 1 ! overscan correction done |
| 95 |
WRITE/DESCR {P2} HISTORY/C/-1/80 "OVERSCAN/CCD {P1} {P2} {P3}" |
| 96 |
IF VERBOSE(1:1) .EQ. "Y" THEN |
| 97 |
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FF ! full statistics |
| 98 |
ELSE |
| 99 |
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FX ! short statistics |
| 100 |
ENDIF |
| 101 |
ENDIF |
| 102 |
! |
| 103 |
! *** restore the settings |
| 104 |
OV_SEC = OVSEC |
| 105 |
DIRECT = OVDIR |
| 106 |
OV_FUNCT = OVFUN |
| 107 |
OV_ORDER = OVORD |
| 108 |
OV_AVER = OVAVE |
| 109 |
OV_ITER = OVITE |
| 110 |
OV_REJEC = OVREJ |
| 111 |
! |
| 112 |
RETURN |