Debian Codegraph @

stdred/ccdred/proc/ccdfringe.prg

raw
1 ! @(#)ccdfringe.prg 19.1 (ESO-DMD) 02/25/03 %U
2 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 !.COPYRIGHT (C) 1992 European Southern Observatory
4 !.IDENT ccdfringe.prg
5 !.AUTHOR Rein H. Warmels, ESO-Garching
6 !.KEYWORDS Direct imaging, CCD package
7 !.PURPOSE Do the fringe correction
8 !.VERSION 920731 RHW Creation
9 !.NOTE The procedure checks if the operation was already done
10 !. by checking the descriptor CCDSTAT(8)
11 !. Other CCDSTAT descriptor values
12 !. CCDSTAT(1) for overscan correction
13 !. CCDSTAT(2) for trimming the frame
14 !. CCDSTAT(3) for bad pixel correction
15 !. CCDSTAT(4) for bias subtraction
16 !. CCDSTAT(5) for dark current subtraction
17 !. CCDSTAT(6) for flat fielding
18 !. CCDSTAT(7) for illumination correction
19 !. CCDSTAT(8) for fringing correction
20 !-------------------------------------------------------
21 DEFINE/PARAM P1 ? IMA "Enter input frame: "
22 DEFINE/PARAM P2 ? IMA "Enter output frame: "
23 DEFINE/PARAM P3 {SC_FRFRM} IMA "Enter fringe frame: "
24 DEFINE/PARAM P4 -999 N "Enter fringe scaling factor:"
25 !
26 ! *** check if already corrected
27 IF M$EXISTD(P1,"CCDSTAT") .EQ. 0 THEN
28 WRITE/OUT "{P1}: *** WARNING: No check on CCD reduction status possible"
29 WRITE/DESCR {P1} CCDSTAT/I/1/10 0 ALL
30 ELSE
31 IF {{P1},CCDSTAT(8)} .EQ. 1 THEN
32 WRITE/OUT -
33 "{P1}: *** WARNING: Fringe correction was applied; nothing done ..."
34 RETURN
35 ENDIF
36 ENDIF
37 !
38 ! *** check to frame and its desciptors; exit on errors
39 IF M$EXIST("{P3}.bdf"} .EQ. 0 THEN
40 WRITE/OUT "{P1}: *** ERROR: Fringe correction {P3} doesn't exist ..."
41 RETURN
42 ENDIF
43 IF FR_TYP .NE. "*" .AND. FR_TYP .NE. "?" THEN
44 IF M$EXISTD(P3,EXP_DESC) .EQ. 1 .AND. -
45 "{{P3},{EXP_DESC}}" .NE. "{FR_TYP}" THEN
46 WRITE/OUT -
47 "{P3}: *** ERROR: Exposure descriptor {EXP_DESC} has wrong type"
48 RETURN
49 ENDIF
50 ENDIF
51 !
52 IF M$EXISTD(SC_FRFRM,"MKFRINGE") .EQ. 0 THEN
53 WRITE/OUT "{SC_FRFRM}: MKFRINGE Fringe flag missing in descriptor"
54 RETURN
55 ENDIF
56 IF M$EXISTD(P1,O_DESC) .EQ. 0 THEN
57 WRITE/OUT "{P1}: *** ERROR: Exposure descriptor {O_DESC} is missing"
58 RETURN
59 ENDIF
60 IF M$EXISTD(P3,O_DESC) .EQ. 0 THEN
61 WRITE/OUT "{P3}: *** ERROR: Exposure descriptor {O_DESC} is missing"
62 RETURN
63 ENDIF
64 !
65 ! *** get the desciptors contents
66 DEFINE/LOCAL OBSTIM/R/1/2 0.0,0.0
67 DEFINE/LOCAL FRSCALE/R/1/1/ 0.0
68 OBSTIM(1) = {{P1},{O_DESC}}
69 OBSTIM(2) = {{P3},{O_DESC}}
70 IF OBSTIM(1) .LE. 0 THEN
71 WRITE/OUT "{P1}: *** ERROR: invalid exposure time "
72 RETURN
73 ENDIF
74 IF OBSTIM(2) .LE. 0 THEN
75 WRITE/OUT "{P1}: *** ERROR: {P3} fringe frame has invalid exposure time"
76 RETURN
77 ENDIF
78 !
79 IF M$EXISTD(P3,"FRINGESCALE") .EQ. 1 THEN
80 FRSCALE = {{P3},{FRINGESCALE}}
81 ELSE
82 FRSCALE = 1.0
83 ENDIF
84 IF P4 .NE. -999 THEN
85 FRSCALE = {P4}
86 ENDIF
87 CCDFRING = FRSCALE * OBSTIM(1)/OBSTIM(2)
88 !
89 COMPUTE/IMAGE {P2} = {P1} - CCDFRING*{P3}
90 WRITE/DESCR {P2} CCDSTAT/I/8/1 1 ! dark correction done
91 WRITE/DESCR {P2} HISTORY/C/-1/80 "Processed by @s ccdfrcor {P1} {P2} {P3}
92 IF VERBOSE(1:1) .EQ. "Y" THEN
93 STATISTIC/IMAGE {P2} {IM_SEC} ? ? FF ! full statistics
94 ELSE
95 STATISTIC/IMAGE {P2} {IM_SEC} ? ? FX ! short statistics
96 ENDIF
97 !
98 RETURN
99
100
101