Some Documentation for the IDL WAPRED WAPP
correlator data reduction Wrapper:

The WAPRED wrapper is simply an attempt to separate the user from IDL while processing the BINFITS files produced by WAPP. After issuing the startup command, it is the intention that the user need to know nothing at all about a) the structure of the data and b) how IDL operates.

V. important disclaimer:
 The future of WAPRED is uncertain, since it was intended as a means to 'first-look' data produced by the WAPP. Software to convert WAPP data into a structure which can be processed by the older ICorr software now functions (although it is in development). Apart from making the existing functions work more efficiently, there are no plans to develop the functionality of WAPRED beyond its current scope. Please let me know if you encounter any problems with it however.

How to make it go:

From AO machines, it should be possible to simply type '@wapred' at the IDL prompt to excecute the package


Currently implemented processes:

Baseline, Export, GetHdr, OnOff, ListParams, Maths, PlotObsMode, Pltspec, Smooth, Split, TotPower, XScan, AlfaPlot, PlotPos

The following documenation is a complete copy-and-paste, and search-and-replace for the ICRED documentation, with some other additions.

WAPRED makes exensive use of the NASA routines fxbopen and fxbread to open, dig around in and manipulate the data. In theory, the programs do not open the entire telescope data file, although these programs definitely barf when used on the computers in the control room. Best to log into 'pat' or some other machine. The only pull out each saved spectra, or each header parameter when it is requested, thus preventing loading up an hours worth of 3600, 1 second dumps.

Special note: Because IDL is stupid, and it takes extra work to make it understand filenames which start with numbers (e.g. 1_data.fits), WAPRED also does not understand names formatted in this way. It is best to change the name using 'mv' if this is the case for your data.

The files are opened and closed using fxbopen and fxbclose, the routines 'restore' and 'save' are not used at all (in contrast to ICRED, where these are used all the time).

The wrapper operates by turning all inputs into strings. Parameter values are parsed from the inputted info by strsplit, using '=' as a delimiter. Consequently, anything without '=', that is not 'list', 'help', 'exit' or 'go' is not understood, and is passed straight through to the operating system.

i.e. normal unix commands are understood by WAPRED

Parameter settings which expect a number of values (e.g. setting a plot range, selecting some task options) are comma separated (WITH NO SPACES! - although this is simple to change though I am lazy), and strsplit is run again on the parameter, using ',' as the delimiter.

Quotes are not expected (eg. using in='mydatafile.wapp'), or understood. Using quotes will return an error message.

The organisation of WAPRED is split into two levels:
1). the command interpreter:
    This is the system which recieves all command inputs. it decodes inputs and selects tasks, parses parameter inputs and also runs the 'go', 'list' and 'help' commands.
It does no error checking, for example to see if the parameter inputs are sensible (e.g. it does not check if an  x-range has been entered as 'chicken', rather than a more understandable range of say 10,20).

2) the task decoders: WAPRED_<taskname>.pro
once 'go' is typed, the interpreter sends the current parameter settings (via a structure called 'paramlist') to the task decoders. These do error checking at some level, although this invariably needs to be improved.
Once all the input parameters make sense, a command is parsed to do the job, e.g. onoff does an (on-off)/off.

Note that this structure is different to ICRED, which uses three levels:
receive input, decode it and parse a command, then send it to the existing ICorr software (see ICRED documentation).

Other tasks or important commands:
GO: The general 'go' command sends the existing parameter listing to the decoders, which decode the inputs and then make the requested calculations.

Help: This has  a two-level  response. Gives a generic listing of existing implemented tasks and a brief description.
Other general syntax info can be obtained with simply 'help'. More task-specific info can be obtained by typing 'help=<taskname>'.

List: This lists the parameters for the current task, and the current settings.

: This quits totally out of WAPRED and IDL.

Hist: This task is uniqe to WAPRED (i.e. it does not exist for ICRED), use it by typing:'hist=<filename>'.
It prints out all the history of manipulation of the file (from the HISTORY keyword in the header). This is useful for backtracking, or duplicating proceedures.

Info: This task is also uniqe to WAPRED. use it by typing: 'info=<filename>'. 
It just shows some very basic info about the file, such as number of integrations, all the observation modes present in the file, and the names of all the objects observed, and weather or not the file has a consistent number of lags for each integration (THIS BIT IS IMPORTANT). WAPRED may barf if it is attempting to look at a file within which the correlator configurations varies. (the best way around this is to click 'new fits file' after each correlator change when you are observing). To cope with data that DOES contain inconsistent correlator configs, you should use 'split' with keyword_val=lags_in:1024 (or however many lags you have used).

Other functions:
There are two small programs which are used to write, and recall  previous parameter settings. These  are '' and ''. Every time a task parameter is modified, the entire parameter list is sent to an archive file (called WAPRED.arch). Every time a new task is selected, the archive file is read to recall the last parameter settings.


Remove a baseline from a spectrum or spectra. Baseline is boxcar, polynomial, or polysmooth. Output file is baseline subtracted. IN: Input filename. OUT: Output filename. ROWNUM: Select rownumbers in datafile to calculate and subtract baseline. These can be as a comma separated list, or a colon speparated range. Default is all records. RANGE Choose the channel numbers to make the fit. These can be as a comma separated list, or a colon speparated range. METHOD: Choose from Boxcar (box), polynomial (poly) or polysmooth (polysmooth). DEGREE: Specify degree of polynomial, or width of boxcar (in channel numbers). Box must be an ODD number of channels


Export data into text of FITS file text output gives five columns: Chanell number, Velocity, Rest frequency, Sky frequency then data values IN: Input filename. ROWNUM: Select rownumbers in datafile to export data. Default is all records.These can be as a comma separated list, or a colon separated range OUTTYPE: Select 'text' or 'fits' to export data in a text format, or to an IDL fits file (use 'readfits') to read at IDL prompt. In the case of 'fits' the first column in output array contains rest frequency values FILE: Output filename for OUTTYPE=text or OUTTYPE=idl. leave unset and with OUTTYPE=text to print data to screen. If unset and OUTTYPE=idl, a default filename is used (wapred_export.fits)


print out header information for a given record number. IN: Input filename. ROWNUM: Select rownumber for header information. Default is Rownumber=1 DEVICE: Select (display) to print to screen, or (file) to print to 'gethdr.out'


Determine an on/off, for polarisation pairs. Output file contains two spectra Allows an On/Off to be calculated also for calibration data. IN: Input filename. OUT: Output file name. ROWNUM: Constrain the calculation to a range of record numbers TYPE: Select (source) for source data, or (cal) for calibrator data (default is source i.e. on and offs)


List a single, or number of header parameters for a range of record numbers. IN: Input filename. HEADERNAMES: A series of comma separated header keyword names. Leave this unset to see a list of ALL keyword names. Device: Select (display) to print to screen, or (file) to print to 'listparams.out'


Do some low level operations on an entire file. To 'Sub', 'Add', 'Mult' and 'Div' with a scalar value, input only single files. Where a factor is not given, 'Sub', 'Add', 'Mult' and 'Div' operate on channel-by-channel for file pairs only. 'Sum', 'Mean' and 'Peak' can operate on multiple files and will return a single spectrum IN: Input filenames (comma separated list). OUT: Output file name. OP: Operation type: must be (sum), (mean), (peak), (sub)tract, (add), (mult)iply or (div)ide FACTOR: Factor for sub, add, mult or div. Ignored for mean and peak.


A graphical look at the observing mode for each record number IN: Input filename. ROWNUM: Select the range of rownumbers to plot, These can be as a comma separated list, or a colon speparated range. or two element array TYPE: Select by Observation type (e.g. ON, OFF)


Plot spectra, with channel number, velocity or rest or sky frequency. An interactive 'cursor' mode is available. IN: Input filename. OUT: Output plot file name. This is also available with the interactive CURSOR mode. ROWNUM: Select record numbers to plot These can be as a comma separated list, or a colon speparated range. default is all DEVICE: Select output format: 'file' or 'screen', default is screen NOTE: if 'file' is requested, interactive cursor mode is disabled. XRANGE: Two element parameter: xmin,xmax, default is set by IDL. YRANGE: Two element parameter: ymin,ymax, default is set by IDL. XTYPE: Saxis type, Channel Number (cnum), (vel)ocity (using reference frame of data), Sky freqency (freqsky) or rest frequency (freqrest). Default is channel number. TITLE: Title for plot (opt). XTITLE: X axis title (opt). YTITLE: Y axis title (opt). CURSOR: Select interactive, yes, or no. default is yes. To zoom in on plot, left click and drag, center button centers plot click outside left margin to unzoom, right click quits.


Smooths the data, according to a specified process. IN: Input filename. ROWNUM: Select the range of rownumbers to smooth. Only these are written to the output file. These can be as a comma separated list, or a colon speparated range. default is all FUNCT: Select the smoothing algorithm: (Box)car, (Hann)ing, (Gauss)ian-not operational). CELLSIZE: Select the size of smoothing range for Hannning and width of gaussian


Split up data by selecting range of record numbers or observation mode types. IN: Input filename. OUT: Output file name. ROWNUM: Select range of record numbers for splitting These can be as a comma separated list, or a colon speparated range. default is all KEYWORD_VAL: Select by the value of parameters from the header, name and value are colon separated, different keywords are comma separated. e.g. to select by pixel number, and polarisation 0, use KEYWORD_VAL=pixel:0,pol:0


Plot the total power value from the header from each integration IN: Input filename. ROWNUM: Select range of record numbers for plotting These can be as a comma separated list, or a colon speparated range. These can be as a comma separated list,


Plots out cross scan data. It returns plots of az scan power vs RA and vs Dec, also za scan power vs RA and vs Dec (i.e. four plots). Also plotted is a pointing map in RA and Dec IN: Input filename. PIX: Select which pixel to search for (both pols). Default is whatever pixel is in first row TYPE: Select (display) to print to screen, or (file) to print to '' CONT: choose to nonzero to over plot contours and greyscale


Plot out pairs of polarisations for all seven beams of alfa. The 8th box shows the total power for all beams, the vertical red line shows the current integration number as a function of total power for all beams. X-axis range can be modified IN: Input filename. STARTSET: Specify the starting integration number XRANGE: Set the range of channels to view for each plot


Plots the positions (from the fits headers) for every integration in the file. Separate beams and or integration ranges can be selected. Can optionally create a map of the dataset, as a total power convolved with 3.3 amin beam IN: Input filename. FRAME Reference frame for plotting. Options for for now are RA-Dec (radec) or Az Za (azza) ROWNUM: Select the range of rownumbers to plot, These can be as a comma separated list, or a colon speparated range. BEAMNUM: Select range of beams for plotting These can be as a comma separated list, or a colon speparated range. OPTIONS The only available current option is to plot as a total power map. Default plots positions as a single point.
Last updated: 20th May, 2004
email me: emuller (at) naic . edu