NRAO Home > CASA > CASA Cookbook and User Reference Manual

8.3.5 Averaging

One can average polarizations in a scantable using the sd.scantable.average_pol function:

  averaged_scan = scans.average_pol(mask,weight)  
 
  where:  
    Parameters:  
        mask:        An optional mask defining the region, where the  
                     averaging will be applied. The output will have all  
                     specified points masked.  
        weight:      Weighting scheme. ’none’ (default), ’var’ (1/var(spec)  
                     weighted), or ’tsys’ (1/Tsys**2 weighted)  
 
    Example:  
 
  spave = stave.average_pol(weight=’tsys’)

One can also average scans over time using sd.average_time:

  sd.average_time(scantable,mask,scanav,weight,align)  
 
  where:  
 
    Parameters:  
        one scan or comma separated  scans  
        compel:   if True, enable averaging of multi-resolution spectra.  
        mask:     an optional mask (only used for ’var’ and ’tsys’ weighting)  
        scanav:   True averages each scan separately.  
                  False (default) averages all scans together,  
        weight:   Weighting scheme.  
                    ’none’     (mean no weight)  
                    ’var’      (1/var(spec) weighted)  
                    ’tsys’     (1/Tsys**2 weighted)  
                    ’tint’     (integration time weighted)  
                    ’tintsys’  (Tint/Tsys**2)  
                    ’median’   ( median averaging)  
        align:    align the spectra in velocity before averaging. It takes  
                  the time of the first spectrum in the first scantable  
                  as reference time.  
    Example:  
 
  stave = sd.average_time(scans,weight=’tintsys’)

Note that alignment of the velocity frame should be done before averaging if the time spanned by the scantable is long enough. This is done through the align=True option in sd.average_time, or explicitly through the sd.scantable.freq_align function, e.g.,

CASA <62>: sc = sd.scantable(’orions_scan20to23_if0to3.asap’,False)  
CASA <63>: sc.freq_align()  
Aligned at reference Epoch 2006/01/19/01:49:23 (UTC) in frame LSRK  
CASA <64>: av = sd.average_times(sc)

The time averaging can also be applied to multiple scantables. For example, such data might have been taken on different days. The sd.average_time function takes multiple scantables as input. However, if they are taken at significantly different times (different days for example), then sd.scantable.freq_align must be used to align the velocity scales to the same time, e.g.

CASA <65>: sc1 = sd.scantable(’orions_scan21_if0to3.asap’,False)  
CASA <66>: sc2 = sd.scantable(’orions_scan23_if0to3.asap’,False)  
CASA <67>: sc1.freq_align()  
Aligned at reference Epoch 2006/01/19/01:49:23 (UTC) in frame LSRK  
CASA <68>: sc2.freq_align(reftime=’2006/01/19/01:49:23’)  
Aligned at reference Epoch 2006/01/19/01:54:46 (UTC) in frame LSRK  
CASA <69>: scav = sd.average_times(sc1,sc2)


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