While it is very useful to have many independent sources within one scantable, it is often inconvenient for data processing. The get_scan function can be used to create a new scantable with a selection of scans from a scantable. The selection can either be on the source name, with simple wildcard matching or set of scan ids. Internally this uses the selector object, so for more complicated selection the selector should be used directly instead.
For example:
ASAP>ss = scans.get_scan(10) # Get the 11th scan (zero based) ASAP>ss = scans.get_scan(range(10)) # Get the first 10 scans ASAP>ss = scans.get_scan(range(10,20)) # Get the next 10 scans ASAP>ss = scans.get_scan([2,4,6,8,10]) # Get a selection of scans ASAP>ss = scans.get_scan('345p407') # Get a specific source ASAP>ss = scans.get_scan('345*') # Get a few sources ASAP>r = scans.get_scan('*_R') # Get all reference sources (Parkes/Mopra) ASAP>s = scans.get_scan('*^_R') # Get all program sources (Parkes/Mopra) ASAP>r = scans.get_scan('*[ew]') # Get all reference sources (Tid) ASAP>s = scans.get_scan('*[^ew]') # Get all program sources (Tid)
One can also apply the inverse of get_scan drop_scan
To copy a scantable the following does not work:
ASAP>ss = scans
as this just creates a reference to the original scantable. Any changes made to ss are also seen in scans. To duplicate a scantable, use the copy function.
ASAP>ss = scans.copy()