X-Mailer: exmh version 2.0.2 2/24/98
To: wwilson
CC: mkesteve, lstavele
Subject: RPFITS bugs
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Mon, 10 May 1999 17:00:03 +1000
From: Mark Calabretta <mcalabre@grus.atnf.CSIRO.AU>


Warwick,

On looking into why spc_16k didn't reject the flagged data in those files I
found significant bugs in RPFITS for multibeam data.  Your email of 99/03/19
lists 20 syscal quantities for multibeam data whereas RPFITS.INC gives
MAX_SC=16.  However, when I look at SC_CAL in the debugger it seems that
things are screwed up on two fronts.

SC_CAL is dimensioned as SC_CAL(MAX_SC,MAX_IF,ANT_MAX) with MAX_SC=16,
MAX_IF=8, ANT_MAX=15.

(debugger) print sc_cal
sc_cal = 
    (1,1,1)	1.0   <- beam 1
    (2,1,1)	1.0   <- IF no.
    (3,1,1)	0.0
    (4,1,1)	0.0
    (5,1,1)	0.0
    (6,1,1)	0.0
    (7,1,1)	0.0
    (8,1,1)	0.0
    (9,1,1)	0.0
    (10,1,1)	0.0
    (11,1,1)	0.0
    (12,1,1)	0.0
    (13,1,1)	7.0   <- flag for beam 1
    (14,1,1)	0.0
    (15,1,1)	1.0
    (16,1,1)	1.0
    (1,2,1)	0.0
    (2,2,1)	0.0
    (3,2,1)	0.0
    (4,2,1)	0.0   <- end first group of 20
    (5,2,1)	2.0   <- beam 2 in IF 2 for ANT 1
    (6,2,1)	1.0   <- IF no.
    (7,2,1)	0.0
    (8,2,1)	0.0
    (9,2,1)	0.0
    (10,2,1)	0.0
    (11,2,1)	0.0
    (12,2,1)	0.0
    (13,2,1)	0.0
    (14,2,1)	0.0
    (15,2,1)	0.0
    (16,2,1)	0.0
    (1,3,1)	7.0   <- flag for beam 2
    (2,3,1)	0.0
    (3,3,1)	1.0
    (4,3,1)	1.0
    (5,3,1)	0.0
    (6,3,1)	0.0
    (7,3,1)	0.0
    (8,3,1)	0.0   <- end second group of 20
    (9,3,1)	3.0   <- beam 3 in IF 3 for ANT 1
    (10,3,1)	1.0   <- IF no.
    (11,3,1)	0.0
    (12,3,1)	0.0
    (13,3,1)	0.0
    (14,3,1)	0.0
    (15,3,1)	0.0
    (16,3,1)	0.0
    (1,4,1)	0.0
    (2,4,1)	0.0
    (3,4,1)	0.0
    (4,4,1)	0.0
    (5,4,1)	7.0   <- flag for beam 3
    (6,4,1)	0.0
    (7,4,1)	1.0
    (8,4,1)	1.0
    (9,4,1)	0.0
       :         :

So, MAX_SC is written as 20 but read as 16, and the IF and ANT indexes into
SC_CAL appear to be reversed.  RPFITSIN is oblivious to this because of the
way it equivalences SC_CAL to the input buffer.

livedata is not affected because it computes array indices itself assuming
that the C array is dimensioned as sc_cal[sc_q*sc_ant].

I think the situation can be recovered by setting MAX_SC=20 and declaring
SC_CAL as SC_CAL(MAX_SC,ANT_MAX,MAX_IF) in RPFITS.INC.  I don't know how
this will affect other RPFITS reading software though (e.g. ATLOD).

Cheers(?), Mark


