Changeset 1594


Ignore:
Timestamp:
07/06/09 11:12:38 (15 years ago)
Author:
Malte Marquarding
Message:

More tidy up. factored out copy for localised selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1593 r1594  
    171171            else: raise
    172172        try:
    173             bsel = self.get_selection()
    174173            sel = selector(scans=allscans)
    175             self.set_selection(bsel+sel)
    176             scopy = self._copy()
    177             self.set_selection(bsel)
    178             return scantable(scopy)
     174            return self._select_copy(sel)
    179175        except RuntimeError:
    180176            if rcParams['verbose']:
     
    182178            else:
    183179                raise
     180
     181    def _select_copy(self, selection):
     182        orig = self.get_selection()
     183        self.set_selection(orig+selection)
     184        cp = self.copy()
     185        self.set_selection(orig)
     186        return cp
    184187
    185188    def get_scan(self, scanid=None):
     
    214217            if type(scanid) is str:
    215218                sel.set_name(scanid)
    216                 self.set_selection(bsel+sel)
    217                 scopy = self._copy()
    218                 self.set_selection(bsel)
    219                 return scantable(scopy)
     219                return self._select_copy(sel)
    220220            elif type(scanid) is int:
    221221                sel.set_scans([scanid])
    222                 self.set_selection(bsel+sel)
    223                 scopy = self._copy()
    224                 self.set_selection(bsel)
    225                 return scantable(scopy)
     222                return self._select_copy(sel)
    226223            elif type(scanid) is list:
    227224                sel.set_scans(scanid)
    228                 self.set_selection(sel)
    229                 scopy = self._copy()
    230                 self.set_selection(bsel)
    231                 return scantable(scopy)
     225                return self._select_copy(sel)
    232226            else:
    233227                msg = "Illegal scanid type, use 'int' or 'list' if ints."
     
    510504        """
    511505        Get a list of Positions on the sky (direction) for the observations.
    512         Return a float for each integration in the scantable.
     506        Return a string for each integration in the scantable.
    513507        Parameters:
    514508            row:    row no of integration. Default -1 return all rows
Note: See TracChangeset for help on using the changeset viewer.