[AstroPy] Documentation or examples for working with UV-FITS files?

Adam Ginsburg adam.g.ginsburg at gmail.com
Fri Dec 20 11:35:40 EST 2013


Hi Eric,
    This should probably be submitted to the NRAO as a feature request
in CASA or a helpdesk ticket; it's probably possible within CASA but
just not well-documented.  If we figure out how to do this, we should
probably get the solution posted on casaguides.nrao.edu.

    That said, UVFITS files are FITS binary tables.  They can be
accesses with astropy.io.fits.  For anyone interested in having a
look, there are a lot of nicely reduced UVFITS files available from
https://archive.nrao.edu/cgi-bin/nvas-pos.pl (which can also be
queried via astroquery.readthedocs.org/en/latest/nvas.html).

Here's an example of how you can examine the contents of a UVFITS file:

In [13]: d = fits.open('1.48F27CB_AY0015_1986OCT06_1.uvfits')

In [14]: d
Out[14]:
[<astropy.io.fits.hdu.image.PrimaryHDU at 0x10104d510>,
 <astropy.io.fits.hdu.table.BinTableHDU at 0x10104dc10>,
 <astropy.io.fits.hdu.table.BinTableHDU at 0x101056c90>,
 <astropy.io.fits.hdu.table.BinTableHDU at 0x10105a8d0>,
 <astropy.io.fits.hdu.table.BinTableHDU at 0x10105f150>,
 <astropy.io.fits.hdu.table.BinTableHDU at 0x1010647d0>]

In [15]: [(x,x.data.shape,x.data.dtype.names) for x in d]
Out[15]:
[(<astropy.io.fits.hdu.image.PrimaryHDU at 0x10104d510>, (0, 777777701), None),
 (<astropy.io.fits.hdu.table.BinTableHDU at 0x10104dc10>,
  (1,),
  ('FRQSEL', 'IF FREQ', 'CH WIDTH', 'TOTAL BANDWIDTH', 'SIDEBAND')),
 (<astropy.io.fits.hdu.table.BinTableHDU at 0x101056c90>,
  (29,),
  ('ANNAME',
   'STABXYZ',
   'NOSTA',
   'MNTSTA',
   'STAXOF',
   'POLTYA',
   'POLAA',
   'POLCALA',
   'POLTYB',
   'POLAB',
   'POLCALB')),
 (<astropy.io.fits.hdu.table.BinTableHDU at 0x10105a8d0>,
  (2007,),
  ('TIME',
   'TIME_INTERVAL',
   'ANTENNA_NO',
   'SUBARRAY',
   'TEMPERATURE',
   'PRESSURE',
   'DEWPOINT',
   'WIND_VELOCITY',
   'WIND_DIRECTION',
   'WVR_H2O',
   'IONOS_ELECTRON')),
 (<astropy.io.fits.hdu.table.BinTableHDU at 0x10105f150>,
  (623,),
  ('TIME1', 'TIME2', 'SOURCE', 'AMPLITUDE', 'RMS', 'WEIGHT', 'CLOSURE')),
 (<astropy.io.fits.hdu.table.BinTableHDU at 0x1010647d0>,
  (50544,),
  ('UU---SIN', 'VV---SIN', 'WW---SIN', 'BASELINE', 'DATE', 'VISIBILITIES'))]


The visibilities are in the last header, so you can grab that table
and plot its various contents:

In [28]: uvtable = d[-1].data

In [29]: vis = uvtable['VISIBILITIES']

In [30]: plot(uvtable['UU---SIN'],uvtable['VV---SIN'],',')
Out[30]: [<matplotlib.lines.Line2D at 0x10b4a4ed0>]

In [31]: plot(uvtable['UU---SIN'],vis.reshape([vis.shape[0],np.product(vis.shape[1:])]),',')
[snipped - there are lots]

Note the last reshaping is because there are lots of axes in
visibilities for polarization and other parameters; I haven't figure
out which headers/keywords describe them, but the information appears
to be there.

This should get you started...

On Fri, Dec 20, 2013 at 5:07 PM, Eric Jensen <ejensen1 at swarthmore.edu> wrote:
> Hi all,
>
> Can anyone point me to any documentation about UV-FITS files?  I'd like to be able to take two UV-FITS files written from CASA (one of observed data and one of a model) and calculate the chi-squared of the data-model comparison in uv space.  But I just can't find enough (read: any) documentation of the format to get a sense of how to do this.
>
> There's some information linked from here:  https://safe.nrao.edu/wiki/bin/view/Software/CasaAipsSpwDefinition
> but it's a little hard (for me at least) to parse.
>
> As far as python implementation, Googling reveals this set of basic routines:
>
> http://www.mrao.cam.ac.uk/~bn204/alma/memo-turb/uvfits.py
>
> but no documentation.   And CASA has some uv data handling routines, but it doesn't appear to have general arithmetic routines for uv data.  So I'd like to try to implement this in python, but I need some docs to help me get started.
>
> Thanks in advance for any help you can give,
>
> Eric
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy



-- 
Adam Ginsburg
Fellow, European Southern Observatory
http://www.adamgginsburg.com/



More information about the AstroPy mailing list