NRAO Home > CASA > CASA Toolkit Reference Manual
ms.regridspw - Function

1.3.1 transform spectral data to different reference frame and/or regrid the frequency channels


Description

This function permits you to transform the spectral data of your measurement set to a given reference frame. The present reference frame information in the MS is examined and the transformation performed accordingly. Since all such transformations are linear in frequency, a pure change of reference frame only affects the channel boundary definitions.

In addition, the function permits you to permanently regrid the data, i.e. reduce the channel number and/or move the boundaries using several interpolation methods (selected using parameter ”interpolation”). The new channels are equidistant in frequency (if parameter ”mode” is chosen to be vrad or freq, or equidistant in wavelength if parameter ”mode” is chosen to be vopt or wave). If ”mode” is chosen to be ”chan”, the regridding is performed by combining the existing channels, i.e. not moving but just eliminating channel boundaries where necessary.

The regridding is applied to the channel definition and all data of the MS, i.e. all columns which contain arrays whose dimensions depend on the number of channels. The input parameters are verified before any modification is made to the MS.

The target reference frame can be set by providing the name of a standard reference frame (LSRK, LSRD, BARY, GALACTO, LGROUP, CMB, TOPO, GEO, or SOURCE, default = no change of frame) in parameter ”outframe”. For each field in the MS, the channel frequencies are transformed from their present reference frame to the one given by parameter ”outframe”.

If the regridding parameters are set, they are interpreted in the ”outframe” reference frame. The regridding is applied to the data after the reference frame transformation.

Arguments





Inputs

outframe

Name of the reference frame to transform to (LSRK, LSRD, BARY, GALACTO, LGROUP, CMB, GEO, TOPO, or SOURCE). SOURCE is meant for solar system work and corresponds to GEO + a radial velocity correction (only available for ephemeris objects). If no reference frame is given, the present reference frame given by the data is used, i.e. the reference frame is not changed. The observatory position is taken as the average of all antenna positions.

allowed:

string

Default:

LSRK

mode

The quantity (radio velocity (m/s), optical velocity (m/s), frequency (Hz), wavelength (m), or original channels) in which the user would like to give the regridding parameters below (”center”, ”chanwidth”, ”bandwidth”): vrad, vopt, freq, wave, or chan.

allowed:

string

Default:

chan

restfreq

Required in case the value of mode is ”vrad” or ”vopt”: Rest frequency (Hz) for the conversion of the regrid parameters ”center”, ”chanwidth”, and ”bandwidth” to frequencies.

allowed:

double

Default:

-3E30

interpolation

Name of the interpolation method (NEAREST, LINEAR, SPLINE, CUBIC, FFTSHIFT) used in the regridding. Flagging information is combined using ”inclusive or”.

allowed:

string

Default:

LINEAR

start

Desired lower edge of the spectral window after regridding in the units given by ”mode” and in the reference frame given by ”outframe”. If no value is given, it is determined from ”center” and ”bandwidth”.

allowed:

double

Default:

-3E30

center

(Alternative to setting the parameter ”start”.) Desired center of the spectral window after regridding in the units given by ”mode” and in the reference frame given by ”outframe”. If no value is given, the center is determined from ”start” and ”bandwidth” or, if ”start” is not given either, it is kept as it is.

allowed:

double

Default:

-3E30

bandwidth

Desired width of the entire spectral window after regridding in the units given by ”mode” and in the reference frame given by ”outframe”. If no value is given or the given width is larger than the bandwidth of the data, the width will be truncated to the maximum width possible symmetrically around the value given by ”center”.

allowed:

double

Default:

-1.

chanwidth

Desired width of the channels in the units given by ”mode” and in the reference frame given by ”outframe”. This implies that channels will be equidistant in the unit given by ”mode”. If no value is given and ”mode” is vrad or freq, the function will keep the resolution as it is. If ”mode” is vopt or wave, the total number of channels will be kept as is.

allowed:

double

Default:

-1.

hanning

If true, perform hanning smoothing before regridding.

allowed:

bool

Default:

true

Returns
bool

Example

 
 
      ms.fromfits("NGC5921.MS", "/usr/lib/casapy/data/demo/NGC5921.fits")  
      ms.regridspw(outframe="LSRK")  
 
    This example reads a measurement set and transforms its spectral axis to  
    the LSRK reference frame.  
 
      ms.regridspw(outframe="BARY", mode="vrad",  
      center=73961800., chanwidth=50., bandwidth=1000.,  
      restfreq=1420405750e6)  
 
    In this example, all spectral windows in the MS will be transformed  
    to the BARY reference frame and then be regridded such that the center of the  
    new spectral window is at radio velocity = 73961800. m/s (BARY). If the bandwidth  
    of the observation is large enough the total width of the spectral window will  
    be 1000 m/s, i.e. 20 channels of width 50 m/s, 10 on each side of the given  
    center.  
 
      ms.regridspw(mode="vopt", restfreq=1420405750e6)  
 
    In this example the channels are regridded such that they are  
    equidistant in optical velocity. The reference frame and number of channels  
    is kept as is.  
 
      ms.regridspw(mode="chan", center=64, chanwidth=2,  
      bandwidth=102)  
 
    In this example, the channels are regridded such that the new bandwidth is  
    102 of the original channels centered on the original channel 64, and the new  
    channels are twice as wide as the original channels.  

__________________________________________________________________


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

Copyright 2016 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