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

« back to all changes in this revision

Viewing changes to stdred/ccdtest/proc/ccdtestb5.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
! @(#)ccdtestb5.prg     19.1 (ESO-DMD) 02/25/03 14:17:11
 
2
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
3
!.IDENTIFICATION: ccdtestb5.prg
 
4
!.PURPOSE:        Procedure to find the means and standard deviations
 
5
!.AUTHOR:         Rein H. Warmels
 
6
!.USE:            @s ccdtestb5
 
7
!.                where p1 = input catalogue containing the ccd bias frames
 
8
!.                      p2 = output identifier [bias]
 
9
!.                      p3 = area
 
10
!.                      p4 = radius of smoothing box for median filtering,
 
11
!.                           decimation factor for image size reduction
 
12
!.USE:            @s ccdtestb5 p1 p2 p3 p4 
 
13
!.Algorithm:      Determination of the bias level and standard deviation. For 
 
14
!.                each input frame in the catalogue determine the mean bias 
 
15
!.                and standard deviation after hot pixel correction, box 
 
16
!.                averaging and median filtering. The overall mean bias level 
 
17
!.                and  mean sigma is computed."
 
18
!.VERSION:        940620 RHW creation
 
19
!.VERSION:        950115 RHW Inclusion of the subtest 
 
20
!.VERSION:        950808 RHW Split into single procedures
 
21
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
22
 
23
define/parameter p1  ?         C  "Enter input catalogue:"
 
24
define/parameter p2  BIAS      C  "Enter output identifier:"
 
25
define/parameter p3  [<,<:>,>] C  "Enter area:"
 
26
define/parameter p4  5,10      N  "Radius med. filtering, and dec. factor:"
 
27
!
 
28
write/keyw   inputi/i/1/2     {P4}
 
29
write/keyw   radius/i/1/1     {inputi(1)}
 
30
define/local nbox/i/1/1       {inputi(2)}
 
31
define/local mean/r/1/1 0.0
 
32
define/local msum/r/1/1 0.0
 
33
define/local sigm/r/1/1 0.0
 
34
define/local ssum/r/1/1 0.0
 
35
define/local frame/c/1/60 " "
 
36
define/local myouta/c/1/60 " "
 
37
write/keyw   catal/i/1/1 0
 
38
write/keyw   rebin/c/1/3 "mea"
 
39
define/local ifrm/i/1/1 0
 
40
!
 
41
! *** check if the catalogue exists
 
42
IF M$EXIST(P1) .EQ. 0 THEN
 
43
   WRITE/OUT "*** FATAL <CCDTESTB5>: Catalogue {P2} not existing"
 
44
   RETURN
 
45
ENDIF
 
46
!
 
47
write/out "Test B5: Determination of the bias level and standard deviation"
 
48
write/out "------------------------------------------------------------------"
 
49
write/out "     For each input frame in the catalogue determine the mean"
 
50
write/out "     BIAS and standard deviation AFTER hot pixel correction,"
 
51
write/out "     Box averaging and median filtering." 
 
52
write/out "     Finally, the overall mean bias level and sigma are computed."
 
53
write/out
 
54
create/table {p2}_mean 3 10 null
 
55
create/colum {p2}_mean :NAME  "   " A20  C*20
 
56
create/colum {p2}_mean :MEAN  "ADU" F9.4 R*4
 
57
create/colum {p2}_mean :SIGMA "ADU" F9.4 R*4
 
58
LOOP2:
 
59
   store/frame in_a {p1} 1 FINISH
 
60
   ifrm  = ifrm + 1
 
61
   frame = in_a
 
62
   set/midas output=no
 
63
   if M$EXIST("{p2}_hotpix.tbl") .EQ. 1 THEN
 
64
      modify/colu {frame},{p2}_hotpix middummb V        ! modify the hot pixels
 
65
   else
 
66
      copy/ii {frame} middummb
 
67
   endif
 
68
   set/midas output=logonly
 
69
!
 
70
   extract/imag middumma = middummb{p3}
 
71
   in_a  = "middumma"
 
72
   out_a = "bs_mean"
 
73
   out_b = "bs_sigm"
 
74
   myouta = out_a(1:60)
 
75
   run STD_EXE:ccdrebin
 
76
   filter/median {myouta} &a {RADIUS},{RADIUS},0.0 
 
77
   filter/median {OUT_B} &b {RADIUS},{RADIUS},0.0 
 
78
   statist/imag &a ? ? ? NN
 
79
   mean  = outputr(3)
 
80
   statist/imag &b ? ? ? NN
 
81
   sigm = outputr(3)
 
82
   {p2}_mean,:NAME,@{ifrm}  = "{frame}"
 
83
   {p2}_mean,:MEAN,@{ifrm}  =  {mean}
 
84
   {p2}_mean,:SIGMA,@{ifrm} =  {sigm}
 
85
   set/midas output=yes
 
86
   write/out "     Statistics of {frame}: mean = {mean}; sigma = {sigm}"
 
87
   msum = msum + mean
 
88
   ssum = ssum + sigm
 
89
   biasmean = msum/ifrm
 
90
   biassigm = ssum/ifrm
 
91
   goto LOOP2
 
92
FINISH:
 
93
!
 
94
ifrm = ifrm + 1
 
95
{p2}_mean,:NAME,@{ifrm}  = "all_average"
 
96
{p2}_mean,:MEAN,@{ifrm}  =  {biasmean}
 
97
{p2}_mean,:SIGMA,@{ifrm} =  {biassigm}
 
98
delete/imag {myouta} no
 
99
delete/imag {OUT_B} no
 
100
delete/imag &a no
 
101
write/out " "
 
102
write/out -
 
103
       "     Statistics all bias frames: mean = {biasmean}; sigma = {biassigm}"
 
104
 
 
105
write/out "     The MIDAS table with results is in file {p2}_mean.tbl"
 
106
!
 
107
! cleanup 
 
108
delete/imag bs_sigm.bdf NO
 
109
delete/imag bs_mean.bdf NO
 
110
delete/imag postscript.ps NO
 
111
delete/imag screen*.ps NO
 
112
delete/imag screen*.ima NO
 
113
delete/imag graph*.plt NO
 
114
assign/print
 
115
 
 
116
 
 
117