IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 22, 2010, 6:20:17 PM (16 years ago)
Author:
Paul Price
Message:

Need to rescale the covariance matrix when we rescale the images. The previous covariance matrices were appropriate for the *chip* stage, not the warp stage (the pixel scales are currently different). Simulations show that this produces the expected detection limits (+/- 0.1 mag, which is about the expected error; more precision probably requires inserting and recovering fake sources).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/pswarp/src/pswarpLoop.c

    r27387 r27732  
    267267    }
    268268
    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 
    287269    // Set covariance matrix for output
    288270    {
     
    292274        psArray *covars = psListToArray(covariances); // Array of covariance matrices
    293275        output->covariance = psImageCovarianceAverage(covars);
     276        fprintf(stderr, "Covariance: %f\n", psImageCovarianceFactor(output->covariance));
    294277        psFree(covars);
    295278        psMetadataRemoveKey(output->analysis, PSWARP_ANALYSIS_COVARIANCES);
    296279        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;
    297299    }
    298300
Note: See TracChangeset for help on using the changeset viewer.