This script will re-sort the input MS into the following sort order
ARRAY, FIELD, SPW (or data_desc_id), TIME, ANTENNA1, ANTENNA2
For I/O operations, data are by-default partitioned on array, field and spw.
CASA prefers data in which ANTENNA1,ANTENNA2 are the fastest-varying axes.
To check if your MS is in the correct order (and if you need this or not),
open the MS using 'casabrowser' or 'browsetable()', and look at the
ANTENNA1, ANTENNA2, DATA_DESC_ID, FIELD_ID, ARRAY_ID, and TIME columns.
The sort order in the MS should be apparant from the indices in these columns.
Re-sorting makes the most difference in some cases when UVFITS files
written out of AIPS are read into CASA via importuvfits. Often, SPW (data_desc_id)
is the fastest-varying index, and this is the worst-possible case for the CASA
data-access pattern.
Note : This is due to a difference in the choice of default sort order
in AIPS and CASA, which the importuvfits task currently ignores.
This script will create a temporary reference-MS (a list of row indices containing the
mapping from the input to output MSs) called 'tmpreftable.tab' in the current
working directory. Therefore, please do not run two instances of this script in
the same directory.