Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mrao.cam.ac.uk/~bn204/alma/casata/flex-data-access.html
Дата изменения: Mon Apr 4 13:47:51 2016
Дата индексирования: Sun Apr 10 10:11:46 2016
Кодировка: ISO8859-5
Accessing measurement set data — Bojan Nikolic web pages (r. 329)

Accessing measurement set dataТЖ

The CASA table tool allows access to all data contained in measurement set format. It is however a little cumbersome to use often in scripts and very cumbersome and verbose on the command line.

For this reason I have sketched out a simple, python-orientated, wrapper for data access in casata. This wrapper is contained in the module tools.data. This shows the basics of how it should work – patches to make it better would be very welcome.

The key features that I would like to have in this wrapper are:

  • Nice, short names for commonly used parameters. So “ANTENNA1” is “a1”, etc

  • Flexibility to get multiple columns at once. So by asking for:

    cols=["TIME", "DATA"]
    

    one gets (unsurprisingly) both the time and the data....

  • Automatic interpolation of subsidiary tables onto the time base of the main table. So, if you ask for:

    cols=["DATA", "POINTING_OFFSET"]
    

    then the pointing offsets pulled out of “pointing” sub-table and interpolated to the time base of the main table

  • Automatic join of common parameters. So if you ask for:

    spw=1
    

    You get spectral window 1

The basics are there now, but to make it really useful I need patches from people using it!

ExamplesТЖ

Here are some examples with uid___A002_Xa048f_X1.ms.

  • Get timestamps and visibility data on baseline 0-1 for spw 1:

    >>> msin="/home/bnikolic/data/almagen/uid___A002_Xa048f_X1.ms"
    >>> time, visdata=data.vis(msin, ["TIME", "DATA", ], spw=1, a1=0, a2=1)
    >>> visdata
    array([[[ 0.00281871-0.01850254j,  0.00162236-0.01870679j,
              0.00240437-0.01870679j, ...,  0.00316449-0.01151703j,
              0.00369846-0.01152579j,  0.00382977-0.01135217j]]])
    
  • Get and plot pointing offsets:

    >>> time, point1, point2 =data.vis(msin, ["TIME", "POINTING_OFFSET", ], spw=1, a1=0, a2=2)
    >>> pylab.plot(time, point1[0])
    [<matplotlib.lines.Line2D instance at 0x3efdc68>]
    >>> pylab.plot(time, point2[0])
    [<matplotlib.lines.Line2D instance at 0x3ad4098>]
    >>> pylab.savefig("uid___A002_Xa048f_X1_point.png")
    
    Plot of azimuth offsets
  • Get specific sub-scans (!)

    >>> time, visdata=data.vis(msin, ["TIME", "DATA", ], spw=1, a1=0, a2=2, subscan=1)
    >>> pylab.plot(time, numpy.abs(visdata[0,0,:]))
    [<matplotlib.lines.Line2D instance at 0x79d0ea8>]
    >>> time, visdata=data.vis(msin, ["TIME", "DATA", ], spw=1, a1=0, a2=2, subscan=2)
    >>> pylab.plot(time, numpy.abs(visdata[0,0,:]))
    [<matplotlib.lines.Line2D instance at 0x79d0f38>]
    >>> time, visdata=data.vis(msin, ["TIME", "DATA", ], spw=1, a1=0, a2=2, subscan=3)
    >>> pylab.plot(time, numpy.abs(visdata[0,0,:]))
    [<matplotlib.lines.Line2D instance at 0x3690c20>]
    >>> time, visdata=data.vis(msin, ["TIME", "DATA", ], spw=1, a1=0, a2=2, subscan=4)
    >>> pylab.plot(time, numpy.abs(visdata[0,0,:]))
    [<matplotlib.lines.Line2D instance at 0x44a6dd0>]
    >>> time, visdata=data.vis(msin, ["TIME", "DATA", ], spw=1, a1=0, a2=2, subscan=5)
    >>> pylab.plot(time, numpy.abs(visdata[0,0,:]))
    [<matplotlib.lines.Line2D instance at 0x3d6bc68>]
    >>> pylab.savefig("uid___A002_Xa048f_X1_subs.png")
    
    Plot of azimuth offsets

Here are some new examples on other data set:

  • Obtaining the closure phase:

    >>> data.closurePh(msin, [0,1,3], spw=7, field=0)
    array([[[ 52.87974425,  54.13733906,  54.97565168,  52.62370937,
              52.64148397,  54.30899442,  53.93281406,  52.61754189,
              52.61760492,  56.32891778,  55.98011178,  54.28151425,
              (... rest of data here)
    

Table Of Contents

Previous topic

Some first attempts at casata scripts

Next topic

Analysis of surface error distributions through Moon (or Sun) beam cuts