~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to stdred/ccdtest/proc/ccdtestb3.prg

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
6
!.USE:            @s ccdtestb3
 
7
!.                      p1 = input bias frame
 
8
!.                      p2 = output identifier [bias]
 
9
!.                      p3 = area 
 
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:"
 
27
!
 
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
 
31
!
 
32
! *** check if file  exists
 
33
IF M$EXIST("{P1}.bdf") .EQ. 0 THEN
 
34
   WRITE/OUT "*** FATAL <TESTB3>: Input bias frame not existing"
 
35
   RETURN/EXIT
 
36
ENDIF
 
37
!
 
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"
 
44
write/out " "
 
45
!
 
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."
 
48
   set/midas output=no
 
49
   set/format I1
 
50
   filter/median {p1} &s {p4},{p4},0.0 ? {p3}
 
51
   set/midas output=yes
 
52
   compute/image {p2}_hotpix = {p2} - &s
 
53
else
 
54
   WRITE/OUT "     Hot pixel frame {p2}_hotpix.bdf exists; no new one created"
 
55
endif
 
56
!
 
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 
 
62
bssta = -999999
 
63
bsend = OUTPUTR(3) + 0.25 * OUTPUTR(4) + 5
 
64
set/midas output=no
 
65
find/pixel {p2}_hotpix{p3} {bssta},{bsend} out A dummtab 50000
 
66
set/midas output=yes
 
67
!
 
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"
 
71
   write/out " "
 
72
   RETURN
 
73
 
 
74
ELSE
 
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
 
80
   run STD_EXE:ccdhotpix
 
81
!
 
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"
 
85
      RETURN
 
86
 
 
87
   ELSE
 
88
      select/table {p2}_hotpix :VALUE.GT.0.0
 
89
      read/table {p2}_hotpix
 
90
      overpl/tabl {p2}_hotpix :x :y 5
 
91
      copy/graph postscript
 
92
      -copy postscript.ps {p2}_hotpix.ps
 
93
      write/out " "
 
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"
 
97
      write/out " "
 
98
      delete/imag &s NO
 
99
   ENDIF
 
100
ENDIF
 
101
delete/tabl dummtab NO
 
102
!
 
103
RETURN
 
104
 
 
105
 
 
106
 
 
107