- Timestamp:
- Mar 6, 2011, 12:39:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ppStack/src/ppStackSources.c
r30802 r30811 115 115 float fracMatch = psMetadataLookupF32(NULL, recipe, "ZP.MATCH"); // Fraction of images to match for star 116 116 117 psMetadata *airmassZP = psMetadataLookupMetadata(NULL, recipe, "ZP.AIRMASS"); // Airmass terms 117 bool mdok = false; 118 float airmassTarget = psMetadataLookupF32(&mdok, recipe, "ZP.AIRMASS.TARGET"); // output airmass value 119 if (!mdok) { 120 airmassTarget = 1.0; 121 } 122 123 psMetadata *airmassZP = psMetadataLookupMetadata(NULL, recipe, "ZP.AIRMASS"); // Airmass terms (slopes) by filter 118 124 if (!airmassZP) { 119 125 psError(PPSTACK_ERR_CONFIG, false, "Unable to find ZP.AIRMASS in recipe."); … … 128 134 int num = options->num; // Number of inputs 129 135 psAssert(num == sourceLists->n, "Wrong number of source lists: %ld\n", sourceLists->n); 136 137 // vectors to store these inputs so they may be recorded in the output headers 138 options->zpInput = psVectorAlloc(num, PS_TYPE_F32); 139 options->expTimeInput = psVectorAlloc(num, PS_TYPE_F32); 140 options->airmassInput = psVectorAlloc(num, PS_TYPE_F32); 130 141 131 142 psVector *zp = psVectorAlloc(num, PS_TYPE_F32); // Relative zero points for each image … … 167 178 const char *expFilter = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.FILTER"); // Filter name 168 179 zpExp->data.F32[i] = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.ZP"); // Exposure zero point 180 // XXX need to get the zero point error values and propagate to get the FPA.ZP.ERR value 181 182 options->zpInput->data.F32[i] = zpExp->data.F32[i]; // NOTE zpExp may be re-assigned below using relative photometry 183 options->expTimeInput->data.F32[i] = exptime; 184 options->airmassInput->data.F32[i] = airmass; 185 169 186 psLogMsg("ppStack", PS_LOG_INFO, 170 187 "Image %d: %.2f sec exposure in %s at airmass %.2f with zero point %.2f", … … 185 202 if (!filter) { 186 203 filter = expFilter; 187 bool mdok;188 204 airmassTerm = psMetadataLookupF32(&mdok, airmassZP, filter); 189 205 if (!mdok || !isfinite(airmassTerm)) { … … 277 293 278 294 // For any star, the observed instrumental magnitude on an image and the apparent magnitude are related by: 279 // M_app = m_inst + zp + c1 * airmass + 2.5log(t) + transparency 295 // M_app = m_inst + zp + c1 * airmass + 2.5log(t) - transparency 296 // NOTE the sign of 'transparency' this must agree with the definition in pmSourceMatch.c. see, eg, line 457 where 297 // transparency = m_inst + zp + c1 * airmass + 2.5log(t) - M_app 280 298 281 299 // we want to adjust the input images to be in a consistent flux system so that the … … 288 306 // m_inst_o : instrumental mags on re-normalized image (out) 289 307 290 // 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_i291 292 // 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_o308 // 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 309 310 // 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 293 311 294 312 // zp_i, airmass_i, t_i, trans_i : reported or measured for input image … … 305 323 // NOTE: in case (b), the current code is equating the TARGET zp with the NOMINAL zp, which is wrong. 306 324 307 // m_inst_o - m_inst_i = zp[i] - zpTarget - c1 * airmassTarget - 2.5log(sumExpTime) +trans_i325 // m_inst_o - m_inst_i = zp[i] - zpTarget - c1 * airmassTarget - 2.5log(sumExpTime) - trans_i 308 326 309 327 if (options->matchZPs) { … … 314 332 } 315 333 psArray *sources = sourceLists->data[i]; // Sources of interest 316 float magCorr = zp->data.F32[i] - trans->data.F32[i] - 2.5*log10(options->sumExposure) ;334 float magCorr = zp->data.F32[i] - trans->data.F32[i] - 2.5*log10(options->sumExposure) - airmassTerm * airmassTarget; 317 335 if (zpExpNum == numGoodImages) { // case (a) 318 336 // Using measured zero points, so attempt to set target zero point … … 341 359 // Producing image with target zero point 342 360 options->zp = zpTarget; 361 options->airmass = airmassTarget; 362 options->airmassSlope = airmassTerm; 343 363 } else { 344 364 options->zp = NAN;
Note:
See TracChangeset
for help on using the changeset viewer.
