Debian Codegraph @

stdred/ccdred/proc/ccdcombine.prg

raw
1 ! @(#)ccdcombine.prg 19.1 (ESO-DMD) 02/25/03 14:15:59
2 ! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 !.IDENTIFICATION: ccdcombine.prg
4 !.PURPOSE: create master calibration frame(s)
5 !.AUTHOR: Rein H. Warmels
6 !.USE: @s ccdcombine
7 !. where p1 = combine options (all available)
8 !. p2 = association table or catalogue
9 !. p3 = output frame (only if input is catalogue)
10 !. p4 = merge option
11 !.USE: For each selected science frame in the table the command
12 ! collects all calibration frames and combined them
13 !. In case the input is a catalogue all frame in the catalogue
14 !. will be combined
15 !.VERSION: 930406 RHW creation
16 !.VERSION: 930725 RHW Now on column names
17 !.VERSION: 950110 RHW Revision; based on new DO ass. table; faster
18 !. Single file input not possible anymore
19 ! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 DEFINE/PARAM P1 ? C "Enter combine option (BS, DK, FF, SK, or OT):"
21 DEFINE/PARAM P2 {CCD_IN} C "Enter input specification [CCD_IN]:"
22 DEFINE/PARAM P4 "M" C "Enter merge option [M]:"
23 !
24 DEFINE/LOCAL ASSCOL/C/1/60 " "
25 DEFINE/LOCAL ACTION/C/1/2 " "
26 !
27 DEFINE/LOCAL TBL/I/1/1 0
28 DEFINE/LOCAL NCA/I/1/1 0
29 DEFINE/LOCAL ICA/I/1/1 0
30 !
31 ! *** check the input
32 IF M$INDEX(P2,".cat") .GT. 1 THEN ! catalogue input
33 DEFINE/PARAMETER P3 ? C "Enter combined output frame:"
34 TBL = 0
35 IF M$EXIST(P2) .EQ. 0 THEN ! check if input is present
36 WRITE/OUT -
37 "*** FATAL: Input catalogue is not present; check your input"
38 RETURN
39 ENDIF
40 !
41 ELSEIF M$INDEX(P2,".tbl") .GT. 1 THEN
42 IF M$EXIST(P2) .EQ. 0 THEN ! check if input is present
43 WRITE/OUT -
44 "*** FATAL: Input association table is not present; check your input"
45 RETURN
46 ENDIF
47
48 ELSE
49 DEFINE/PARAMETER P3 ? C "Enter combined output frame:"
50 TBL = 0
51 ENDIF
52 !
53 ! *** CHECK THE COMBINING OPTION ***
54 !
55 IF P1 .EQ. "BS" THEN ! check combining option
56 WRITE/KEYW EXP/C/1/2 "BS"
57 ASSCOL = BS_COL
58 ELSE IF P1 .EQ. "DK" THEN
59 WRITE/KEYW EXP/C/1/2 "DK"
60 ASSCOL = DK_COL
61 ELSE IF P1 .EQ. "FF" THEN
62 WRITE/KEYW EXP/C/1/2 "FF"
63 ASSCOL = FF_COL
64 ELSE IF P1 .EQ. "SK" THEN
65 WRITE/KEYW EXP/C/1/2 "SK"
66 ASSCOL = SK_COL
67
68 ELSE
69 IF TBL .EQ. 0 THEN ! for catalogue input allow OT
70 IF P1 .EQ. "OT" THEN
71 WRITE/KEYW EXP/C/1/2 "OT"
72 ELSE ! comb option incorrect
73 WRITE/OUT -
74 "*** FATAL <MKCAL>: Unknown combining option {P1}, try again ..."
75 RETURN
76 ENDIF
77 ELSE ! table input
78 WRITE/OUT -
79 "{P1}: *** FATAL: Unknown combine option (use BS, DK, FF, or SK)"
80 RETURN
81 ENDIF
82 ENDIF
83 !
84 !*** All done; now copy combining keywords to local ones
85 DEFINE/LOCAL INCAT/C/1/60 {P2} ! input specification
86 DEFINE/LOCAL OUTFRM/C/1/60 {P3} ! output frame
87 DEFINE/LOCAL SIGMA/C/1/5 {{EXP}_SIG} ! generate an sigma frame
88 DEFINE/LOCAL METHOD/C/1/20 {{EXP}_MET} ! averaging method
89 DEFINE/LOCAL EXPTYP/C/1/20 {{EXP}_TYP} ! which exposure type allowed
90 DEFINE/LOCAL DELETE/C/1/3 {{EXP}_DEL} ! delete input cat + frames
91 DEFINE/LOCAL EXPOSU/C/1/3 {{EXP}_EXP} ! scale by exposure time
92 DEFINE/LOCAL STATIST/C/1/6 {{EXP}_STA} ! statistics mean/median/mode
93 DEFINE/LOCAL SCALE/C/1/3 {{EXP}_SCA} ! scale by mmm
94 DEFINE/LOCAL OFFSET/C/1/3 {{EXP}_OFF} ! add offset from mmm
95 DEFINE/LOCAL WEIGHT/C/1/3 {{EXP}_WEI} ! use the weighted average
96 DEFINE/LOCAL SECTION/C/1/60 {{EXP}_SEC} ! frame section for mode
97 DEFINE/LOCAL RANGE/R/1/2 {{EXP}_RAN(1)},{{EXP}_RAN(2)} ! pixel range
98 DEFINE/LOCAL CLIP/R/1/2 {{EXP}_CLP(1)},{{EXP}_CLP(2)} ! sig clip factor
99 DEFINE/LOCAL BLANK/C/1/20 {{EXP}_NUL} ! null value
100 WRITE/KEYW ACTION/C/1/2 {P4}
101 WRITE/KEYW INPUTR/R/1/1 256
102 !
103 ! *** NOW DO THE COMBINING ***
104 IF TBL .EQ. 1 THEN ! input is an ass. table
105 SET/FORMAT I3
106 IF M$EXISTC(P2,ASSCOL) .EQ. -1 THEN
107 WRITE/OUT "*** WARNING: Cannot find column {ASSCOL} in association table"
108 WRITE/OUT " Check column names in association table"
109 ELSE
110 RUN STD_EXE:CCDCOMB
111 ENDIF
112
113 ELSE ! input is a catalogue
114 RUN STD_EXE:CCDCOMB
115 IF {EXP}_DEL .EQ. "yes" THEN
116 WRITE/OUT "*** INFO: Deleting frames entries in input catalogue"
117 ! DELETE/ICAT {CCD_IN} CONF ?
118 ENDIF
119 ENDIF
120 !
121 RETURN
122
123