The Merge Colors Module

Merge Colors combines OBJECT1s (detections of objects in a single passband) into OBJCs, which contain information from all colors.

The basic idea is to align the different colors with each other properly, then consider the OBJECT1s from all colors simultaneously; any objects which overlap -- contain the same area on the sky -- are combined into a single OBJC.

We create an OBJC for each OBJECT1 in the first color, and create a master_mask for the new OBJC. This mask is marked to indicate all the pixels which belong to the OBJC. Then, we consider each of the other colors in turn. For each OBJECT1, we check to see if it overlaps any of the existing master masks; if so, we then grow the master mask so that it contains the union of itself and the OBJECT1.

After iterating through all the colors, we are left with a set of OBJCs whose master masks indicate their total extent. Each OBJECT1 has its centre set to the brightest PEAK in any of the OBJECT1s that were merged to create it, and the centre of the OBJC is set (in the canonical band's coordinate system) to the centre of the whichever of the merged OBJCs had the highest peak in the canonical band.

After merging, each OBJECT1 carries with it all the peaks detected in any of its constituents, with the proviso that peaks that are too close to each other are merged together. Furthermore, the OBJC is given a list of all peaks in any of its OBJECT1s, properly transformed to the canonical frame and tagged with the band in which they were detected.