1
! @(#)ccdtestb3.prg 19.1 (ES0-DMD) 02/25/03 14:17:11
2
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
!.IDENTIFICATION: ccdtestb3.prg
4
!.PURPOSE: Procedure to find the hot pixels in bias frame
5
!.AUTHOR: Rein H. Warmels
7
!. p1 = input bias frame
8
!. p2 = output identifier [bias]
10
!. p4 = radius median filtering
11
!. p5 = overwrite option for filtered bias frame
12
!.USE: @s ccdtestb3 p1 p2 p3 p4 p5
13
!.Algorithm: Find the hot pixels. The combined bias frame is median
14
!. filtered and subtracted from the original. A plot is
15
!. generated showing the position of the hot pixels and the
16
!. affected columns (file {p2}_hotpix.ps). A MIDAS table
17
!. ({p2}_hotpix.tbl) will contain the pixels found.
18
!.VERSION: 940620 RHW creation
19
!.VERSION: 950115 RHW Inclusion of the subtest
20
!.VERSION: 950808 RHE Split in seperate single procedures.
21
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22
DEFINE/PARAMETER P1 ? I "Enter input bias frame:"
23
DEFINE/PARAMETER P2 BIAS C "Enter combined output frame:"
24
DEFINE/PARAMETER P3 [<,<:>,>] C "Enter area:"
25
DEFINE/PARAMETER P4 5 N "Radius med. filtering:"
26
DEFINE/PARAMETER P5 N C "Enter overwrite option:"
28
DEFINE/LOCAL BSSTA/R/1/1 0.0
29
DEFINE/LOCAL BSEND/R/1/1 0.0
30
DEFINE/LOCAL BSSTE/R/1/1 0.0
32
! *** check if file exists
33
IF M$EXIST("{P1}.bdf") .EQ. 0 THEN
34
WRITE/OUT "*** FATAL <TESTB3>: Input bias frame not existing"
38
write/out "Test B3: Finding the hot pixels"
39
write/out "------------------------------------------------------------------"
40
write/out " Generate a table with hot pixels inside the area {p7} by"
41
write/out " subtracting the median smoothed stacked bias from the "
42
write/out " unsmoothed one and doing statistics of the result frame."
43
write/out " A plot and a MIDAS table with the hot pixels area is produced"
46
IF P5(:1) .EQ. "Y" .OR. M$EXIST("{P2}_hotpix.bdf") .EQ. 0 THEN
47
write/out " WARNING: Median filtering will take a while; don't panic."
50
filter/median {p1} &s {p4},{p4},0.0 ? {p3}
52
compute/image {p2}_hotpix = {p2} - &s
54
WRITE/OUT " Hot pixel frame {p2}_hotpix.bdf exists; no new one created"
57
write/desc {p2}_hotpix IDENT/C/1/40 "{DETEC} - Hot pixels"
58
stat/image {p2}_hotpix {p3} ? ? FN
59
bssta = OUTPUTR(3) + 0.25 * OUTPUTR(4) + 5
60
set/graph frame=square xaxis= yaxis= pmode=1
61
plot/cont {p2}_hotpix {p3} ? {bssta} NEG
63
bsend = OUTPUTR(3) + 0.25 * OUTPUTR(4) + 5
65
find/pixel {p2}_hotpix{p3} {bssta},{bsend} out A dummtab 50000
68
IF M$EXIST("dummtab.tbl") .EQ. 0 .OR. {dummtab.tbl,TBLCONTR(4)} .EQ. 0 THEN
69
WRITE/OUT "*** INFO: No pixels found outside range {bssta}, {bsend}"
70
WRITE/OUT " No hot pixel image and table produced"
75
name/colu dummtab :x_pix :x
76
name/colu dummtab :y_pix :y
77
sort/table dummtab :x,:y
78
write/keyw in_a/c/1/60 dummtab
79
write/keyw out_a/c/1/60 {p2}_hotpix
82
IF M$EXIST("{p2}_hotpix.tbl") .EQ. 0 THEN
83
WRITE/OUT "*** INFO: No pixels found outside range {bssta}, {bsend}"
84
WRITE/OUT " No hot pixel image and table produced"
88
select/table {p2}_hotpix :VALUE.GT.0.0
89
read/table {p2}_hotpix
90
overpl/tabl {p2}_hotpix :x :y 5
92
-copy postscript.ps {p2}_hotpix.ps
94
write/out " The contour plot with hot pixels inside area {p7} is "
95
write/out " stored in {p2}_hotpix.ps. The MIDAS table containing the"
96
write/out " the hot pixels is in {p2}_hotpix.tbl"
101
delete/tabl dummtab NO