Create a grid which encompasses the source region with grid_element_Width = 20 * badpixelresolution area=0 Loop over each grid element { if (element lies within a CCD) { area = area + grid_element_Width * grid_element_Width } } Loop over each bad pixel { if (bad pixel lies within source region) { area = area - bad_pixel_area_in_detector_pixels } }