Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: table.setmaxcachesize - Function Up: table - Tool Previous: table.colnames - Function


table.rownumbers - Function



Package utility
Module table
Tool table


return the row numbers in the (reference) table


Synopsis
rownumbers(tab, nbytes)


Description
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:
  t:=table('W53.MS')
  t1:=t.selectrows([1,3,5,7,9])
  t1.rownumbers(t)
# [1 3 5 7 9]
  t2:=t1.selectrows([2,5])
  t2.rownumbers(t1)
# [2 5]
  t2.rownumbers(t)
# [3 9]
  t2.rownumbers()
# [3 9]
The last statements show that the function returns the row numbers referring to the given table. Table t2 contains rows 2 and 5 in table t1, which are rows 3 and 9 in table t.

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 W53.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.



Arguments

tab in Table to which the row numbers refer
    Allowed: Record
    Default: F
nbytes in Maximum cache size in bytes
    Allowed: Int


Returns
Vector of Ints


Example
  t:=table("W53.MS")
  t.nrows()
# 1920
  data:=t.getcolslice("Data", [1,1], [1,1])
  data::shape
# [1 1 1920]
  selt:=t.query("ANTENNA1==1")
  selt.nrows()
# 300
  subdata:=data[,,selt.rownumbers(t)]
  subdata::shape
# [300]





next up previous contents index
Next: table.setmaxcachesize - Function Up: table - Tool Previous: table.colnames - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15