A match structure as described above is not yet finished. To minimize systematic errors in source intensities, it is helpful to perform a ``realtive photometry'' procedure to remove photometric mismeasurements due to such difficulties as the presence of thin haze over a portion of a frame, poor fringe subtraction (Section 7.3.3), etc. The idl program relphot3.pro will perform this procedure. For each object in each observation, relphot3.pro determines a small relative photometric correction, or in more extreme situations calculates a systematic error and sets flags to specify the problem and allow one to exclude the affected regions.
The program begins by selecting a set of good template sources in each matched list. To qualify as a template source, an object must be detected in more than 75% of the epochs at which the source location was imaged. Next, the median magnitude of all good observations of the template objects is calculated. Each image is then divided into subtiles, 200 pixels on a side, and a photometric offset are calculated for each template source, grouped by subtile, that has a statistical uncertainty in its magnitude measurement less than 0.1 mag. The number of template sources within a typical subtile is . The relative photometry map is then calculated to be the array of median offsets for each subtile. The RMS deviation of the offsets in each subtile, which for good subtiles is typically around 0.03 mag, is used to estimate the systematic error. In addition, a subtile is classified as ``bad'' if there are less than five template sources within it, or if the RMS deviation of the template offsets is greater than 0.1 mag. Each magnitude measurement of each object in each observation is then corrected by the offset map using a bilinear interpolation, and the new systematic error estimate is added in quadrature to the previously estimated systematic error for each object in the observation. If the subtile is flagged as bad, then the object's observations are likewise flagged (flags are defined in Table C.2).
The function call for this procedure is:
IDL relphot3, match, newmatch, rpmap, stat=stat, save=save, archive=archive, over=over,
The variable match contains the input match structure (or it may also be the file name of a FITS file containing a match structure), while newmatch is where idl will put the corrected match structure. If the match variable is a match structure, then the stats variable must be set to the array of cobj header structures (Section 8.3.2) that was created with that match structure. If the match variable is a file name, the array of structures in the second extension will be read into the stat variable. The variable rpmap is a structure that contains the map of offset values as well as several diagnostic parameters. This structure is defined in Section C.6, and it is saved as the third extension to the relmat FITS file (Section A.4).
The application of the save, archive, and over keywords are the same as with regmatch3_list.pro, above. If init is set, then the program will blindly apply the procedure. Otherwise, it will check to make sure the procedure has not already been applied to match, and exit with a warning if it seems that relative photometry is not necessary in this case.