Changeset 27218
- Timestamp:
- Mar 5, 2010, 6:09:32 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
ippconfig/gpc1/Makefile.am (modified) (1 diff)
-
ippconfig/gpc1/camera.config (modified) (1 diff)
-
ippconfig/gpc1/ppStack.config (added)
-
ippconfig/recipes/ppStack.config (modified) (1 diff)
-
ppStack/src/ppStackConvolve.c (modified) (1 diff)
-
ppStack/src/ppStackOptions.c (modified) (1 diff)
-
ppStack/src/ppStackOptions.h (modified) (1 diff)
-
ppStack/src/ppStackSources.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippconfig/gpc1/Makefile.am
r26677 r27218 18 18 ppImage.config \ 19 19 ppMerge.config \ 20 ppStack.config \ 20 21 psphot.config \ 21 22 psastro.config \ -
trunk/ippconfig/gpc1/camera.config
r26902 r27218 119 119 PSWARP STR gpc1/pswarp.config 120 120 REJECTIONS STR gpc1/rejections.config # rejection recipe 121 PPSTACK STR gpc1/ppStack.config 121 122 END 122 123 -
trunk/ippconfig/recipes/ppStack.config
r27105 r27218 62 62 y F32 0.0 63 63 END 64 ZP.TARGET METADATA # Target zero point by filter 65 g F32 25.0 66 r F32 25.0 67 i F32 25.0 68 z F32 25.0 69 y F32 25.0 70 END 64 71 65 72 PSF.INSTANCES S32 15 # Number of instances for PSF generation -
trunk/ppStack/src/ppStackConvolve.c
r27036 r27218 266 266 UPDATE_CONCEPT(outCell, "CELL.EXPOSURE", options->sumExposure); 267 267 UPDATE_CONCEPT(outCell, "CELL.DARKTIME", NAN); 268 UPDATE_CONCEPT(outFPA, "FPA.ZP", options->zp); 268 269 269 270 UPDATE_CONCEPT(unconvFPA, "FPA.EXPOSURE", options->sumExposure); 270 271 UPDATE_CONCEPT(unconvCell, "CELL.EXPOSURE", options->sumExposure); 271 272 UPDATE_CONCEPT(unconvCell, "CELL.DARKTIME", NAN); 273 UPDATE_CONCEPT(unconvFPA, "FPA.ZP", options->zp); 272 274 } 273 275 -
trunk/ppStack/src/ppStackOptions.c
r27158 r27218 58 58 options->quality = 0; 59 59 options->psf = NULL; 60 options->sumExposure = NAN; 61 options->zp = NAN; 60 62 options->inputSeeing = NULL; 61 63 options->targetSeeing = NAN; -
trunk/ppStack/src/ppStackOptions.h
r27158 r27218 23 23 float targetSeeing; // Target seeing FWHM 24 24 float sumExposure; // Sum of exposure times 25 float zp; // Zero point for output 25 26 psVector *inputMask; // Mask for inputs 26 27 psArray *sourceLists; // Individual lists of sources for matching -
trunk/ppStack/src/ppStackSources.c
r27162 r27218 119 119 return false; 120 120 } 121 psMetadata *zpTargetMenu = psMetadataLookupMetadata(NULL, recipe, "ZP.TARGET"); // Target zero point terms 122 if (!zpTargetMenu) { 123 psError(PPSTACK_ERR_CONFIG, false, "Unable to find ZP.TARGET in recipe."); 124 return false; 125 } 121 126 122 127 int num = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs 123 128 psAssert(num == sourceLists->n, "Wrong number of source lists: %ld\n", sourceLists->n); 124 129 125 psVector *zp = psVectorAlloc(num, PS_TYPE_F32); // Zero points for each image 130 psVector *zp = psVectorAlloc(num, PS_TYPE_F32); // Relative zero points for each image 131 psVector *zpExp = psVectorAlloc(num, PS_TYPE_F32); // Measured zero points for each image (maybe) 132 int zpExpNum = 0; // Number of measured zero points 126 133 const char *filter = NULL; // Filter name 127 134 float airmassTerm = NAN; // Airmass term 135 float zpTarget = NAN; // Target zero point 128 136 float sumExpTime = 0.0; // Sum of the exposure time 129 137 int numGoodImages = 0; // Number of good images … … 160 168 float airmass = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.AIRMASS"); // Airmass 161 169 const char *expFilter = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.FILTER"); // Filter name 170 zpExp->data.F32[i] = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.ZP"); // Exposure zero point 171 psLogMsg("ppStack", PS_LOG_INFO, 172 "Image %d: %.2f sec exposure in %s at airmass %.2f with zero point %.2f", 173 i, exptime, expFilter, airmass, zpExp->data.F32[i]); 162 174 if (!isfinite(exptime) || exptime == 0 || !isfinite(airmass) || airmass == 0 || 163 175 !expFilter || strlen(expFilter) == 0) { … … 168 180 return false; 169 181 } 182 if (isfinite(zpExp->data.F32[i])) { 183 zpExp->data.F32[i] += 2.5 * log10(exptime); 184 zpExpNum++; 185 } 170 186 171 187 if (!filter) { 172 188 filter = expFilter; 173 airmassTerm = psMetadataLookupF32(NULL, airmassZP, filter); 174 if (!isfinite(airmassTerm)) { 189 bool mdok; 190 airmassTerm = psMetadataLookupF32(&mdok, airmassZP, filter); 191 if (!mdok || !isfinite(airmassTerm)) { 175 192 psError(PPSTACK_ERR_CONFIG, false, 176 193 "Unable to find airmass term (ZP.AIRMASS) for filter %s", filter); … … 178 195 return false; 179 196 } 197 zpTarget = psMetadataLookupF32(&mdok, zpTargetMenu, filter); 198 if (!mdok || !isfinite(zpTarget)) { 199 psError(PPSTACK_ERR_CONFIG, false, 200 "Unable to find target zero point (ZP.TARGET) for filter %s", filter); 201 psFree(zp); 202 return false; 203 } 180 204 } else if (strcmp(filter, expFilter) != 0) { 181 205 psError(PPSTACK_ERR_CONFIG, false, "Filters don't match: %s vs %s", filter, expFilter); … … 184 208 } 185 209 186 zp->data.F32[i] = airmassTerm * airmass -2.5 * log10(exptime);210 zp->data.F32[i] = airmassTerm * airmass + 2.5 * log10(exptime); 187 211 sumExpTime += exptime; 212 188 213 } 189 214 … … 193 218 psLogMsg("ppStack", PS_LOG_WARN, "No images with sources to measure transparency."); 194 219 options->quality = PPSTACK_ERR_REJECTED; 220 psFree(zp); 221 psFree(zpExp); 195 222 return true; 196 223 } … … 205 232 options->sources = psMemIncrRefCounter(sources); 206 233 psLogMsg("ppStack", PS_LOG_WARN, "Single image with sources --- no need to match transparency."); 234 psFree(zp); 235 psFree(zpExp); 207 236 return true; 237 } 238 239 if (zpExpNum == numGoodImages) { 240 for (int i = 0; i < num; i++) { 241 zp->data.F32[i] = zpExp->data.F32[i]; 242 } 208 243 } 209 244 … … 244 279 } 245 280 psArray *sources = sourceLists->data[i]; // Sources of interest 246 float magCorr = airmassTerm - 2.5*log10(sumExpTime) - zp->data.F32[i] - trans->data.F32[i]; 281 float magCorr = zp->data.F32[i] + trans->data.F32[i] - 2.5*log10(sumExpTime); 282 if (zpExpNum == numGoodImages) { 283 // Using measured zero points, so attempt to set target zero point 284 magCorr -= zpTarget; 285 } 247 286 options->norm->data.F32[i] = magCorr; 248 psLogMsg("ppStack", PS_LOG_INFO, "Applying magnitude correction to image %d: %f\n", 249 i, magCorr); 287 psLogMsg("ppStack", PS_LOG_INFO, 288 "Applying scale correction to image %d: %f mag (%f)\n", 289 i, magCorr, trans->data.F32[i]); 250 290 251 291 for (int j = 0; j < sources->n; j++) { … … 258 298 } 259 299 } 300 301 if (zpExpNum == numGoodImages) { 302 // Producing image with target zero point 303 options->zp = zpTarget; 304 } else { 305 options->zp = NAN; 306 } 307 260 308 261 309 #ifdef TESTING
Note:
See TracChangeset
for help on using the changeset viewer.
