Debian Codegraph @

stdred/ccdred/proc/prep_illum.prg

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