NRAO Home > CASA > CASA Cookbook and User Reference Manual

4.7.6 Spectral regridding of the MS (cvel)

Although not strictly a calibration operation, spectral regridding of a MS is available to aid in calibration operations (e.g. continuum subtraction) and preparation for imaging. For this purpose, the cvel task has been developed.

The inputs are:

#  cvel :: regrid an MS to a new spectral window / channel structure or frame  
vis                 =         ’’        #  Name of input measurement set  
outputvis           =         ’’        #  Name of output measurement set  
passall             =      False        #  Pass through (write to output MS) non-selected data  
                                        #   with no change  
field               =         ’’        #  Select field using field id(s) or field name(s)  
spw                 =         ’’        #  Select spectral window/channels  
selectdata          =      False        #  Other data selection parameters  
mode                = ’velocity’        #   Regridding mode  
     nchan          =         -1        #  Number of channels in output spw (-1=all)  
     start          =          0        #  Velocity of first image channel: e.g ’0.0km/s’  
     width          =          1        #  image channel width in velocity units: e.g ’-1.0km/s’  
     interpolation  =   ’linear’        #  Spectral interpolation method  
 
phasecenter         =         ’’        #  Image phase center: position or field index  
restfreq            =         ’’        #  rest frequency (see help)  
outframe            =         ’’        #  Output frame (’’=keep input frame)  
veltype             =    ’radio’        #  velocity definition  
hanning             =      False        #   If true, Hanning smooth data before regridding to  
                                        #   remove Gibbs ringing.  
async               =      False        #  If true the taskname must be started using cvel(...)  

The key parameters for the operation of cvel are the regridding mode, the output reference outframe and veltype, and the standard selection parameters (in particular spw and field).

The syntax for mode options (’channel’,’velocity’,’frequency’,’channel_b’) has been made compatible with the respective modes of clean (§ 5.2.5). The combination of selected spw and mode will determine the output channels and spw(s):

    spw = ’0,1’; mode = ’channel’  
       # will produce a single spw containing all channels in spw 0 and 1  
    spw=’0:5~28^2’; mode = ’channel’  
       # will produce a single spw made with channels (5,7,9,...,25,27)  
    spw = ’0’; mode = ’channel’: nchan=3; start=5; width=4  
       # will produce an spw with 3 output channels  
       # new channel 1 contains data from channels (5+6+7+8)  
       # new channel 2 contains data from channels (9+10+11+12)  
       # new channel 3 contains data from channels (13+14+15+16)  
    spw = ’0:0~63^3’; mode=’channel’; nchan=21; start = 0; width = 1  
       # will produce an spw with 21 channels  
       # new channel 1 contains data from channel 0  
       # new channel 2 contains data from channel 2  
       # new channel 21 contains data from channel 61  
    spw = ’0:0~40^2’; mode = ’channel’; nchan = 3; start = 5; width = 4  
       # will produce an spw with three output channels  
       # new channel 1 contains channels (5,7)  
       # new channel 2 contains channels (13,15)  
       # new channel 3 contains channels (21,23)

The simplest use of cvel is to shift a single spectral window into an output frame without regridding. This is done with mode=’channel’. For example:

cvel(vis=’test_w3oh_nohann.ms’,  
     outputvis =’test_w3oh_nohann_chanbary.ms’,  
     mode=’channel’,nchan=-1,start=0,width=1,  
     interpolation=’linear’,  
     phasecenter=’’,  
     spw=’’,  
     restfreq=’1665.4018MHz’,  
     outframe=’BARY’)

does this for an observation of the OH line.

There is also a special mode=’channel_b’ that does not force a linear output frequency grid, e.g. for irregularly spaced/overlapping spectral windows), but is nominally faster. This is not equivalent to a clean output gridding mode, although clean will work on this spectral lattice.

Mode channel is intended to not interpolate between channels. It will perform binning if needed. For most scientific applications we recommend using the mode=’velocity’’ and mode=’frequency’ options, as it is easiest to determine what the resulting channelization will be. For example:

cvel(vis=’test_w3oh_nohann.ms’,  
     outputvis =’test_w3oh_nohann_cvellsrk.ms’,  
     mode=’velocity’,nchan=45,start=’-35.0km/s’,width=’-0.55km/s’,  
     interpolation=’linear’,  
     phasecenter=’’,  
     spw=’’,  
     restfreq=’1665.4018MHz’,  
     outframe=’LSRK’)  
 
cvel(vis=’test_w3oh_nohann.ms’,  
     outputvis =’test_w3oh_nohann_cvelbary.ms’,  
     mode=’velocity’,nchan=45,start=’-35.0km/s’,width=’-0.55km/s’,  
     interpolation=’linear’,  
     phasecenter=’’,  
     spw=’’,  
     restfreq=’1665.4018MHz’,  
     outframe=’BARY’)  

will transform a MS into the LSRK and BARYcenter frames respectively.

The sign of the width parameter determines whether the channels run along increasing or decreasing values of frequency or velocity (ie if the cube is reversed or not).

The intent of cvel regridding is to transform channel labels and the visibilities to a spectral reference frame which is appropriate for the science analysis, e.g. from TOPO to LSRK, e.g. to correct for Doppler shifts throughout the time of the observation. Naturally, this will change the shape of the spectral features to some extent. According to the Nyquist theorem you should oversample a spectrum with twice the numbers of channels to retain the shape. Based on some tests, however, we recommend to observe with at least 3-4 times the number of channels for each significant spectral feature (like 3-4 channels per linewidth). This will minimize regridding artifacts in cvel.

If cvel has already established the grid that is desired for the imaging, clean should be run with the default channel mode (> width=1) or with exactly the same frequency/velocity parameters as was used in cvel. This will avoid additional regridding in clean. Hanning smoothing is optionally offered in cvel, but tests have shown that already the regridding process itself, if it involved a transformation from TOPO to a non-terrestrial reference frame, implies some smoothing (due to channel interpolation) such that Hanning smoothing may not be necessary.

The interpolation method fftshift calculates the transformed visibilities by applying a FFT, then a phase ramp, and then an inverse FFT. Note that if you want to use this interpolation method, your frequency grid needs to be equidistant, i.e. it only works in mode velocity with veltype=radio, in mode frequency, and in mode channel (in the latter only if the input grid is itself equidistant in frequency). Note also that, as opposed to all other interpolation methods, this method will apply a constant (frequency-independent) shift in frequency which is not fully correct in the case of large fractional bandwidth of the given spectral window.


More information about CASA may be found at the CASA web page

Copyright © 2010 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search