### CHPIX

Replaces the values of selected pixels in an NDF

#### Description:

This application replaces selected elements of an NDF  array component with specified values. The task loops until there are no more elements to change, indicated by a null value in response to a prompt. For non-interactive processing, supply the value of Parameter NEWVAL on the command line.

#### Usage:

chpix in out section newval [comp]

#### Parameters:

The name of the NDF array component to be modified. The options are: "Data", "Error", "Quality" or "Variance". "Error" is the alternative to "Variance" and causes the square of the supplied replacement value to be stored in the output VARIANCE array. ["Data"]
NDF structure containing the array component to be modified.
Value to substitute in the output array element or elements. The range of allowed values depends on the data type of the array being modified. NEWVAL="Bad" instructs that the bad value appropriate for the array data type be substituted. Placing NEWVAL on the command line permits only one section to be replaced. If there are multiple replacements, a null value (!) terminates the loop. If the section being modified contains only a single pixel, then the original value of that pixel is used as the suggested default value.
##### OUT = NDF (Write)
Output NDF structure containing the modified version of the array component.
The elements to change. This is defined as an NDF section, so that ranges can be defined along any axis, and be given as pixel indices or axis (data) co-ordinates. So for example "3,4,5" would select the pixel at (3,4,5); "3:5," would replace all elements in columns 3 to 5; ",4" replaces line 4. See Section 9 for details. A null value (!) terminates the loop during multiple replacements.
Title for the output NDF structure. A null value (!) propagates the title from the input NDF to the output NDF. [!]

#### Results Parameters

##### OLDVAL = LITERAL (Write)
If the section being modified contains only a single pixel, then the original value of that pixel is written out to this output parameter.

#### Examples:

chpix rawspec spectrum 55 100
Assigns the value 100 to the pixel at index 55 within the one-dimensional NDF called rawspec, creating the output NDF called spectrum.
chpix rawspec spectrum 10:19 0 error
Assigns the value 0 to the error values at indices 10 to 19 within the one-dimensional NDF called rawspec, creating the output NDF called spectrum. The rawspec dataset must have a variance compoenent.
chpix in=rawimage out=galaxy section="$\sim$20,100:109" newval=bad
Assigns the bad value to the pixels in the section $\sim$20,100:109 within the two-dimensional NDF called rawimage, creating the output NDF called galaxy. This section is the central 20 pixels along the first axis, and pixels 110 to 199 along the second.
chpix in=zzcha out=zzcha_c section="45,21," newval=-1
Assigns value $-$1 to the pixels at index (45, 21) within all planes of the three-dimensional NDF called zzcha, creating the output NDF called zzcha_c.