IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20554


Ignore:
Timestamp:
Nov 5, 2008, 2:01:21 PM (18 years ago)
Author:
Paul Price
Message:

Output variance map should be renormalised for the pixels, not photometry, since that's what magic desires.

File:
1 edited

Legend:

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

    r20523 r20554  
    118118    bool dual = psMetadataLookupBool(&mdok, recipe, "DUAL"); // Dual convolution?
    119119
     120    // Statistics for renormalisation
     121    psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "RENORM.MEAN"));
     122    psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "RENORM.STDEV"));
     123    if (renormMean == PS_STAT_NONE || renormStdev == PS_STAT_NONE) {
     124        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     125                "Unable to parse renormalisation statistics from recipe.");
     126        return false;
     127    }
     128    int renormNum = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); // Number of samples for renormalisation
     129    float renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width of Gaussian phot
     130
    120131    psString interpModeStr = psMetadataLookupStr(&mdok, recipe, "INTERPOLATION"); // Interpolation mode
    121132    psImageInterpolateMode interpMode = psImageInterpolateModeFromString(interpModeStr); // Interp
     
    356367
    357368        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
    371369            psMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask
    372370            if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth,
     
    439437    outRO->mask = (psImage*)psBinaryOp(outRO->mask, inConv->mask, "|", refConv->mask);
    440438
    441     outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true;
    442 
    443     pmReadoutMaskApply(outRO, maskBad);
    444 
    445439    psFree(inConv);
    446440    psFree(refConv);
     441
     442    outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true;
     443
     444    pmReadoutMaskApply(outRO, maskBad);
    447445
    448446#ifdef TESTING
     
    460458        psFree(outRO);
    461459        return false;
    462     }
    463 
    464     if (psMetadataLookupBool(&mdok, recipe, "RENORM")) {
    465         // Statistics for renormalisation
    466         psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe,
    467                                                                                 "RENORM.MEAN"));
    468         psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe,
    469                                                                                  "RENORM.STDEV"));
    470         if (renormMean == PS_STAT_NONE || renormStdev == PS_STAT_NONE) {
    471             psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    472                     "Unable to parse renormalisation statistics from recipe.");
    473             psFree(outRO);
    474             return false;
    475         }
    476         int renormNum = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); // Number of samples
    477         float renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width of Gaussian phot
    478         psMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask
    479         if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth,
    480                                        renormMean, renormStdev, NULL)) {
    481             psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
    482             psFree(outRO);
    483             return false;
    484         }
    485460    }
    486461
     
    562537        }
    563538
     539        if (psMetadataLookupBool(&mdok, recipe, "RENORM")) {
     540            psMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask
     541            if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth,
     542                                           renormMean, renormStdev, NULL)) {
     543                psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
     544                psFree(outRO);
     545                return false;
     546            }
     547        }
     548
    564549        // Need to ensure aperture residual is not calculated
    565550        psMetadata *psphotRecipe = psMetadataLookupMetadata(NULL, config->recipes, PSPHOT_RECIPE); // Recipe
     
    636621    }
    637622
     623    // Renormalising for pixels, because that's what magic desires
     624    if (psMetadataLookupBool(&mdok, recipe, "RENORM")) {
     625        psMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask
     626        if (!pmReadoutWeightRenormPixels(outRO, maskValue, renormMean, renormStdev, NULL)) {
     627            psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
     628            psFree(outRO);
     629            return false;
     630        }
     631    }
     632
    638633    // Copy astrometry over
    639634    pmFPA *refFPA = refRO->parent->parent->parent; // Reference FPA
Note: See TracChangeset for help on using the changeset viewer.