IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 12, 2010, 12:56:07 PM (16 years ago)
Author:
Paul Price
Message:

Implementing better Jacobian correction. Previously, was calculating Jacobian from the projections (tangent plane --> sky), which does not account for scales in the transformations from the pixels to the tangent plane. Now using the local linear mapping to provide the Jacobian, so that it's applied on small areas. Also using the (square root of the) Jacobian to fix the plate scale of the covariance (instead of a single value for the entire focal plane) so the noise model should be more accurate as well.

File:
1 edited

Legend:

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

    r27733 r27933  
    273273        psAssert(covariances, "Should be there");
    274274        psArray *covars = psListToArray(covariances); // Array of covariance matrices
    275         output->covariance = psImageCovarianceAverage(covars);
     275        psKernel *covar = psImageCovarianceAverage(covars);
    276276        psFree(covars);
    277277        psMetadataRemoveKey(output->analysis, PSWARP_ANALYSIS_COVARIANCES);
     278
     279        // Correct covariance matrix scale for the mean (square root of the) Jacobian
     280        double jacobian = psMetadataLookupF64(NULL, output->analysis, PSWARP_ANALYSIS_JACOBIAN); // Jacobian
     281        int goodPixels = psMetadataLookupS32(NULL, output->analysis, PSWARP_ANALYSIS_GOODPIX);   // Good pixels
     282        jacobian /= goodPixels;
     283        output->covariance = psImageCovarianceScale(covar, jacobian);
     284        psFree(covar);
     285
    278286        psImageCovarianceTransfer(output->variance, output->covariance);
    279     }
    280 
    281     // Correct image for change in the plate scale
    282     {
    283         psAssert(input && input->fpa && input->fpa->toSky, "Require astrometry for input");
    284         psAssert(outFPA && outFPA && outFPA->toSky, "Require astrometry for output");
    285 
    286         double inScale = input->fpa->toSky->Xs + input->fpa->toSky->Ys; // Plate scale for input
    287         double outScale = outFPA->toSky->Xs + outFPA->toSky->Ys; // Plate scale for output
    288         float correction = PS_SQR(outScale / inScale); // Correction factor to apply to image
    289         psLogMsg("pswarp", PS_LOG_INFO, "Correcting flux by %f to account for pixel scales", correction);
    290         psBinaryOp(output->image, output->image, "*", psScalarAlloc(correction, PS_TYPE_F32));
    291         if (output->variance) {
    292             psBinaryOp(output->variance, output->variance, "*",
    293                        psScalarAlloc(PS_SQR(correction), PS_TYPE_F32));
    294         }
    295         psKernel *covar = psImageCovarianceScale(output->covariance, outScale / inScale); // Scaled covariance
    296         psFree(output->covariance);
    297         output->covariance = covar;
    298287    }
    299288
Note: See TracChangeset for help on using the changeset viewer.