countChannels

Return to directory of Todd's CASA extensions

Counts the number of channels in a CASA channel selection string. If multiple spws, then return a dictionary of counts, e.g. "1:5~20;30~40" yields 27; or '6~30' yields 25 "1:5~20;30~40,2:6~30" yields {'1':27, '2':25}. See also invertChannelRanges and shiftChannelSelection.

Usage:

au.countChannels(channels, subcounts=False)
Inputs:
  • subcounts: if True, then return a count of each range per spw as a list

Examples:

CASA <2>: au.countChannels('1:5~20;30~40,2:6~30')
  Out[2]: {'1': 27, '2': 25}                     
CASA <11>: au.countChannels('1:5~20;30~40,2:6~30', subcounts=True)
  Out[11]: {'1': [16, 11], '2': [25]}
CASA <4>: au.countChannels('1:5~20;30~40')
  Out[4]: 22    
CASA <22>: au.countChannels('5~22;49~102')
  Out[22]: 108

-- ToddHunter - 2016-01-19

This topic: ALMA > TWikiUsers > ToddHunter > CasaExtensions > CountChannels
Topic revision: 2016-06-03, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback