Opened 12 years ago

Closed 12 years ago

#277 closed enhancement (fixed)

data selection improvement (from CAS-2820)

Reported by: Kana Sugimoto Owned by: Kana Sugimoto
Priority: low Milestone: Unified development
Component: General Version: 2.0
Severity: normal Keywords:
Cc:

Description

Enable, e.g., scans = "1~5,8~10", in scantable selection. Currently user should set scans = [1,2,3,4,5,8,9,10] for equivalent selection and it's cumbersome.

Change History (3)

comment:1 Changed 12 years ago by Kana Sugimoto

Status: newassigned

comment:2 Changed 12 years ago by Kana Sugimoto

Date: 2012/07/31
Rev.: 2611
Codes: scantable.py

Added a new method, scantable.parse_idx_selection(mode, expr), in scantable class to enable CASA type selection syntax of SCANNO, IFNO, POLNO, BEAMNO and row IDs in scantable.
This method parses a comma separated selection expression (expr) in a string to a list of IDs to set to selector. Index ranges in scantable are taken into account when parsing.
Available modes are, 'scan' (parses SCANNO selection), 'if' (prases IFNO selection), 'pol' (parses POLNO selection), 'beam' (parses BEAMNO selection), and 'row' (parses row id selction).

Usage:
stab = asap.scantable("SCANTABLE_NAME")
stab.scannos() # assume this returns successive numbers from 2 to 20.
scanlist = stab.parse_idx_selection("scan","<5,10~13,>18")
# returns [2,3,4, 10,11,12,13, 19,20]
stab.set_selection(scans=scanlist)

Also made "<=" and ">=" available in scantable._parse_selection().

comment:3 Changed 12 years ago by Kana Sugimoto

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.