Debian Codegraph @

stdred/ccdred/proc/prep_bias.prg

raw
1 ! @(#)prep_bias.prg 19.1 (ES0-DMD) 02/25/03 14:16:05
2 ! @(#)prep_bias.prg 19.1 (ESO-SDAG) 02/25/03 14:16:05
3 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 !.COPYRIGHT (C) 1993 European Southern Observatory
5 !.IDENT prep_bias.prg
6 !.AUTHOR Rein H. Warmels, ESO-Garching
7 !.KEYWORDS Direct imaging, CCD package
8 !.PURPOSE Prepare bias correction image for the reduction
9 !.METHOD - Return if bias correction is not requested or has been
10 !. corrected previously
11 !. - Get the bias correction image. If not found return an error
12 !. - If bias 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 the 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 930416 RHW Creation
27 !.VERSION 930507 RHW Bug fix: Input file checked for being processed
28 !.VERSION 931015 RHW Include constant bias
29 !.VERSION 940113 RHW Change for DO association table
30 !.VERSION 971117 SW correction labels have to be local -> new param.
31 !-------------------------------------------------------
32 DEFINE/PARAM P1 ? I "Input frame for bias 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 bias correction
42 IF SC_BSCOR .NE. "yes" .OR. {{P1},CCDSTAT(4)} .EQ. 1 THEN
43 WRITE/OUT "{P1}: Bias correction not requested or was applied"
44 RETURN {P2}
45 ENDIF
46 !
47 ! *** check the bias image name
48 IF SC_BSFRM(1:1) .EQ. " " THEN ! bias frame unknown
49 WRITE/OUT "{P1}: *** WARNING: Bias correction unknown or undefined"
50 RETURN {P2}
51 ENDIF
52 !
53 ! *** check if bias correction is a constant
54 IF M$TSTNO("{SC_BSFRM}") .EQ. 1 THEN ! check for constant value
55 CONST = 1
56 ELSE ! real frame wanted
57 IF M$EXIST("{SC_BSFRM}.bdf") .EQ. 0 THEN ! check if bias fram exists
58 WRITE/OUT "{P1}: Bias correction {SC_BSFRM} to be created"
59 COMBINE/CCD BS ! combine
60 IF M$EXIST("{SC_BSFRM}.bdf") .EQ. 0 THEN ! is it there?
61 WRITE/OUT "{P1}: *** ERROR: Failed to make bias correction"
62 RETURN {P2}
63 ENDIF
64 ENDIF
65 ENDIF
66 !
67 ! *** no processing requested
68 IF SC_PROC .EQ. "yes" THEN
69 WRITE/OUT "{P1}: *** TO BE DONE: Bias correcting is {SC_BSFRM}"
70 RETURN {P2}
71 ENDIF
72 !
73 ! *** here for the real thing
74 IF CONST .EQ. 0 THEN ! here for a real frame
75 @s ccdcheck {SC_BSFRM} BS ! check if processed
76 IF Q1 .EQ. "1" THEN ! no; not processed
77 @s ccdredfrm {SC_BSFRM} {SC_BSFRM} ! do processing
78 ENDIF
79 ENDIF
80 !
81 WRITE/OUT "{P1}: Bias correction is {SC_BSFRM}"
82 P2(4:4) = "B"
83 P2(11:11) = "Y"
84 RETURN {P2}