IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 14, 2009, 4:32:08 PM (17 years ago)
Author:
Paul Price
Message:

Renormalise variances.

File:
1 edited

Legend:

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

    r25313 r25376  
    161161     return unbinned;
    162162}
     163
     164// Renormalise a readout's variance map
     165bool stackRenormaliseReadout(const pmConfig *config, // Configuration
     166                             pmReadout *readout      // Readout to renormalise
     167    )
     168{
     169    bool mdok; // Status of metadata lookups
     170
     171    psMetadata *recipe = psMetadataLookupPtr(NULL, config->recipes, PPSTACK_RECIPE); // Recipe for ppStack
     172    psAssert(recipe, "Need PPSTACK recipe");
     173
     174    if (!psMetadataLookupBool(&mdok, recipe, "RENORM")) return true;
     175
     176    int num = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM");
     177    if (!mdok) {
     178        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "RENORM.NUM is not set in the recipe");
     179        return false;
     180    }
     181    float minValid = psMetadataLookupF32(&mdok, recipe, "RENORM.MIN");
     182    if (!mdok) {
     183        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "RENORM.MIN is not set in the recipe");
     184        return false;
     185    }
     186    float maxValid = psMetadataLookupF32(&mdok, recipe, "RENORM.MAX");
     187    if (!mdok) {
     188        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "RENORM.MAX is not set in the recipe");
     189        return false;
     190    }
     191
     192    psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask
     193
     194    return pmReadoutVarianceRenormalise(readout, maskBad, num, minValid, maxValid);
     195}
     196
    163197
    164198
     
    502536    }
    503537
     538    if (!stackRenormaliseReadout(config, readout)) {
     539        psFree(rng);
     540        psFree(bg);
     541        return false;
     542    }
    504543
    505544    // Measure the variance level for the weighting
Note: See TracChangeset for help on using the changeset viewer.