Changeset 28017 for branches/czw_branch/20100427/pswarp/src/pswarpLoop.c
- Timestamp:
- May 18, 2010, 5:06:01 PM (16 years ago)
- Location:
- branches/czw_branch/20100427
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pswarp/src/pswarpLoop.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100427
- Property svn:mergeinfo changed
-
branches/czw_branch/20100427/pswarp/src/pswarpLoop.c
r27387 r28017 266 266 goto DONE; 267 267 } 268 269 // Correct image for change in the plate scale 270 { 271 psAssert(input && input->fpa && input->fpa->toSky, "Require astrometry for input"); 272 psAssert(outFPA && outFPA && outFPA->toSky, "Require astrometry for output"); 273 274 double inScale = input->fpa->toSky->Xs + input->fpa->toSky->Ys; // Plate scale for input 275 double outScale = outFPA->toSky->Xs + outFPA->toSky->Ys; // Plate scale for output 276 float correction = PS_SQR(outScale / inScale); // Correction factor to apply to image 277 psLogMsg("pswarp", PS_LOG_INFO, "Correcting flux by %f to account for pixel scales", correction); 278 279 psBinaryOp(output->image, output->image, "*", psScalarAlloc(correction, PS_TYPE_F32)); 280 if (output->variance) { 281 psBinaryOp(output->variance, output->variance, "*", 282 psScalarAlloc(PS_SQR(correction), PS_TYPE_F32)); 283 } 284 } 285 286 268 bool doStats = psMetadataLookupBool(&mdok,recipe,"MASK.STATS"); 269 if (doStats) { 270 if (!pswarpMaskStats(output, stats, config)) { 271 psError(psErrorCodeLast(), false, "Unable to calculate mask stats."); 272 psFree(cells); 273 psFree(view); 274 goto DONE; 275 } 276 } 287 277 // Set covariance matrix for output 288 278 { … … 291 281 psAssert(covariances, "Should be there"); 292 282 psArray *covars = psListToArray(covariances); // Array of covariance matrices 293 output->covariance= psImageCovarianceAverage(covars);283 psKernel *covar = psImageCovarianceAverage(covars); 294 284 psFree(covars); 295 285 psMetadataRemoveKey(output->analysis, PSWARP_ANALYSIS_COVARIANCES); 286 287 // Correct covariance matrix scale for the mean (square root of the) Jacobian 288 double jacobian = psMetadataLookupF64(NULL, output->analysis, PSWARP_ANALYSIS_JACOBIAN); // Jacobian 289 int goodPixels = psMetadataLookupS32(NULL, output->analysis, PSWARP_ANALYSIS_GOODPIX); // Good pixels 290 jacobian /= goodPixels; 291 output->covariance = psImageCovarianceScale(covar, jacobian); 292 psFree(covar); 293 296 294 psImageCovarianceTransfer(output->variance, output->covariance); 297 295 } … … 340 338 341 339 pswarpVersionHeader(hdu->header); 342 340 343 341 if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) { 344 342 psError(psErrorCodeLast(), false, "Unable to generate WCS header."); … … 355 353 pswarpFileActivation(config, detectorFiles, false); 356 354 pswarpFileActivation(config, independentFiles, false); 355 357 356 358 357 // We need a new PSF model for the warped frame. It would be good to generate this analytically, but … … 429 428 } 430 429 } 430 431 431 432 432 // Add MD5 information for readout
Note:
See TracChangeset
for help on using the changeset viewer.
