1
! @(#)ccdscan.prg 19.1 (ESO-DMD) 02/25/03 14:16:02
2
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
!.COPYRIGHT (C) 1993 European Southern Observatory
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
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
16
!.NOTE The following descriptors are set in case a correction has
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:"
35
! *** set the processing keywords
36
DEFINE/LOCAL OVSEC/C/1/40 {OV_SEC}
38
DEFINE/LOCAL OVDIR/C/1/3 {DIRECT}
40
DEFINE/LOCAL OVMOD/C/1/10 {OV_IMODE}
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'
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
54
IF {{P1},CCDSTAT(1)} .EQ. 1 THEN
56
"{P1}: *** WARNING: Overscan already subtracted; nothing done ..."
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")
66
! *** column or row readout direction
67
IF P4(1:1) .EQ. "C" .OR. P4(1:1) .EQ. "Y" THEN
69
ELSE IF P4(1:1) .EQ. "R" .OR. P4(1:1) .EQ. "X" THEN
72
WRITE/OUT "*** FATAL: Unknown readout direction; "
73
WRITE/OUT " Use C or Y (for column) and R or X (for row)"
77
! *** interactive of batch mode
78
IF P5(1:1) .EQ. "I" .OR. P5(1:1) .EQ. "y" THEN
84
! *** determine the overscan and correct
85
DEFINE/LOCAL SCSAV/C/1/3 {SC_SCAN}
87
@s prep_scan {P1} ! determine the overscan
89
IF {IDXT} .GE. 1 THEN ! save only scan-table
90
RENAME/TABLE {Q2} {P2(1:{IDXT})} ! rename to specified tablename
92
COMPUTE/IMAGE {P2} = {P1} - {CCDSCAN} ! do the subtraction
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
99
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FX ! short statistics
103
! *** restore the settings