Changeset 2932 for trunk/python


Ignore:
Timestamp:
04/21/14 16:36:29 (11 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: Yes CAS-6465

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd

Description: modified sd.scantable.parse_{idx|spw}_selection() so that no duplicated values appear in returned values.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2930 r2932  
    21452145
    21462146        for spw in res.keys():
    2147             if spw not in valid_ifs:
     2147            if spw in valid_ifs:
     2148                # remove duplicated chennal ranges
     2149                for i in reversed(xrange(len(res[spw]))):
     2150                    for j in xrange(i):
     2151                        if ((res[spw][i][0]-res[spw][j][1])*(res[spw][i][1]-res[spw][j][0]) <= 0):
     2152                            res[spw][j][0] = min(res[spw][i][0], res[spw][j][0])
     2153                            res[spw][j][1] = max(res[spw][i][1], res[spw][j][1])
     2154                            res[spw].pop(i)
     2155                            break
     2156            else:
    21482157                del res[spw]
    21492158
     
    23742383            for thelist in currlist:
    23752384                idxlist += range(thelist[0],thelist[1]+1)
     2385        # remove duplicated elements after first ones
     2386        for i in reversed(xrange(len(idxlist))):
     2387            if idxlist.index(idxlist[i]) < i:
     2388                idxlist.pop(i)
    23762389        msg = "Selected %s: %s" % (mode.upper()+"NO", str(idxlist))
    23772390        asaplog.push(msg)
Note: See TracChangeset for help on using the changeset viewer.