def makemask(cleanbox=None,vis=None,imagename=None,mode=None,nchan=None,start=None,width=None,step=None,imsize=None,cell=None,phasecenter=None,stokes=None,field=None,spw=None):
"""Derive a mask image from a cleanbox blc, trc regions
cleanbox -- Cleaning region:
default: [] defaults to inner quarter of image
example: cleanbox=[[110,110,150,145],[180,70,190,80]]
cleans two regions defined by the pixel ranges
Filename with pixel values with ascii format:
<fieldid blc-x blc-y trc-x trc-y> on each line
----------------------------------------------------------------
vis -- Name of input visibility file (MS)
default: none; example: vis='ngc5921.ms'
imagename -- Name of output mask image
default: none; example: imagename='ngc5921.mask'
mode -- Type of selection
default: 'mfs'; example: mode='channel';
nchan -- Number of channels to select
default: -1 (all); example: nchan=45
default=0; example: start=5
width -- Channel width (value > 1 indicates channel averaging)
default=1; example: width=5
step -- Step in channel number
default=1; example: step=2
imsize -- Image size in spatial pixels (x,y)
default = [256,256]; example: imsize=[512,512]
cell -- Cell size in arcseconds (x,y)
default=[0,0] = none; example: cell=[0.5,0.5]
phasecenter -- direction measure or fieldid for the mosaic center
default: '' (imply field=0 as center); example: phasecenter=6
or phasecenter='J2000 19h30m00 -40d00m00'
stokes -- Stokes parameters to image
default='I'; example: stokes='IQUV';
Options: 'I','IV','IQU','IQUV'
field -- Select field using field id(s) or field name(s).
[run listobs to obtain the list id's or names]
If field string is a non-negative integer, it is assumed a field index
otherwise, it is assumed a field name
field='0~2'; field ids 0,1,2
field='0,4,5~7'; field ids 0,4,5,6,7
field='3C286,3C295'; field named 3C286 adn 3C295
field = '3,4C*'; field id 3, all names starting with 4C
spw -- Select spectral window/channels
default: ''=all spectral windows and channels
spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
spw='<2'; spectral windows less than 2 (i.e. 0,1)
spw='0:5~61'; spw 0, channels 5 to 61
spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45.
spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60
spw='0:0~10,1:20~30,2:1;2;3'; spw 0, channels 0-10,
spw 1, channels 20-30, and spw 2, channels, 1,2 and 3