Changeset 30811
- Timestamp:
- Mar 6, 2011, 12:39:13 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/ppStack/src
- Files:
-
- 4 edited
-
ppStackConvolve.c (modified) (1 diff)
-
ppStackOptions.h (modified) (1 diff)
-
ppStackSources.c (modified) (9 diffs)
-
ppStackUpdateHeader.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ppStack/src/ppStackConvolve.c
r30806 r30811 323 323 324 324 // UPDATE CELL.SATURATION here 325 UPDATE_CONCEPT(outFPA, "FPA.EXPOSURE", options->sumExposure);326 UPDATE_CONCEPT(outCell, "CELL.EXPOSURE", options->sumExposure);327 UPDATE_CONCEPT(outCell, "CELL.DARKTIME", NAN);325 UPDATE_CONCEPT(outFPA, "FPA.EXPOSURE", options->sumExposure); 326 UPDATE_CONCEPT(outCell, "CELL.EXPOSURE", options->sumExposure); 327 UPDATE_CONCEPT(outCell, "CELL.DARKTIME", NAN); 328 328 UPDATE_CONCEPT(outCell, "CELL.SATURATION", satBest); 329 UPDATE_CONCEPT(outFPA, "FPA.ZP", options->zp); 330 331 UPDATE_CONCEPT(unconvFPA, "FPA.EXPOSURE", options->sumExposure); 332 UPDATE_CONCEPT(unconvCell, "CELL.EXPOSURE", options->sumExposure); 333 UPDATE_CONCEPT(unconvCell, "CELL.DARKTIME", NAN); 329 UPDATE_CONCEPT(outFPA, "FPA.ZP", options->zp); 330 UPDATE_CONCEPT(outFPA, "FPA.AIRMASS", options->airmass); 331 332 UPDATE_CONCEPT(unconvFPA, "FPA.EXPOSURE", options->sumExposure); 333 UPDATE_CONCEPT(unconvCell, "CELL.EXPOSURE", options->sumExposure); 334 UPDATE_CONCEPT(unconvCell, "CELL.DARKTIME", NAN); 334 335 UPDATE_CONCEPT(unconvCell, "CELL.SATURATION", satBest); 335 UPDATE_CONCEPT(unconvFPA, "FPA.ZP", options->zp); 336 UPDATE_CONCEPT(unconvFPA, "FPA.ZP", options->zp); 337 UPDATE_CONCEPT(unconvFPA, "FPA.AIRMASS", options->airmass); 336 338 337 339 psLogMsg("ppStack", PS_LOG_INFO, "stack adjust metadata values : zp %f, exptime %f, sat %f", options->zp, options->sumExposure, satBest); -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackOptions.h
r30620 r30811 22 22 float sumExposure; // Sum of exposure times 23 23 float zp; // Zero point for output 24 float zpErr; // Zero point error for output 25 float airmass; // airmass for output image 26 float airmassSlope; // airmass slope used for zp analysis 24 27 psVector *inputMask; // Mask for inputs 25 28 psArray *sourceLists; // Individual lists of sources for matching 26 29 psVector *norm; // Normalisation for each image 30 psVector *zpInput; // reported zero point of input exposure 31 psVector *expTimeInput; // exposure time of input exposure 32 psVector *airmassInput; // airmass of input exposure 27 33 psArray *sources; // Matched sources 28 34 // Convolve -
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; -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackUpdateHeader.c
r30808 r30811 70 70 psMetadataAddStr(hdu->header, PS_LIST_TAIL, "TESS_ID", PS_META_REPLACE, "type of stack", tessID); 71 71 72 // add data about the inputs 72 psMetadataAddF32(hdu->header, PS_LIST_TAIL, "AIRM_SLP", PS_META_REPLACE, "airmass slope", options->airmassSlope); 73 74 75 // write the following fields to the output headers: 76 // INP_NNNN : input file names 77 // SCL_NNNN : scale factor for each input file 78 // ZPT_NNNN : zero point of input file 79 // EXT_NNNN : exptime of input file 80 // AIR_NNNN : airmass of input file 81 82 // use separate loops so they are blocked together in the headers (more readable) 83 84 // save the input filenames 73 85 for (int i = 0; i < options->num; i++) { 74 86 char field[64]; … … 78 90 psMetadataAddStr(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image name", basename); 79 91 psFree(basename); 80 81 float inScale = pow(10.0, -0.4*options->norm->data.F32[i]);82 snprintf (field, 64, "SCL_%04d", i);83 psMetadataAddF32(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image scale factor", inScale);84 92 } 85 93 94 // save the input normalizations 95 for (int i = 0; i < options->num; i++) { 96 char field[64]; 97 98 float value = options->norm ? pow(10.0, -0.4*options->norm->data.F32[i]) : NAN; 99 snprintf (field, 64, "SCL_%04d", i); 100 psMetadataAddF32(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image scale factor", value); 101 } 102 // save the input exptimes 103 for (int i = 0; i < options->num; i++) { 104 char field[64]; 105 106 float value = options->zpInput ? options->zpInput->data.F32[i] : NAN; 107 snprintf (field, 64, "ZPT_%04d", i); 108 psMetadataAddF32(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image zero point", value); 109 } 110 // save the input normalizations 111 for (int i = 0; i < options->num; i++) { 112 char field[64]; 113 114 float value = options->expTimeInput ? options->expTimeInput->data.F32[i] : NAN; 115 snprintf (field, 64, "EXP_%04d", i); 116 psMetadataAddF32(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image exptime", value); 117 } 118 // save the input normalizations 119 for (int i = 0; i < options->num; i++) { 120 char field[64]; 121 122 float value = options->airmassInput ? options->airmassInput->data.F32[i] : NAN; 123 snprintf (field, 64, "AIR_%04d", i); 124 psMetadataAddF32(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image airmass", value); 125 } 86 126 return true; 87 127 }
Note:
See TracChangeset
for help on using the changeset viewer.
