DESPIKE

Despike data by position

Description:

This routine despikes demodulated data by comparing points that lie in the same region of sky. Each point is placed in the output grid (similar to rebin but without the smoothing) depending on its position. The points in each cell are then compared with each other and spikes are detected if any points lie more than NSIGMA from the mean.

Optionally, a plot is provided showing the points in each bin along with the clipping level to be used for despiking. In order to provide a 2-dimensional plot of 3-dimensional data the grid is unwrapped such that all the cells are plotted in one axis. The unwrapping order is governed by the DMODE parameter.

More details on despike can be found in appendix G.

Usage:

despike

Parameters:

DEFOUT = LOGICAL (Read)
Determines whether output files should be written automatically (using the default output names) or whether the user should be prompted. Default is FALSE.
DEVICE = DEVICE (Read)
The device on which to display the binned data. Can be null (!)
DMODE = CHAR (Given)
For display purposes the points in each cell are plotted sequentially on a 1-dimensional plot. This parameter governs the way in which the cells are extracted from the grid. Allowed values are:
  • SPIRAL: A Spiral outwards from the reference pixel
  • XLINEAR: unfold each X strip in turn for each Y
  • YLINEAR: unfold each Y strip in turn for each X
  • DIAG1: diagonal strips starting at position (1,1)
  • DIAG2: diagonal strips starting at positions (nx,1)

This parameter is also required if SMODE is not equal to ’NONE’ since the smoothing depends on the order that the points are extracted from the grid.

IN = CHAR (Read)
The name of the input file to be despiked. This parameter is requested repeatedly until a NULL value (!) is supplied. LOOP must be TRUE. IN can include a SCUBA section. Like the REF parameter this parameter accepts a text file.
LOOP = LOGICAL (Read)
Task will ask for multiple input files if true. Only REF is read if noloop.
MSG_FILTER = CHAR (Read)
Message filter level. Allowed values are QUIET, NORM and VERB. Default is NORM. In VERBOSE mode the positions of detected spikes are listed.
NSIGMA = REAL (Read)
The sigma clipping level used for despiking each cell.
SMODE = CHAR (Given)
This parameter controls the mode used for smoothing of the clipping envelope. If smoothing is selected, the extraction mode (DMODE) is used to determine the pixels that are adjacent to each other.

Allowed modes are:

  • NONE: No smoothing
  • HANN: Hanning smoothing

OUT = NDF (Write)

This is the name of the NDF that will contain the despiked data. There will be one prompt per input filename (assuming spikes were detected).
OUT_COORDS = CHAR (Read)
The coordinate system of the output grid. Available coordinate systems are:
  • AZ: Azimuth/elevation offsets

  • NA: Nasmyth offsets

  • PL: RA/Dec Offsets from moving centre (eg Planets)

  • RB: RA/Dec (B1950)

  • RJ: RA/Dec (J2000)

  • RD: RA/Dec (epoch of observation)

  • GA: Galactic coordinates (J2000)

For RD current epoch is taken from the first input file.

REF = CHAR (Read)
The name of the first NDF to be rebinned. The name may also be the name of an ASCII text file containing NDF and parameter values. See the notes. REF can include a SCUBA section.
SHIFT_DX = REAL (Read)
The pointing shift (in X) to be applied that would bring the maps in line. This is a shift in the output coordinate frame.
SHIFT_DY = REAL (Read)
The pointing shift (in Y) to be applied that would bring the maps in line. This is a shift in the output coordinate frame.
WEIGHT = REAL (Read)
The relative weight that should be assigned to each dataset.
XRANGE = INTEGER (Read)
The X-range of the plot. This parameter loops indefinitely until a null response is provided (!).

Examples:

despike out_coords=RJ smode=none device=!
Despike the maps by placing points onto an RJ grid. Do not plot the data points before despiking and do not smooth the clipping envelope. You will be asked for input datasets until a null value is given.
despike device=! out_coords=RB smode=hann dmode=sp nsigma=4.0
Despike on a RB grid with hanning smoothing. Use a 4.0 sigma clip and do not display. Note that the smoothing uses the spiral mode for grid unwinding.
despike device=xwindows dmode=x nsigma=3.0
Unwind with XLINEAR mode and display the data before despiking.
despike noloop accept ref=test.bat
Despike the files specified in test.bat using an RJ grid.

Notes:

For each file name that is entered, values for the parameters WEIGHT, SHIFT_DX and SHIFT_DY are requested.

ASCII input files

The REF and IN parameters accept ASCII text files as input. These text files may contain comments (signified by a #), NDF names, values for the parameters WEIGHT, SHIFT_DX and SHIFT_DY, and names of other ASCII files. There is one data file per line. An example file is:

file1{b5} 1.0 0.5 0.0 # Read bolometer 5 from file1.sdf
file2 # Read file 2 but you will still be
# prompted for WEIGHT, and shifts.
file3{i3}- 1.0 0.0 0.0 # Use everything except int 3
test.bat # Read in another text file

Note that the parameters are position dependent and are not necessary. Missing parameters are requested. This means it is not possible to specify SHIFT_DX (position 3) without specifying the WEIGHT. If the file has the .txt extension the NDF system will attempt to convert it to NDF format before processing – this is probably not what you want.

Related Applications

SURF: rebin, despike2, scuclip, sigclip