flux = sum - area * msky mag = zmag - 2.5 * log10 (flux) + 2.5 * log10 (itime) merr = 1.0857 * err / flux err = sqrt (flux / epadu + area * stdev**2 + area**2 * stdev**2 / nsky)