GreenBankObservatory / dysh

https://dysh.readthedocs.io
Other
9 stars 3 forks source link

getps grabs the wrong data in a SDFITS file with multiple extensions #397

Open astrofle opened 1 week ago

astrofle commented 1 week ago

Describe the bug When working on a file with multiple binary tables, using getps returns the wrong data.

How to Reproduce

from dysh.fits.gbtfitsload import GBTFITSLoad
filename = "/home/sdfits/TRCO_240809_Ku/TRCO_240809_Ku.raw.vegas"
sdf = GBTFITSLoad(filename)
ps_ta = sdf.getps(scan=21, fdnum=0, plnum=0, ifnum=0).timeaverage()
ps_ta.data.shape
    (1024,)

So, dysh returns a Spectrum that has 1024 channels. However, if we look at the raw data we see scan 21 has 2**14 channels:

from astropy.io import fits
hdu = fits.open("/home/sdfits/TRCO_240809_Ku/TRCO_240809_Ku.raw.vegas/TRCO_240809_Ku.raw.vegas.A.fits")
table = hdu[5].data
print(set(table["SCAN"]), table["DATA"].shape)
    {32, 33, 34, 36, 37, 38, 39, 21, 22, 23, 24, 30, 31} (2420, 16384)

Environment

astrofle commented 20 hours ago

May be related to #405