### 7 Removing cosmic rays and bright regions

It is often found that images contain small bright dots scattered throughout the image. These arise because the detector has been struck by a cosmic ray, generating a pixel value corresponding to a large influx of light. Commonly, these bright dots consist of 1–6 reasonably bright pixels surrounding one very bright one (frequently 10–20 SIGMA above sky count), but the exact shape depends on the structure of the detector, the energy of the cosmic ray and its angle of incidence. Some of these events may be simply removed using the ESP TOPPED application. This searches through an image and find all those pixels above a defined threshold and sets to bad all the pixels in a circular area surrounding it.

You are first prompted to enter the name of the image from which the cosmic ray events are to be removed. Information is then requested which defines how bright pixels must be before they can be attributed to cosmic ray events. Finally, you are asked to define the size of the area surrounding a cosmic ray detection that will be assumed to be contaminated and will be set to the bad value.

Clearly, some experimentation should be employed to determine suitable values for the threshold pixel value and the likely size of the events. One possible method of operation for TOPPED is to run it twice for each image. Once to detect saturated pixels and remove pixels in a large area surrounding these (saturated pixels tend to spill count into their neighbours) and then run it again for a lower threshold with a small area being set to bad.

The use of TOPPED will always be a compromise. If a cosmic ray falls within a bright object its detection and removal becomes much more difficult and requires a more sophisticated approach involving interactive removal of contaminating pixels (see Appendix C).

The application can be used with the following syntax:

% topped in=galaxy out=cleaned noise=false width=3. back=6200 sigma=23 nsigma=10

As usual, if there is no SKY frame in the NDF galaxy then pixel size must also be supplied via the PSIZE parameter. In this example all pixels in the image galaxy with a pixel value greater than BACK$+$10$×$SIGMA are identified. Then, all the pixels within a radius of 1.5 arc second of the bright pixels are set to the bad value. Other examples may be found in Appendix 0.