Changeset 1639 for branches/alma/python


Ignore:
Timestamp:
09/30/09 17:56:00 (15 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: Yes (CAS-1429)

Ready to Release: Yes

Interface Changes: Yes

What Interface Changed:
A new python method, selector.set_rows(rownrs=[]),
and a cpp function,
STSelector::setRows( const std::vector< int >& rows ),
are added.
The cpp function can be called with selector._setrows()
from python scripts.

Test Programs:

# @casa
s=sd.scantable('ORIGINAL_TABLE_NAME', False)
sel=sd.selector()
rownrs=[1,3,5,7]
sel.set_rows(rownrs)
s.set_selection(sel)
s2=s.copy()
s2.save(name='NEW_TABLE_NAME',format='ASAP',overwrite=True)

Put in Release Notes: Yes

Module(s):

Description:

Data selection by a list of row numbers can be done by
the new method selector.set_rows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/selector.py

    r1603 r1639  
    147147        """
    148148        self._setorder(order)
     149
     150    def set_rows(self, rows=[]):
     151        """
     152        Set a sequence of row numbers (0-based). Power users Only!
     153        NOTICE row numbers can be changed easily by sorting,
     154        prior selection, etc.
     155        Parameters:
     156            rows:    a list of integers. Default [] is to unset the selection.
     157        """
     158        vec = _to_list(rows, int)
     159        if isinstance(vec,list):
     160            self._setrows(vec)
     161        else:
     162            raise TypeError('Unknown row number type. Use lists of integers.')
    149163
    150164    def get_scans(self):
Note: See TracChangeset for help on using the changeset viewer.