Changeset 27732 for branches/pap/pswarp/src/pswarpLoop.c
- Timestamp:
- Apr 22, 2010, 6:20:17 PM (16 years ago)
- File:
-
- 1 edited
-
branches/pap/pswarp/src/pswarpLoop.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap/pswarp/src/pswarpLoop.c
r27387 r27732 267 267 } 268 268 269 // Correct image for change in the plate scale270 {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 input275 double outScale = outFPA->toSky->Xs + outFPA->toSky->Ys; // Plate scale for output276 float correction = PS_SQR(outScale / inScale); // Correction factor to apply to image277 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 287 269 // Set covariance matrix for output 288 270 { … … 292 274 psArray *covars = psListToArray(covariances); // Array of covariance matrices 293 275 output->covariance = psImageCovarianceAverage(covars); 276 fprintf(stderr, "Covariance: %f\n", psImageCovarianceFactor(output->covariance)); 294 277 psFree(covars); 295 278 psMetadataRemoveKey(output->analysis, PSWARP_ANALYSIS_COVARIANCES); 296 279 psImageCovarianceTransfer(output->variance, output->covariance); 280 } 281 282 // Correct image for change in the plate scale 283 { 284 psAssert(input && input->fpa && input->fpa->toSky, "Require astrometry for input"); 285 psAssert(outFPA && outFPA && outFPA->toSky, "Require astrometry for output"); 286 287 double inScale = input->fpa->toSky->Xs + input->fpa->toSky->Ys; // Plate scale for input 288 double outScale = outFPA->toSky->Xs + outFPA->toSky->Ys; // Plate scale for output 289 float correction = PS_SQR(outScale / inScale); // Correction factor to apply to image 290 psLogMsg("pswarp", PS_LOG_INFO, "Correcting flux by %f to account for pixel scales", correction); 291 psBinaryOp(output->image, output->image, "*", psScalarAlloc(correction, PS_TYPE_F32)); 292 if (output->variance) { 293 psBinaryOp(output->variance, output->variance, "*", 294 psScalarAlloc(PS_SQR(correction), PS_TYPE_F32)); 295 } 296 psKernel *covar = psImageCovarianceScale(output->covariance, outScale / inScale); // Scaled covariance 297 psFree(output->covariance); 298 output->covariance = covar; 297 299 } 298 300
Note:
See TracChangeset
for help on using the changeset viewer.
