Sometimes having bad pixels present in your data is a nuisance, say because some application outside of KAPPA does not recognise them, or you want to integrate the flux of a source. KAPPA offers a number of options for removing bad values. Which of these is appropriate depends on the reason why you want to remove the bad pixels.
First you could replace the bad values with some other reasonable value, such as zero.
% nomagic old new 0 comp=all
Here dataset new is the same as dataset old except that any bad value in the data or variance array has now become zero.
If you wanted some representative value used based upon neighbouring pixels, use the GLITCH command.
% glitch old new mode=bad
This replaces the bad values in the data and variance arrays with the median of the eight neighbouring pixels. This works fine for isolated bad pixels but not for large blocks. If your data are generally flat, large areas can be replaced using the FILLBAD task.
% fillbad old new size=4
The value of Parameter SIZE should be about half the diameter of the largest region of bad pixels. Both the data array and variance arrays are filled.
You may replace individual pixels or rectangular sections using CHPIX.
% chpix old new SECTION - Section to be set to a constant /'55,123'/ > NEWVAL - New value for the section /'60'/ > SECTION - Section to be set to a constant /'1:30,-10:24'/ > NEWVAL - New value for the section /'-1'/ > SECTION - Section to be set to a constant /'1:30,-10:24'/ > !
This replaces pixel (55, 123) with value 60, and the region from (1, 10) to (30, 24) with 1. The final ! ends the loop of replacements. If you supply NEWVAL on the command line, only one replacement occurs.
It is also possible to paste other datasets where your bad values lie with the PASTE and SEGMENT tasks.
% paste old fudge"(10:20,29:30)" out=new
The dataset old is a copy of dataset new, except in the 22-pixel region (10, 29) to (20, 30), where the values originate from the fudge dataset.
KAPPA --- Kernel Application Package