ratt-ru / pyxis

Python Extensions for Interferometry Scripting
3 stars 5 forks source link

Does addcol in argo.py know the shape of an element of a column from the column name? #19

Closed modhurita closed 9 years ago

modhurita commented 9 years ago

For a simulated MS, if I add a BITFLAG_ROW column:

argo.addcol('VLA-C.MS',colname='BITFLAG_ROW',valuetype='int',init_with=0)

And then do:

t = table('VLA-C.MS') t.getcol('BITFLAG_ROW').shape

I get:

(16848, 8, 4)

On the other hand, for the 3C147 data:

t = table('3C147-C-LO.MS') t.getcol('BITFLAG_ROW').shape

gives

(1279516,)

I guess I am supposed to use the shape parameter of addcol to specify the shape of an element? How do I tell it that each element has to be a scalar?

SpheMakh commented 9 years ago

You guess correctly, you have to use the shape option; it uses the shape of DATA by default. Specify the type of the data for the column via the valuetype option; default is complex.

o-smirnov commented 9 years ago

Anyway, you shouldn't need to add bitflag columns by hand. There's an addbitflagcolumn utility that'll do it for you.

o-smirnov commented 9 years ago

I think that's taken care of by the shape argument -- looks like it will make a vector or matrix column automatically based on that.

However, @SpheMakh: take a look at addtiledmscol --help. The xxx_DATA columns can be "tiled" for performance reasons. I don't know if there's a way to create a tiled column from pyrap, at least there wasn't one at the time, so I wrote the addtiedmscol utility (in C++) to do this. You might want to integrate that into addcol() somehow.

On Wed, Dec 24, 2014 at 9:53 AM, Modhurita Mitra notifications@github.com wrote:

@SpheMakh https://github.com/SpheMakh, you might also want to add a vector option to data_desc_type, as the column elements could be scalar, vector, or matrix:

In [12]: t = table('3C147-C-LO.MS') Successful readonly open of default-locked table 3C147-C-LO.MS: 28 columns, 1279516 rows

In [13]: d = t.getcol('WEIGHT_SPECTRUM')

In [14]: d.shape Out[14]: (1279516, 64, 4)

In [15]: d = t.getcol('IMAGING_WEIGHT')

In [16]: d.shape Out[16]: (1279516, 64)

In [17]: d = t.getcol('BITFLAG_ROW')

In [18]: d.shape Out[18]: (1279516,)`

— Reply to this email directly or view it on GitHub https://github.com/ska-sa/pyxis/issues/19#issuecomment-68034332.