subroutine eboxdetect Rebin images by linear factors of 1, 2, 4 ... (number of rebinning steps specified by parameter) Loop over rebinned images: Loop over image pixels: IF within area marked by detection mask (if mask flag is 'false': loop over all image pixels) THEN Loop over all instruments: Loop over all energy bands: IF local detect THEN Perform simple box search: 1) Accumulate counts in 3 x 3 or 5 x 5 pixel source box. 2) Accumulate counts in background area (16 background pixels from 5 x 5 box or 24 background pixels from 7 x 7 box centered on source box) 3) Calculate statistical probability of excess in source box. Correct for border effects if source/background pixels are at image/detection mask border). 4) Accumulate combined statistical probability of excesses in all energy bands of all instruments. END IF IF map detect THEN Perform matched filter/box search: 1) Accumulate PSF weighted counts (PSF centred on 5 x 5 box) and/or non-weighted counts (to handle extended objects) in 5 x 5 pixel box. 2) Calculate statistical probability of excess with respect to background map. Correct for border effects if source/background pixels are at image/detection mask border. 3) Accumulate combined statistical probability of excesses in all energy bands of all instruments. END IF END Loop END Loop IF combined statistical probability of excess exceeds threshold THEN Write source records to EBOXDETECT source table. Add fluxes and hardness ratios. END IF END IF END Loop END Loop end subroutine eboxdetect