Debian Codegraph @

stdred/ccdred/proc/ccddark.prg

raw
1 ! @(#)ccddark.prg 19.1 (ESO-DMD) 02/25/03 14:15:59
2 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 !.COPYRIGHT (C) 1993 European Southern Observatory
4 !.IDENT ccddark.prg
5 !.AUTHOR Rein H. Warmels, ESO-Garching
6 !.KEYWORDS Direct imaging, CCD package
7 !.PURPOSE Do the correction of dark current frame
8 !.ALGORYTHM Check for the existence of the input frame and the correct
9 !. exposure time descriptors. Exit if failing.
10 !. Check the processing flag; if corrected already exit
11 !. Compute the dark current scaling factor. Set the processing
12 !. flag if dark current correcte is finished
13 !.VERSION 920731 RHW Creation
14 !.NOTE The procedure checks if the operation was already done by
15 !. checking the descriptor CCDSTAT(5).
16 ! Other CCDSTAT descriptor values
17 !. CCDSTAT(1) for overscan correction
18 !. CCDSTAT(2) for trimming the frame
19 !. CCDSTAT(3) for bad pixel correction
20 !. CCDSTAT(4) for bias subtraction
21 !. CCDSTAT(5) for dark current subtraction
22 !. CCDSTAT(6) for flat fielding
23 !. CCDSTAT(7) for illumination correction
24 !. CCDSTAT(8) for fringing correction
25 !.VERSION 930503 RHW Creation
26 !-------------------------------------------------------
27 DEFINE/PARAM P1 ? IMA "Enter input frame: "
28 DEFINE/PARAM P2 ? IMA "Enter output frame: "
29 DEFINE/PARAM P3 {SC_DKFRM} IMA "Enter dark current frame: "
30 !
31 ! *** check if dark hasn't already been subtracted or if present
32 IF M$EXISTD(P1,"CCDSTAT") .EQ. 0 THEN
33 WRITE/OUT "{P1}: *** WARNING: No check on CCD reduction status possible"
34 WRITE/DESCR {P1} CCDSTAT/I/1/10 0 ALL
35 ELSE
36 IF {{P1},CCDSTAT(5)} .EQ. 1 THEN
37 WRITE/OUT "{P1}: *** WARNING: Dark already subtracted; nothing done ..."
38 RETURN
39 ENDIF
40 ENDIF
41 !
42 ! *** check existence of dark frameand its descriptors; return on error
43 IF M$EXIST("{P3}.bdf"} .EQ. 0 THEN
44 WRITE/OUT "{P1}: *** ERROR: Dark frame {P3}.bdf doesn't exist ..."
45 RETURN
46 ENDIF
47 IF DK_TYP .NE. "*" .AND. DK_TYP .NE. "?" THEN
48 IF M$EXISTD(P3,EXP_DESC) .EQ. 1 .AND. -
49 "{{P3},{EXP_DESC}}" .NE. "{DK_TYP}" THEN
50 WRITE/OUT -
51 "{P3}: *** ERROR: Exposure descriptor {EXP_DESC} has wrong type"
52 RETURN
53 ENDIF
54 ENDIF
55 !
56 IF M$EXISTD(P1,O_DESC) .NE. 0 THEN
57 WRITE/OUT "{P1}: *** ERROR: Exposure descriptor {O_DESC} is missing"
58 RETURN
59 ENDIF
60 !
61 ! *** set the processing keywords
62 DEFINE/LOCAL OBSTIM/R/1/2 0.0,0.0
63 OBSTIM(1) = {{P1},{O_DESC}}
64 OBSTIM(2) = {{P3},{O_DESC}}
65 IF OBSTIM(1) .LE. 0 THEN
66 WRITE/OUT "{P1}: *** ERROR: Input frame has invalid exposure time"
67 RETURN
68 ELSEIF OBSTIM(2) .LE. 0 THEN
69 WRITE/OUT "{P3}: *** ERROR: Dark frame has invalid exposure time"
70 RETURN
71 ELSE
72 CCDDARK = OBSTIM(1)/OBSTIM(2)
73 ENDIF
74 !
75 ! *** do the correction and administration
76 COMPUTE/IMAGE {P2} = {P1} - {CCDDARK}*{P3}
77 WRITE/DESCR {P2} CCDSTAT/I/5/1 1 ! dark correction done
78 WRITE/DESCR {P2} HISTORY/C/-1/80 "DARK/CCD {P1} {P2} {P3}
79 IF VERBOSE(1:1) .EQ. "Y" THEN
80 STATISTIC/IMAGE {P2} {IM_SEC} ? ? FF ! full statistics
81 ELSE
82 STATISTIC/IMAGE {P2} {IM_SEC} ? ? FX ! short statistics
83 ENDIF
84 !
85 RETURN
86
87
88
89