1
! @(#)make_cal.prg 19.1 (ES0-DMD) 02/25/03 14:16:03
2
! @(#)make_cal.prg 19.1 (ESO) 02/25/03 14:16:03
3
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
!.COPYRIGHT (C) 1992 European Southern Observatory
6
!.AUTHOR Rein H. Warmels, ESO-Garching
7
!.KEYWORDS Direct imaging, CCD package, combining calibration frames
8
!.PURPOSE Do the frame combining
9
!.USE @@ mkcalfrm [p1] [p2] [p3]
10
!. with p1 = combine option (BS/DK/FF/SK/OT)
11
!. p2 = input catalogue with exposures
12
!. p3 = output combine frame
14
!.VERSION 920629 RHW Creation
15
!.VERSION 920716 RHW parameter p2
16
!.VERSION 930725 RHW chnage of syntax
17
!-------------------------------------------------------
18
DEFINE/PARAMETER P1 ? C "Enter combining option (BS/DK/FF/SK/OT):"
20
DEFINE/LOCAL EXP/C/1/2 " " ALL
21
DEFINE/LOCAL ACTION/C/1/2 " " ALL
23
WRITE/KEYW EXP/C/1/2 "BS"
24
ELSEIF P1 .EQ. "DK" THEN
25
WRITE/KEYW EXP/C/1/2 "DK"
26
ELSEIF P1 .EQ. "FF" THEN
27
WRITE/KEYW EXP/C/1/2 "FF"
28
ELSEIF P1 .EQ. "SK" THEN
29
WRITE/KEYW EXP/C/1/2 "SK"
30
ELSEIF P1 .EQ. "OT" THEN
31
WRITE/KEYW EXP/C/1/2 "OT"
32
ELSE ! comb option incorrect
34
"*** FATAL <MKCAL>: Unknown combining option {P1}, try again ..."
38
DEFINE/PARAMETER P2 ? C "Enter input catalogue:"
39
DEFINE/PARAMETER P3 ? C "Enter combined output frame:"
40
DEFINE/PARAMETER P4 "M" C "Enter merge option [M]:"
42
! *** check the consistency of the input parameters
43
IF M$EXIST("{P2}") .EQ. 0 THEN
44
WRITE/OUT "*** FATAL <MKCAL>: Catalogue {P2} not existing"
48
! *** All done; now copy remaining keywords to local ones
49
DEFINE/LOCAL INCAT/C/1/60 {P2} ! input catalog
50
DEFINE/LOCAL OUTFRM/C/1/60 {P3} ! output frame
51
DEFINE/LOCAL SIGMA/C/1/5 {{EXP}_SIG} ! generate an output sigma frame
52
DEFINE/LOCAL METHOD/C/1/20 {{EXP}_MET} ! averaging method
53
DEFINE/LOCAL EXPTYP/C/1/20 {{EXP}_TYP} ! which exposure type allowed
54
DEFINE/LOCAL DELETE/C/1/3 {{EXP}_DEL} ! delete input cat + frames
55
DEFINE/LOCAL EXPOSU/C/1/3 {{EXP}_EXP} ! scale by exposure time
56
DEFINE/LOCAL SCALE/C/1/3 {{EXP}_SCA} ! scale by the mode
57
DEFINE/LOCAL OFFSET/C/1/3 {{EXP}_OFF} ! add offset from mode
58
DEFINE/LOCAL WEIGHT/C/1/3 {{EXP}_WEI} ! use the weighted average
59
DEFINE/LOCAL SECTION/C/1/60 {{EXP}_SEC} ! frame section for finding mode
60
DEFINE/LOCAL RANGE/R/1/2 {{EXP}_RAN(1)},{{EXP}_RAN(2)} ! pixel range
61
DEFINE/LOCAL CLIP/R/1/2 {{EXP}_CLP(1)},{{EXP}_CLP(2)} ! sigma clip factor
62
DEFINE/LOCAL BLANK/C/1/20 {{EXP}_NUL} ! null value
64
WRITE/KEYW ACTION/C/1/2 {P4}
65
WRITE/KEYW INPUTR/R/1/1 256
68
WRITE/OUT "Combining BIAS frames: Input={INCAT}; output={OUTFRM}"
69
ELSEIF EXP .EQ. "DK" THEN
70
WRITE/OUT "Combining DARK frames: Input={INCAT}; output={OUTFRM}"
71
ELSEIF EXP .EQ. "FF" THEN
72
WRITE/OUT "Combining FLAT frames: Input={INCAT}; output={OUTFRM}"
73
ELSEIF EXP .EQ. "SK" THEN
74
WRITE/OUT "Combining SKY frames: Input={INCAT}; output={OUTFRM}"
75
ELSEIF EXP .EQ. "OT" THEN
76
WRITE/OUT "Combining OTHER frames: Input={INCAT}; output={OUTFRM}"
80
! *** check on existence of the output frame
81
IF M$EXIST("{OUTFRM}") .EQ. 0 THEN ! is it there?
85
! *** write the descriptors
86
WRITE/DESCR {OUTFRM} LHCUTS/R/1/1 {OUTPUTR(1)},{OUTPUTR(2)}
87
WRITE/DESCR {OUTFRM} MEAN/R/1/1 {OUTPUTR(3)}
88
WRITE/DESCR {OUTFRM} MODE/R/1/1 {OUTPUTR(7)}
89
WRITE/DESCR {OUTFRM} MEDIAN/R/1/1 {OUTPUTR(8)}
91
! *** delete files if requested
92
IF {EXP}_DEL .EQ. "yes" THEN
93
WRITE/OUT "{P1}: Deleting frames entries in input catalogue"
94
! DELETE/ICAT {CCD_IN} CONF ?