Masking is the process by which you can exclude portions of your data from data processing or analysis. Suppose that you are doing surface photometry of a bright galaxy, part of the data reduction is to measure the background contribution around the galaxy and to subtract it. You usually want to avoid inclusion of light from the galaxy in your estimation of the background. A convenient method for doing this is to mask the galaxy during the background fitting.
There are two techniques used for masking. One employs special bad values (also known as magic or invalid values). These appear within the data or variance arrays in place of the actual values, and indicate that the pixel is to be ignored or is undefined. They are destructive22 and so some people don't like them, but you can always mask your data into a new, temporary NDF. With a little care, bad values are quite effective and they are used throughout KAPPA. By its nature, a bad value can only indicate a logical, two-state condition about a data element--it is either good or bad--and so this technique is sometimes called flagging.
In contrast, the second technique, uses a quality array. This permits many more attributes or qualities of the data to be associated with each pixel. In the current implementation there may be up to 255 integer values, or 8 single-bit logical flags. Thus quality can be regarded as offering 8 logical masks extending over the data or variance arrays, and can signify the presence or absence of a particular property if the bit has value 1 or 0 respectively. An application of quality to satellite data might include the detector used to measure the value, some indicator of the time each pixel was observed, was the observation made within the Earth's radiation belts, and whether or not the pixel contains a reseau mark. By selecting only those data with the appropriate quality values, you process only the data with the desired properties. This can be very powerful. However, it does have the drawback of having to store at least an extra byte per pixel in your NDF.
The two methods are not mutually exclusive; the NDF permits their simultaneous use in a dataset.
Now we'll look at both of these techniques in detail and demonstrating
the relevant KAPPA tasks.
KAPPA --- Kernel Application Package