Changeset 947 for trunk/python


Ignore:
Timestamp:
03/30/06 15:40:17 (19 years ago)
Author:
mar637
Message:

made use of selector class, added sort order to _plot command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r935 r947  
    1 from asap import rcParams, print_log
     1from asap import rcParams, print_log, selector
    22from numarray import logical_and
    33
     
    3636        self._usermask = []
    3737        self._maskselection = None
    38         from asap._asap import selector
    3938        self._selection = selector()
    4039
     
    324323            self._usermask = []
    325324            self._maskselection = None
    326         from asap._asap import selector
    327325        if isinstance(selection, selector):
    328             self._maskselection = {'b': selection._getbeams(),
    329                                    's': selection._getscans(),
    330                                    'i': selection._getifs(),
    331                                    'p': selection._getpols(),
     326            self._maskselection = {'b': selection.get_beams(),
     327                                   's': selection.get_scans(),
     328                                   'i': selection.get_ifs(),
     329                                   'p': selection.get_pols(),
    332330                                   't': [] }
    333331        else:
     
    363361
    364362    def _plot(self, scan):
    365         savesel = scan._getselection()
    366         scan._setselection(self._selection)
     363        savesel = scan.get_selection()
     364        sel = savesel +  self._selection
     365        d0 = {'s': 'SCANNO', 'b': 'BEAMNO', 'i':'IFNO',
     366              'p': 'POLNO', 'c': 'CYCLENO', 't' : 'TIME' }
     367        order = [d0[self._panelling],d0[self._stacking]]
     368        sel.set_order(order)
     369        scan.set_selection(sel)
    367370        d = {'b': scan.getbeam, 's': scan.getscan,
    368371             'i': scan.getif, 'p': scan.getpol, 't': scan._gettime }
    369372
    370         polmodes = dict(zip(self._selection._getpols(),self._selection._getpoltypes()))
     373        polmodes = dict(zip(self._selection.get_pols(),self._selection.get_poltypes()))
    371374        n,nstack = self._get_selected_n(scan)
    372375        maxpanel, maxstack = 9,4
     
    474477                pass#break
    475478            r+=1 # next row
    476 
    477         scan._setselection(savesel)
     479        #reset the selector to the scantable's original
     480        scan.set_selection(savesel)
    478481
    479482    def set_selection(self, selection=None, refresh=True):
    480         from asap._asap import selector
    481         self._selection = selection or selector()
     483        self._selection = isinstance(selection,selector) and selection or selector()
    482484        d0 = {'s': 'SCANNO', 'b': 'BEAMNO', 'i':'IFNO',
    483485              'p': 'POLNO', 'c': 'CYCLENO', 't' : 'TIME' }
    484486        order = [d0[self._panelling],d0[self._stacking]]
    485         self._selection._setorder(order)
     487        self._selection.set_order(order)
    486488        if self._data and refresh: self.plot(self._data)
    487489
     
    489491        d1 = {'b': scan.nbeam, 's': scan.nscan,
    490492             'i': scan.nif, 'p': scan.npol, 't': scan.ncycle }
    491         d2 = { 'b': len(self._selection._getbeams()),
    492                's': len(self._selection._getscans()),
    493                'i': len(self._selection._getifs()),
    494                'p': len(self._selection._getpols()),
    495                't': len(self._selection._getcycles()) }
     493        d2 = { 'b': len(self._selection.get_beams()),
     494               's': len(self._selection.get_scans()),
     495               'i': len(self._selection.get_ifs()),
     496               'p': len(self._selection.get_pols()),
     497               't': len(self._selection.get_cycles()) }
    496498        n =  d2[self._panelling] or d1[self._panelling]()
    497499        nstack = d2[self._stacking] or d1[self._stacking]()
     
    499501
    500502    def _get_label(self, scan, row, mode, userlabel=None):
    501         pms = dict(zip(self._selection._getpols(),self._selection._getpoltypes()))
     503        pms = dict(zip(self._selection.get_pols(),self._selection.get_poltypes()))
    502504        if len(pms):
    503505            poleval = scan._getpollabel(scan.getpol(row),pms[scan.getpol(row)])
Note: See TracChangeset for help on using the changeset viewer.