IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17267


Ignore:
Timestamp:
Apr 1, 2008, 12:32:00 PM (18 years ago)
Author:
Paul Price
Message:

Try renormalising the variances *after* convolution. It seems that
the convolution can muck up the variance by a factor of 2, so should
renormalise after.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackMatch.c

    r17263 r17267  
    1313
    1414//#define TESTING
    15 //#define NO_CONVOLUTION
     15#define NO_CONVOLUTION
    1616
    1717bool ppStackMatch(pmReadout *readout, psArray **regions, psArray **kernels,
     
    3636    psStatsOptions renormStdev = psMetadataLookupS32(&mdok, config->arguments, "RENORM.STDEV"); // Statistic for stdev
    3737    int renormWidth = psMetadataLookupS32(&mdok, config->arguments, "RENORM.WIDTH"); // Width for renormalisation box
    38 
    39     // Renormalise the variances if desired
    40     if (renorm) {
    41         psLogMsg("ppMerge", PS_LOG_INFO, "Renormalising variance map.");
    42         if (!pmReadoutWeightRenorm(readout, maskBad, renormMean, renormStdev, renormWidth, rng)) {
    43             psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
    44             psFree(output);
    45             return false;
    46         }
    47     }
    4838
    4939#ifndef NO_CONVOLUTION
     
    190180    assert((*regions)->n == (*kernels)->n);
    191181
     182    // Renormalise the variances if desired
     183    if (renorm) {
     184        psLogMsg("ppMerge", PS_LOG_INFO, "Renormalising variance map.");
     185        if (!pmReadoutWeightRenorm(readout, maskBad, renormMean, renormStdev, renormWidth, rng)) {
     186            psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
     187            psFree(output);
     188            return false;
     189        }
     190    }
     191
    192192    // Ensure the background value is zero
    193     psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for background
     193    psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for background
    194194    if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskBad, rng)) {
    195195        psWarning("Can't measure background for image.");
    196196        psErrorClear();
    197197    } else {
     198        psLogMsg("ppStack", PS_LOG_INFO, "Correcting convolved image background by %lf (+/- %lf)",
     199                 psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), psStatsGetValue(bg, PS_STAT_ROBUST_STDEV));
    198200        (void)psBinaryOp(readout->image, readout->image, "+",
    199201                         psScalarAlloc(- psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), PS_TYPE_F32));
    200202    }
     203    psFree(bg);
    201204
    202205    psFree(output);
Note: See TracChangeset for help on using the changeset viewer.