Changeset 2867 for trunk/python


Ignore:
Timestamp:
11/25/13 16:47:38 (11 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-5526)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: unit test of sdplot and sdbaseline

Put in Release Notes: No

Module(s): All sd tasks

Description: Enabled selection string '*' and to select all data in the range [minval,maxval] in _parse_selection(). Also minor improvements of parser to handle spaces.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2844 r2867  
    16541654            maskstring = str(valid_ifs)[1:-1]
    16551655        ## split each selection "IF range[:CHAN range]"
    1656         sellist = maskstring.split(',')
     1656        # split maskstring by "<spaces>,<spaces>"
     1657        comma_sep = re.compile('\s*,\s*')
     1658        sellist = comma_sep.split(maskstring)
     1659        # separator by "<spaces>:<spaces>"
     1660        collon_sep = re.compile('\s*:\s*')
    16571661        for currselstr in sellist:
    1658             selset = currselstr.split(':')
     1662            selset = collon_sep.split(currselstr)
    16591663            # spw and mask string (may include ~, < or >)
    16601664            spwmasklist = self._parse_selection(selset[0], typestr='integer',
     
    17961800            maxidx = max(idx)
    17971801            del idx
    1798         sellist = selexpr.split(',')
     1802        # split selexpr by "<spaces>,<spaces>"
     1803        comma_sep = re.compile('\s*,\s*')
     1804        sellist = comma_sep.split(selexpr)
    17991805        idxlist = []
    18001806        for currselstr in sellist:
     
    18291835            --> returns [[0.,2.5],[5.0,7.0],[9.,9.]]
    18301836        """
    1831         selgroups = selstr.split(';')
     1837        # split selstr by '<spaces>;<spaces>'
     1838        semi_sep = re.compile('\s*;\s*')
     1839        selgroups = semi_sep.split(selstr)
    18321840        sellists = []
    18331841        if typestr.lower().startswith('int'):
     
    18381846       
    18391847        for currsel in  selgroups:
     1848            if currsel.strip() == '*' or len(currsel.strip()) == 0:
     1849                minsel = minval
     1850                maxsel = maxval
    18401851            if currsel.find('~') > 0:
    18411852                # val0 <= x <= val1
    18421853                minsel = formatfunc(currsel.split('~')[0].strip())
    1843                 maxsel = formatfunc(currsel.split('~')[1].strip()) 
     1854                maxsel = formatfunc(currsel.split('~')[1].strip())
    18441855            elif currsel.strip().find('<=') > -1:
    18451856                bound = currsel.split('<=')
Note: See TracChangeset for help on using the changeset viewer.