IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20523


Ignore:
Timestamp:
Nov 3, 2008, 5:24:25 PM (18 years ago)
Author:
Paul Price
Message:

Renormalise variance map before photometry.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubReadout.c

    r20519 r20523  
    355355        outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true;
    356356
     357        if (psMetadataLookupBool(&mdok, recipe, "RENORM")) {
     358            // Statistics for renormalisation
     359            psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe,
     360                                                                                    "RENORM.MEAN"));
     361            psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe,
     362                                                                                     "RENORM.STDEV"));
     363            if (renormMean == PS_STAT_NONE || renormStdev == PS_STAT_NONE) {
     364                psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     365                        "Unable to parse renormalisation statistics from recipe.");
     366                psFree(outRO);
     367                return false;
     368            }
     369            int renormNum = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); // Number of samples
     370            float renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width of Gaussian phot
     371            psMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask
     372            if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth,
     373                                           renormMean, renormStdev, NULL)) {
     374                psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
     375                psFree(outRO);
     376                return false;
     377            }
     378        }
     379
    357380        pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");
    358381        pmFPACopy(photFile->fpa, outRO->parent->parent->parent);
     
    362385        // scratch.
    363386
     387        if (psMetadataLookupBool(&mdok, recipe, "PSPHOT.VISUAL")) {
     388            psphotSetVisual(true);
     389        }
     390
    364391        // Need to ensure aperture residual is not calculated
    365         psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PSPHOT_RECIPE); // Recipe
    366         if (!recipe) {
     392        psMetadata *psphotRecipe = psMetadataLookupMetadata(NULL, config->recipes, PSPHOT_RECIPE); // Recipe
     393        if (!psphotRecipe) {
    367394            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
    368395            return false;
    369396        }
    370         const char *breakpoint = psMetadataLookupStr(&mdok, recipe, "BREAK_POINT"); // Current break point
    371         psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
     397        const char *breakpoint = psMetadataLookupStr(&mdok, psphotRecipe, "BREAK_POINT"); // Current break point
     398        psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
    372399                         "ALTERED break point for psphot operations", "PSFMODEL");
    373400
     
    375402        psMaskType maskValue = maskVal;
    376403        psMaskType markValue = pmConfigMaskGet("MARK.VALUE", config); // Bits to use for marking
    377         psMetadataAddU8(recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue);
    378         psMetadataAddU8(recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for marking",
     404        psMetadataAddU8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue);
     405        psMetadataAddU8(psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for marking",
    379406                        markValue);
    380407
     
    386413
    387414        if (breakpoint) {
    388             psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
     415            psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
    389416                             "RESTORED break point for psphot operations", breakpoint);
    390417        }
Note: See TracChangeset for help on using the changeset viewer.