1
! @(#)ccdtestf2.prg 19.1 (ES0-DMD) 02/25/03 14:17:12
2
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
!.IDENTIFICATION: ccdtestf2.prg
4
!.PURPOSE: Procedure to test the ccd flat for cold pixels
5
!.AUTHOR: Rein H. Warmels
7
!. where p1 = input frame
8
!. p2 = output identifier [flat]
10
!. p4 = range in exposure time
11
!. p5 = overwrite flag
12
!.USE: @@ ccdtestf1 p1 p2 p3 p4 p5 p6
13
!.Algorithm: Creating a cold pixel table.
14
! First the combined flat is corrected for the bias
15
! offset. Therafter all pixels in the stacked master
16
! flat frame that show values less than {p6} times the
17
! median counts in the frame are listed. Only pixels
18
! within the area {p5} are considered and repetitions
19
! of cold pixels in the increasing y coordinate are
21
!.VERSION: 940620 RHW creation
22
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23
DEFINE/PARAMETER P1 ? C "Enter input frame:"
24
DEFINE/PARAMETER P2 FLAT C "Enter output identifier:"
25
DEFINE/PARANETER P3 [<,<:>,>] C "Enter area for median filtering:"
26
DEFINE/PARAMETER P4 5.0 N "Enter sigma multiplier for cold pixels:"
27
DEFINE/PARAMETER P5 N C "Enter overwrite option:"
29
DEFINE/LOCAL CDSTA/R/1/1 0.0
30
DEFINE/LOCAL CDEND/R/1/1 0.0
32
! *** check if the input frame exists
33
IF M$EXIST("{P1}.bdf") .EQ. 0 THEN
34
WRITE/OUT "*** FATAL <CCDTESTF2>: Input flat frame {p1} not existing."
38
write/out "Test F2: Creating a cold pixel table"
39
write/out "------------------------------------------------------------------"
40
write/out " First the bias corrected combined flat will be corrected for"
41
write/out " its large scale structure by dividing it by its median one"
42
write/out " All pixels in the resulting frame showing values less than"
43
write/out " {p4} sigma below it mean value counts areare considered cold"
44
write/out " and listed in the output table. Only pixels within the area "
45
write/out " {p5} are considered and repetitions of cold pixels in the "
46
write/out " increasing y coordinate are not listed."
49
IF P5(:1) .EQ. "Y" .OR. M$EXIST("{P2}_corr.bdf") .EQ. 0 THEN
50
write/out " WARNING: Median filtering will take a while; don't panic."
53
filter/median {p1} &f 5,5 ? {p3}
55
compute/image {p2}_corr = {p1}/&f
57
WRITE/OUT " Flat was already corrected for large scale structure"
59
stat/imag {p2}_corr {p3} ? ?
60
cdsta = OUTPUTR(3) - {P4}*{OUTPUTR(4)}
63
find/pixel {p2}_corr{p3} {cdsta},{cdend} out A dummtab 20000
65
if M$EXIST("dummtab.tbl") .EQ. 0 then
67
write/out " *** INFO: No cold pixels below intensity {cdsta}"
69
name/colu dummtab :x_pix :x
70
name/colu dummtab :y_pix :y
71
sort/table dummtab :x,:y
72
write/keyw in_a/c/1/60 dummtab
73
write/keyw out_a/c/1/60 {p2}_coldpix
76
if M$EXIST("{out_a}.tbl") .EQ. 0 then
77
write/out " No cold pixels in output cold pixel table."
79
read/table {p2}_coldpix
80
write/out " Cold pixels inside the area {p3} are stored in MIDAS "
81
write/out " table {p2}_coldpix.tbl"
82
delete/table dummtab NO