1
! @(#)rebstat.prg 19.1 (ESO-DMD) 02/25/03 14:09:00
2
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
! MIDAS procedure rebstat.prg
5
! K. Banse 980921, 990117
6
! execute via: REBIN/STATISTICS in out xpix,ypix stat_quantity
8
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
define/param p1 ? IMA "Enter input frame: "
11
define/param p2 rebstat IMA "Enter output frame: "
12
define/param p3 8,8 n "Enter xpix,ypix for new pixel:"
13
define/parameter p4 mean ? "Enter statistical value for result image:"
15
define/local myframe/c/1/100 {p1}
16
define/local myres/c/1/100 {p2}
19
define/local tpix/i/1/2 {p3},{p3} !ensure x + y value
20
define/local mynax/i/1/1 1
21
mynax = m$value({myframe},naxis)
22
if mynax .lt. 2 tpix(2) = 1
24
define/local mycomnd/c/1/80 "REBIN/STATISTICS " ? +lower
25
inputc(1:) = myframe // " {myres}"
27
outputc(2:) = "{p3} " // " {p4}"
28
mycomnd(1:) = mycomnd(1:17)//inputc//outputc
30
! choose statistics option
31
branch p4(1:3) MIN,MAX,MOM,MOD,MED MINMAX,MINMAX,MOMENT,MODE,MEDIAN
32
action(1:2) = "sn" !that's needed for MEAN, STD
47
statist/image {myframe} [{tpix(1)}x{tpix(2)}] ? ? {action(1:2)} -
50
if mynax .eq. 1 then !1-dim input frame
51
{myres},npix(1) = m$value({myres},intvals(3))
52
{myres},start(1) = m$value({myframe},start(1))
53
{myres},step(1) = tpix(1)*m$value({myframe},step(1))
56
{myres},npix(1) = m$value({myres},intvals(3))
57
{myres},npix(2) = m$value({myres},intvals(4))
58
{myres},start(1) = m$value({myframe},start(1))
59
{myres},start(2) = m$value({myframe},start(2))
60
{myres},step(1) = tpix(1)*m$value({myframe},step(1))
61
{myres},step(2) = tpix(2)*m$value({myframe},step(2))