AVERAGE

Program AVERAGE is used to time-average data in MERGE data sets. Both MERGE-formats 1 and 2 are accepted. Some programs (e.g., MODELFIT) can only accept a small number of data records, and averaging can be used to reduce the number of data records before running such programs. Averaging can also be used to attempt to increase the signal-to-noise ratio, although usually the benefits are small. Take care not to use too long an averaging interval which might smooth out real structure in the visibility. Note that data should be edited before being averaged.

AVERAGE can perform a coherent or an incoherent average. The user must specify both an integration time (T sec, say), and an averaging method. In all methods, the input data records are binned into intervals each of length T sec (UT). All the data in each bin are averaged (by the algorithms described below) to generate one output record. The time-tag attached to the output record is always the midpoint of the interval (not the centroid). This is to avoid problems matching up data on different baselines.

In an incoherent average (METHOD=I), the averaged amplitude is the rms of the input amplitudes, and visibility phases and closure phases are averaged by averaging the sine and cosine of the input phases. WARNING: the incoherent average destroys the phase-closure relations: the averaged visibility phases are no longer consistent with the averaged closure phases.

Two alternative methods of computing a coherent average may be requested (METHOD=C or METHOD=S). In both cases the complex visibilities within each interval are averaged in the usual way, while the closure phases (if present) are averaged as in METHOD=I. This will not work if there are many fringe-periods between successive data points: it is important to "unwind" the phases as much as possible before averaging, e.g., by self-calibrating the phases. Methods C and S differ in how they compute the errors (strictly, the uncertainties) in the averaged visibilities. Method C averages the errors in the input file. Method S ignores the errors in the input file, and computes the error from the scatter of the input visibilities. Method S thus requires that there be many input points per averaging bin. Method S is useful when averaging the data output by AIPS global fringe-fitting, where the input errors are usually meaningless.

Example

% average
  INPUT  = T1.MRG
  OUTPUT = T2.MRG
  METHOD = I
  TIME = 4:00
  /

Parameters

Parameters INPUT, OUTPUT, TIMESCALE, and METHOD must be specified; the others are optional. The parameters names can be abbreviated to uniqueness (minimum match). All the parameters except TIMESCALE are character strings, but they need not be enclosed in quotation marks unless they include commas or blank spaces. End the list of parameters with a slash (/).

INPUT = filename
The name of the input merge-format file (e.g., INPUT = CITSCR:[TJP.B2]T1.MRG). This parameter must be specified; there is no default.

OUTPUT = filename
A name for the output file created by AVERAGE. This parameter must be specified; there is no default.

TIMESCALE = t
The averaging time in seconds; it must be an exact number of seconds. The notation mm:ss can be used if desired; e.g., 2:30 is 2 minutes + 30 s, i.e., 150 s. This parameter must be specified: there is no default.

METHOD = "I", "C", or "S"
Select the algorithm to be used. "I" gives incoherent averaging, "C" coherent averaging with errors obtained by averaging the input errors, and "S" coherent averaging with errors obtained from the scatter in the input. This parameter must be specified: there is no default. Only the first letter is significant: e.g., you can write METHOD=INCOHERENT.

HISTORY = text
A character string (up to 78 characters) to be written in the "history" section of the output file; this is optional. (This is in addition to two history records which record the username, date, averaging time, and method.)

Limitations

1. Maximum number of stations is 40.

2. If the input file is MERGE format 2 (i.e., it contains the u,v,w coordinates) the averaging time cannot be more than 100 times the integration time in the input file.

History

1.0: Original program by R. Craig Walker.
1.1: 1982 Apr 1 - Coherent averaging added - RCW.
1.2: 1982 Apr 15 - Changed weighting - RCW.
1.3: 1982 Sep 22 - Some bugs fixed (?), old versions no good - RCW.
2.0: 1983 Jul 20 - Extended to include merge 2 files - DLM.
2.1: - Added w to ver 2 files; interpolate u,v,w - DLM.
2.2: 1985 Mar 5 - Changed parameters for up to 20 stations - TJP.
2.3: 1985 Apr 9 - Fixed bug: Coherent average inquiry required 'y' in uppercase only! - SCU.
3.0: 1985 Apr 11 - Change coherent average: errors now calculated from scatter in data, not input errors; write averaging information into history records - SCU.
3.1: 1986 Apr 4 - More flexible input (see 1985 Apr 9!) - SCU.
3.2: 1986 Oct 9 - Fix rounding error in s.d. - SCU.
4.0: 1986 Nov 14 - Revised to use parameter input and restore METHOD=C - TJP.
4.1: 1988 Jun 21 : Changes for Convex - TJP.
4.2: 1992 Aug 7 : when errors are calculated from scatter of data, the case of only one input point must be treated specially; change to flag the point - TJP.
4.3: 1993 Dec 4 : increase to 40 stations.


Tim Pearson, California Institute of Technology
tjp·astro.caltech.edu