This describes the columns and flags in the CMF/SMF files, version PS1_DV2 defined in source:trunk/psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c. This is a slightly more descriptive version.

## Columns

- IPP_IDET - detection id (increment from 0 per chip - gaps are from magic)
- X_PSF -position (in pixels
- Y_PSF -position in pixels
- X_PSF_SIGMA -position sigma
- Y_PSF_SIGMA -position sigma
- POSANGLE - position angle of the instrument coordinate system at source (ie, the angle between north and the y-axis) in degrees
- PLTSCALE - plate-scale at the source position (it varies across the exposure!) in arcsec
- PSF_INST_MAG - PSF Instrumental mag
- PSF_INST_MAG_SIG - error for that
- PSF_INST_FLUX
- PSF_INST_FLUX_SIG
- AP_MAG - aperture mag
- AP_MAG_RAW
- AP_MAG_RADIUS - aperture mag radius (pixels)
- AP_FLUX - counts
- AP_FLUX_SIG - error on previous
- PEAK_FLUX_AS_MAG - as it says, it is the flux (counts/pixel) for the peak pixel expressed as an instrumental magnitude (-2.5*log(flux))
- CAL_PSF_MAG - calibrated PSF MAG
- CAL_PS_MAG_SIG - error
- RA_PSF - ra
- DEC_PSF - dec
- SKY - background in counts (DN, not electrons)
- SKY_SIGMA -error
- PSF_CHISQ - chisq of psf
- CR_NSIGMA - cosmic ray
- EXT_NSIGMA - extended source
- PSF_MAJOR - major axis (pixel)
- PSF_MINOR - minor axis (pixel)
- PSF_THETA - angle
- PSF_QF - the psf-weighted fraction of unmasked pixels:
`\Sum_i (psf_i * !masked) / \Sum_i (psf_i)`

- PSF_QF_PERFECT - the psf-weighted fraction of unmasked pixels (including suspect pixels):
`\Sum_i (psf_i * !masked) / \Sum_i (psf_i)`

- PSF_NDOF - number of degrees of freedom for the fit -- for the diff detections, the only free parameter is the flux, so N_DOF = N_PIX - 1; in other cases, there may be more parameters (eg, position, size, etc).
- PSF_NPIX - number of pixels for fit
- MOMENTS_XX - second moment in x:
`\Sum ((x_i - x_o)^2 f_i) / \Sum (f_i)`where x_o is the centroid`\Sum (x_i f_i) / \Sum f_i`

- MOMENTS_XY - second moment in xy:
`\Sum ((x_i - x_o)(y_i - y_o)^2 f_i) / \Sum (f_i)`

- MOMENTS_YY - second moment in xy
`\Sum ((y_i - y_o)^2 f_i) / \Sum (f_i)`

- MOMENTS_R1 - first radial moment (used to define the Kron radius = 2.5 R1)
`\Sum r f_i) / \Sum (f_i)`where r is radius from the centroid

- MOMENTS_RH - half radial moment (an indicator of concentration)
`\Sum sqrt(r) f_i) / \Sum (f_i)`where r is radius from the centroid

- KRON_FLUX - flux within Kron Radius (2.5 * first radial moment)
- KRON_FLUX_ERR - error on the above

- KRON_FLUX_INNER - flux within annulus (1.0 R1 < R < 2.5 R1)
- KRON_FLUX_OUTER - flux within annulus (2.5 R1 < R < 4.0 R1)

- DIFF_NPOS - nPos (n pix > 0.0 flux)
- DIFF_FRATIO - fPos / (fPos + fNeg) where fPos = \Sum (f_i) if f_i > 0.0, and fNeg = \Sum (f_i) if f_i < 0.0
- DIFF_NRATIO_BAD - nPos / (nPos + nNeg) where nPos = number of pixels with f_i > 0.0, and nNeg = number of pixels with f_i < 0.0
- DIFF_NRATIO_MASK - nPos / (nPos + nMask) where nMask = number of masked pixels
- DIFF_NRATIO_ALL - nPos / (nGood + nMask + nNeg)

- DIFF_R_P - distance to matched source in positive image
- DIFF_SN_P - signal-to-noise of matched source in positive image
- DIFF_R_M - distance to matched source in negative image
- DIFF_SN_M - signal-to-noise of matched source in negative image

- FLAGS - see below
- FLAGS2 - see below

- N_FRAMES - this is not currently set, but it is supposed to have the value of the number of input images overlapping the center of the source (for warp-warp diff, it would be 2, for a single image it would be 1, for a stack it may be something else).
- PADDING - a dummy block of data needed to fit the rows into 8-byte boundaries (this lets me read into structures as a bulk byte read operation).

### FLAGS

(see also [wiki:IPP_Detection_Bitmasks)

DEFAULT | 0x0000.0000 | Initial value: resets all bits |

PSFMODEL | 0x0000.0001 | Source fitted with a psf model (linear or non-linear) |

EXTMODEL | 0x0000.0002 | Source fitted with an extended-source model |

FITTED | 0x0000.0004 | Source fitted with non-linear model (PSF or EXT; good or bad) |

FITFAIL | 0x0000.0008 | Fit (non-linear) failed (non-converge, off-edge, run to zero) |

POORFIT | 0x0000.0010 | Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?) |

PAIR | 0x0000.0020 | Source fitted with a double psf |

PSFSTAR | 0x0000.0040 | Source used to define PSF model |

SATSTAR | 0x0000.0080 | Source model peak is above saturation |

BLEND | 0x0000.0100 | Source is a blend with other sourcers |

EXTERNALPOS" | 0x0000.0200 | Source based on supplied input position |

BADPSF | 0x0000.0400 | Failed to get good estimate of object's PSF |

DEFECT | 0x0000.0800 | Source is thought to be a defect |

SATURATED | 0x0000.1000 | Source is thought to be saturated pixels (bleed trail) |

CR_LIMIT | 0x0000.2000 | Source has crNsigma above limit |

EXT_LIMIT | 0x0000.4000 | Source has extNsigma above limit |

MOMENTS_FAILURE | 0x0000.8000 | could not measure the moments |

SKY_FAILURE | 0x0001.0000 | could not measure the local sky |

SKYVAR_FAILURE | 0x0002.0000 | could not measure the local sky variance |

MOMENTS_SN | 0x0004.0000 | moments not measured due to low S/N |

BIG_RADIUS | 0x0008.0000 | poor moments for small radius, try large radius |

AP_MAGS | 0x0010.0000 | source has an aperture magnitude |

BLEND_FIT | 0x0020.0000 | source was fitted as a blend |

EXTENDED_FIT | 0x0040.0000 | full extended fit was used |

EXTENDED_STATS | 0x0080.0000 | extended aperture stats calculated |

LINEAR_FIT | 0x0100.0000 | source fitted with the linear fit |

NONLINEAR_FIT | 0x0200.0000 | source fitted with the non-linear fit |

RADIAL_FLUX | 0x0400.0000 | radial flux measurements calculated |

SIZE_SKIPPED | 0x0800.0000 | size could not be determined |

ON_SPIKE | 0x1000.0000 | peak lands on diffraction spike |

ON_GHOST | 0x2000.0000 | peak lands on ghost or glint |

OFF_CHIP | 0x4000.0000 | peak lands off edge of chip |

### FLAGS2

DIFF_WITH_SINGLE | 0x0000.0001 | diff source matched to a single positive detection |

DIFF_WITH_DOUBLE | 0x0000.0002 | diff source matched to positive detections in both images |

MATCHED | 0x0000.0004 | source was supplied at this location from somewhere else (eg, another image, forced photometry location, etc) |