CLIP: Replace Pixels Outside an Intensity Range

Form: CLIP source [MAX=f] [MIN=f] [VMAX=f] [VMIN=f] [BOX=n1,n2,...]
[MASK] [MASKONLY] [RAD=r] [PHOT=r] [VMASK=f]
source
the image or spectrum that CLIP works on.
MAX=n
sets the level above which pixels are adjusted.
MIN=n
sets the level below which pixels are adjusted.
VMAX=n
replaces all pixels above MAX by 'n'.
VMIN=n
replaces all pixels below MIN by 'n'.
MASK
Performs the MASK function on the clipped pixels.
MASKONLY
Performs the MASK function on the pixels which would be clipped without actually clipping them.
VMASK=n
replaces all masked pixels with n
RAD=r
replaces all pixels within r pixels of a clipped pixel
PHOT=r
replaces all pixels within r pixels of the location on the VISTA internal photometry list
BOX=n1,n2...
clips within boxes n1,n2, etc.

CLIP will search through the 'source' image and replace all pixels with intensities above MAX with VMAX and all pixels below MIN with VMIN. If VMIN and VMAX are not specified, they default to zero.

If VMIN or VMAX are specified, but no MIN or MAX are not, the routine clips at the values given by VMIN or VMAX. If neither MAX nor VMAX are specified, no upper level clipping will be performed. Similarly, if neither MIN nor VMIN is specified, but MAX or VMAX is, no lower level clipping will be performed.

If no keywords are given, CLIP will set all negative pixels to zero.

You can use the 'BOX=n' keyword to only clip those portions of the image within box 'n'. Multiple boxes can also be specified on the command line to clip within more than one region at a time.

If the MASK keywords is given, a MASK is created (see the MASK command) of the pixels that are being clipped. The related MASKONLY keyword will create a mask without doing the actual clipping. Masks can also be used for clipping with the VMASK=n keyword. All masked pixels will be replaced with the value 'n' in this option. The various MASK options are useful with commands such as the SURFACE command that permit the use of image masks to tag certain pixels before a surface is fit to an image. Note, however, that not all commands recognize masks.

If the RAD=r keyword is used, all pixels within r pixels of the selected pixels will be clipped to the specified value. If the PHOT=r keyword is used, all pixels within r pixels of all the locations on the current VISTA photometry list that satisfy the clipping criteria will be clipped to the values specified with VMAX= and VMIN=. This is a way to clip and/or mask out stars on an image previously identified with the VISTA stellar photometry routines.

Examples:

CLIP 1 MAX=110. VMAX=100.
replace all pixels in image 1 that are above 110 by 100.
CLIP 1 MIN=SKY VMIN=0.0
replace all pixels below SKY by 0.0. SKY is a previously-defined variable.
CLIP 1 MAX=110. VMAX=100. MIN=SKY VMIN=0.0
does the same as examples 1 and 2 simultaneously.
CLIP 1 VMAX=100.
replaces all pixels above 100 by 100.0
CLIP 1 VMAX=100. BOX=6
does the same as example 4, but only in box 6.
CLIP 1
sets all negative pixels in image 1 to zero.
CLIP 1 MIN=40.
sets all pixels below 40 with 0.0
CLIP 1 VMAX=1024.0 MASK
clips pixels above 1024.0 to 1024.0 and loads the positions of the pixels onto the mask list.
CLIP 1 VMAX=1024.0 MASKONLY
masks those pixels with values above 1024. Does not modify the image.