Usage of findChannelRanges
Return to directory of Todd's CASA extensions
Main Usage
findChannelRanges(filename='', threshold=0.0, minwidth=1, startchan=0, chanavg=1,
nchan=0, absorption=False, extrachan=0, figfile='', spw='', outfile='',
subcube=False, invertstring='', vis='')
Takes as input an ascii spectrum output from an image cube at a specific location (pixel or region):
- column 0 is the frequency/velocity axis
- column 1 is the flux density axis.
This function finds all channel ranges wider than 'minwidth' channels that are below a 'threshold' flux density. It can thus be used to find a list of channel ranges that are free of
emission lines. It also reports a list of the inverse channel ranges (in this case, minwidth is not applied). It returns these two lists as strings.
- Using 'startchan' and 'chanavg', it can convert the resulting channel ranges back to the parent uv dataset, accounting for any channel averaging that was used in CLEAN.
- The 'nchan' argument can be used to tell it how many channels were in the original dataset in case a final block of channels was not CLEANed. Note that if you are processing multiple subcubes from a single spw and will concatenate the resulting channel lists, then you probably do not want to use this parameter.
- The 'absorption' argument can be used if you are trying to avoid absorption lines instead of emission lines. In this case the threshold should be set to just below the typical continuum level, as it will simply negate the data and the threshold and process as normal. If absorption=True and threshold is a list of two values (e.g. [-0.2,0.4]), the more negative one will be interpreted as the absorption threshold and the more positive one will be interpreted as the emission threshold.
- The 'extrachan' argument will remove additional channels from both sides of each offending region.
- If present, the 'spw' argument will be inserted at the beginning of the string followed by a colon.
- If 'outfile' is present, the printed results will be written to this filename.
- If 'subcube' is True, then the linefull region will not propagate to channels less than the startchan. Otherwise it will fill to channel zero.
Secondary Usage
The following is useful for converting a list of line-free channel ranges (e.g. passed to uvcontsub) into a list of line-full channel ranges to pass to flagdata before running split to create a continuum measurement set.
- If 'invertstring' is a non-empty string, then it will ignore any filename and will simply invert the list of channel ranges given by the string and stop. In this mode, only startchan, nchan and spw parameters will influence the result.
- vis: used with the 'invertstring' option to specify the measurement set from which to read the number of channels in each spw
Examples
Main Usage
CASA <4>: au.findChannelRanges('spw2a_test.txt',chanavg=2,startchan=20,nchan=3840,extrachan=2,threshold=-0.1,absorption=True,figfile='test')
linefree = '42~70,82~90,102~106,134~164,180~226,238~270,282~316,328~346,358~466,486~544,560~720,740~750,772~792,806~874,906~932,944~980,1000~1010,1030~1090,1102~1140,1160~1164,1184~1198,1210~1292,1304~1318,1330~1346,1360~1418,1430~1522,1536~1538,1550~1598,1610~1618,1638~1664,1680~1698,1724~1728,1742~1786,1806~1812,1824~1838,1852~1854,1868~1900'
676/950 image channels selected (71.16%)
linefull = '0~41,71~81,91~101,107~133,165~179,227~237,271~281,317~327,347~357,467~485,545~559,721~739,751~771,793~805,875~905,933~943,981~999,1011~1029,1091~1101,1141~1159,1165~1183,1199~1209,1293~1303,1319~1329,1347~1359,1419~1429,1523~1535,1539~1549,1599~1609,1619~1637,1665~1679,1699~1723,1729~1741,1787~1805,1813~1823,1839~1851,1855~1867,1901~3839'
Figured saved to test.png
Secondary Usage
This usage can also be called by the simpler wrapper function:
invertChannelRanges.
CASA <2>: au.findChannelRanges(invertstring='0:5~10;50~100, 1:30~40;110~119',nchan=128)
inverse = '0:0~4;11~49;101~127, 1:0~29;41~109;120~127'
CASA <3>: au.findChannelRanges(invertstring='5~10;50~100')
inverse = '0~4;11~99'
--
ToddHunter - 2012-06-08