Debian Codegraph @

stdred/ccdred/proc/prep_fring.prg

raw
1 ! @(#)prep_fring.prg 19.1 (ESO-DMD) 02/25/03 14:16:06
2 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 !.COPYRIGHT (C) 1993 European Southern Observatory
4 !.IDENT prep_fring.prg
5 !.AUTHOR Rein H. Warmels, ESO-Garching
6 !.KEYWORDS Direct imaging, CCD package
7 !.PURPOSE Prepare fringe correction image for the reduction
8 !.METHOD - Return if fringecorrection is not requested or has been
9 ! corrected previously
10 !. - Get the fringe correction image. If not found return an error
11 !. - If fringe image has not been processed execute ccdredfrm
12 !. - Set the processing flags.
13 !.PARAMETERS P1: input frame
14 ! P2: correction label string which will be checked by
15 ! ccdcorrect.prg to do the desired actions.
16 !.NOTE The procedure checks if the operation was already done
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 930416 RHW Creation
26 !.VERSION 930507 RHW Check input frame for fringe correction
27 !.VERSION 931015 RHW Inclusion of constant value
28 !.VERSION 940113 RHW Changes for the DO association table
29 !.VERSION 971117 SW correction labels have to be local -> new param.
30 !-------------------------------------------------------
31 DEFINE/PARAM P1 ? I "Enter frame for fringe correction:"
32 DEFINE/PARAM P2 {CCDCORS(1:20)}
33 !The correction label string CCDCORS which will be checked by CCDCORRECT.PRG
34 !has to be local, in order to always get the right link to the actual frame.
35 !In a global definition the correction labels may overwritten by other pre-
36 !pared frames which leads to unwished actions to previous frames (SW,97.11.17).
37 !
38 DEFINE/LOCAL CONST/I/1/1 0
39 !
40 ! *** do we want the fringe correction or has it been done
41 IF SC_FRCOR .NE. "yes" .OR. {{SC_FRFRM},CCDSTAT(8)} .EQ. 1 THEN
42 WRITE/OUT "{P1}: Fringe correction frame not requested or was applied"
43 RETURN {P2}
44 ENDIF
45 !
46 ! *** check the calibration table for the column
47 IF SC_FRFRM(1:1) .EQ. " " THEN ! fringe image unknown
48 WRITE/OUT "{P1}: *** WARNING: Fringe correction unknown or undefined"
49 RETURN {P2}
50 ENDIF
51 !
52 IF M$TSTNO("{SC_FRFRM}") .EQ. 1 THEN
53 CONST = 1
54 ELSE
55 IF M$EXIST("{SC_FRFRM}.bdf") .EQ. 0 THEN ! is it there?
56 WRITE/OUT "{P1}: *** ERROR: Fringe frame {SC_FRFRM} not available"
57 RETURN {P2}
58 ENDIF
59 ENDIF
60 !
61 ! *** return if only listing is wanted
62 IF SC_PROC .EQ. "yes" THEN
63 WRITE/OUT "{P1}: *** TO BE DONE: Fringe correction is {SC_FRFRM}"
64 RETURN {P2}
65 ENDIF
66 !
67 ! *** here for the real thing
68 IF CONST .EQ. 0 THEN ! here for a real frame
69 IF M$EXISTD("{SC_FRFRM}","MKFRINGE") .EQ. 0 THEN
70 WRITE/OUT "{SC_FRFRM}: MKFRINGE Fringe flag missing in descriptor"
71 RETURN {P2}
72 ENDIF
73 DEFINE/LOCAL OBSTIM/R/1/2 0.0,0.0
74 DEFINE/LOCAL FRSCALE/R/1/1/ 0.0
75 OBSTIM(1) = {{P1},{O_DESC}}
76 OBSTIM(2) = {{SC_FRFRM},{O_DESC}}
77 IF OBSTIM(1) .LE. 0 THEN
78 WRITE/OUT "{P1}: *** ERROR: invalid exposure time "
79 RETURN {P2}
80 ENDIF
81 IF OBSTIM(2) .LE. 0 THEN
82 WRITE/OUT -
83 "{P1}: *** ERROR: {SC_FRFRM} fringe frame has invalid exposure time"
84 RETURN {P2}
85 ENDIF
86 !
87 IF M$EXISTD("{SC_FRFRM}","FRINGESCALE") .EQ. 1 THEN
88 FRSCALE = {{SC_FRFRM},{FRINGESCALE}}
89 ELSE
90 FRSCALE = 1.0
91 ENDIF
92 CCDFRING = FRSCALE * OBSTIM(1)/OBSTIM(2)
93 !
94 ELSE ! here for a constant
95 CCDFRING = 1.0
96 ENDIF
97 !
98 WRITE/OUT "{P1}: Fringe correction {SC_FRFRM}; scale = {CCDFRING}"
99 P2(8:8) = "Q"
100 P2(11:11) = "Y"
101 RETURN {P2}
102
103
104
105
106
107
108