def commongrid(vis=[], spws=[], widths=[],
outframe='LSRK', mode='channel', restfreqs=[], veltype='radio'):
commongrid: Determine the frequency grid with the maximum bandwidth
which the SPWs of the same ID in the given MSs have in common
and generate cvel code to produce MSs with identical grids
with the given channel widths (and if velocity mode is used
using the given rest frequencies).
The generated cvel code will always used mode frequency.
When successful, the return value will be a dictionary
containing the necessary start, width, and nchan values,
Parameters (similar to cvel and clean):
spws - list of SPW IDs for which cvel code is to be generated
widths - the new channels widths to be achieved in each of the SPWs;
giving a single value assumes that value is to be used for all SPWs
restfreqs - (only needed for mode "velocity") the restfreq to be used for each SPW
print "ERROR: less than two input MSs"
if type(widths)==int or type(widths)==str:
for i in range(0,len(spws)):
print "# Expanding widths parameter to ", widths
if len(spws)!=len(widths):
print "ERROR: the lists in parameters spws and widths must have the same length"
if mode=='velocity' and len(spws)!=len(restfreqs):
print "ERROR: the lists in parameters spws and restfreqs must have the same length"