NRAO Home > CASA > CASA Toolkit Reference Manual
table.rownumbers - Function

3.2.1 !!!INPUT PARAMETERS IGNORED!!! return the row numbers in the (reference) table


Description

!!!NOTE INPUT PARAMETERS IGNORED!!!

This function can be useful after a selection or a sort. It returns the row numbers of the rows in this table with respect to the given table. If no table is given, the original table is used.
For example:

!!!NOTE INPUT PARAMETERS IGNORED!!!  
 
  tb.open(’3C273XC1.MS’)  
  t1=tb.selectrows([1,3,5,7,9])  
  t1.rownumbers()  
# [1L, 3L, 5L, 7L, 9L]  
  t2=t1.selectrows([2,4])  
  t2.rownumbers(t1)  
# [2L, 4L]  
  t2.rownumbers(tb.name())  
# [5L, 9L]  
  t2.rownumbers()  
# [5L, 9L]

The last statements show that the function returns the row numbers referring to the given table. Table t2 contains rows 2 and 4 in table t1, which are rows 5 and 9 in table ’3C273XC1.MS’.

Note that when a table is opened using its name, that table can be a reference table. Thus in the example above the last 2 statements may give different results depending on the fact if 3C273XC1.MS is a reference table or not.
The function should always be called with a table argument. The ability of omitting the argument is only present for backward compatibility.

The function can be useful to get the correct values from the result of a getcol or getcolslice on the original table.

!!!NOTE INPUT PARAMETERS IGNORED!!!

Arguments





Inputs

tab

Table to which the row numbers refer

allowed:

record

Default:

nbytes

Maximum cache size in bytes

allowed:

int

Default:

0

Returns
intArray

Example

 
 
!!!NOTE INPUT PARAMETERS IGNORED!!!  
  tb.open("3C273XC1.MS")  
  tb.nrows()  
#7669L  
  data=tb.getcolslice("DATA", [0,0], [0,0])  
  data.shape  
#(1, 1, 7669)  
  selt=tb.query("ANTENNA1==1")  
  selt.nrows()  
#544L  
  print len(selt.rownumbers())  
#544L  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search