| | 18 | |
| | 19 | === Stack Zero Points === |
| | 20 | |
| | 21 | Here is a description of how the stack zero points are determined at set: |
| | 22 | |
| | 23 | * in ppStackInputPhotometer: if (ppStack:PHOT), remeasure photometry of the sources used by ppStack [do we trust pswarp photometry or not??] |
| | 24 | * in ppStackSources: |
| | 25 | * extract the reported zero points for each exposure |
| | 26 | * if all are valid (not NAN), use these as the zero points |
| | 27 | * otherwise use airmass and exposure time to generate a nominal offset [this explains some jumps: if any image was missing the zero point, the stack would end up with a reference zero point of essentially 25.0 -- from the ppStack recipe file -- otherwise it would be essentially the zero point of the given filter (relative to grizy.synth)]. |
| | 28 | * if (ppStack:MATCH.ZERO.POINTS), use relative photometry to set the zero point: |
| | 29 | * pmSourceMatchRelphot returns the set of transparencies that minimize the chisq [is this forced to have a mean of 0.0? or keep photometric images at 0.0?] |
| | 30 | * transparency is defined as: M_app = m_inst + zp + c1 * airmass + 2.5log(t) - transparency |
| | 31 | * the transparencies are applied to the reported zero points |
| | 32 | * the zero points are adjusted by the exptime and airmass of the image to determine the magnitude offset needed to place the image in the desired flux scale. note the following long comment from ppStackSource.c explaining the modification |
| | 33 | {{{ |
| | 34 | // For any star, the observed instrumental magnitude on an image and the apparent magnitude are related by: |
| | 35 | // M_app = m_inst + zp + c1 * airmass + 2.5log(t) - transparency |
| | 36 | // NOTE the sign of 'transparency' this must agree with the definition in pmSourceMatch.c. see, eg, line 457 where |
| | 37 | // transparency = m_inst + zp + c1 * airmass + 2.5log(t) - M_app |
| | 38 | |
| | 39 | // we want to adjust the input images to be in a consistent flux system so that the |
| | 40 | // final stack can be generated with a specific target zero point. Any adjustment to |
| | 41 | // the flux scale of the image must be made in coordination with the resulting |
| | 42 | // zeropoint, exposure time, and airmass such that the above relationship yields the |
| | 43 | // same apparent magnitude for a given star: |
| | 44 | |
| | 45 | // m_inst_i : instrumental mags on input image (in) |
| | 46 | // m_inst_o : instrumental mags on re-normalized image (out) |
| | 47 | |
| | 48 | // m_inst_o + zp_o + c1 * airmass_o + 2.5log(t_o) - trans_o = m_inst_i + zp_i + c1 * airmass_i + 2.5log(t_i) - trans_i |
| | 49 | |
| | 50 | // m_inst_o = m_inst_i + (zp_i - zp_o) + c1 * (airmass_i - airmass_o) + 2.5log(t_i) - 2.5log(t_o) - trans_i + trans_o |
| | 51 | |
| | 52 | // zp_i, airmass_i, t_i, trans_i : reported or measured for input image |
| | 53 | |
| | 54 | // zp_o = zpTarget (from recipe) |
| | 55 | // airmass_o = airmassTarget (from recipe) |
| | 56 | // t_o = sumExpTime [sum of input exposure times: once images are scale to this time, they can be avereaged] |
| | 57 | // trans_o = 0.0 [obviously!] |
| | 58 | |
| | 59 | // we have 2 cases: (a) all reported ZPs are good or (b) some are bad: |
| | 60 | // (a) FPA.ZP = zp_i + c1 * airmass_i |
| | 61 | // --> zp[i] = zp_i + c1 * airmass_i + 2.5log(exptime_i) |
| | 62 | // (b) zp[i] = c1 * airmass_i + 2.5log(exptime_i) |
| | 63 | // NOTE: in case (b), the current code is equating the TARGET zp with the NOMINAL zp, which is wrong. |
| | 64 | |
| | 65 | // m_inst_o - m_inst_i = zp[i] - zpTarget - c1 * airmassTarget - 2.5log(sumExpTime) - trans_i |
| | 66 | }}} |
| | 67 | * It also seems that the ouput reported ZP of a stack for which any input ZPs are NAN is also NAN by construction (ppStackSources.c:344), but the pixels will have flux values based on the assumed input zero points of 25.0. |
| | 68 | * at this point, we have a vector ‘options->norm’ with the mag offset values. |
| | 69 | * in ppStackSources, the vector of norms above are used to adjust the magnitudes of the sources used to generate the fake sources in the convolution target image. After the convolution is done, the convolved image is then corrected by the ratio of the relphot-based correction and the kernel-based correction (which should be close to 1.0). This puts the image back into the flux scale expected for the relphot-based measurement. |
| | 70 | * in ppStackConvolve, the metadata for each input image (FPA.ZP, FPA.EXPOSURE, CELL.EXPOSURE, CELL.SATURATION) are adjusted to match the renormalization. |