IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 19, 2009, 7:59:50 AM (18 years ago)
Author:
beaumont
Message:

Added visualizations to ppSub. Set up a single variable in pmVisual to control when plots are drawn.

Location:
branches/cnb_branch_20090215/ppStack/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branch_20090215/ppStack/src/ppStack.c

    r21258 r21536  
    7474    pmConfigDone();
    7575    psLibFinalize();
    76 
     76    pmVisualClose();
    7777    exit(exitValue);
    7878}
  • branches/cnb_branch_20090215/ppStack/src/ppStackArguments.c

    r21477 r21536  
    176176    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-limit", 0, "Limit on star rejection fraction for successful iteration", NAN);
    177177    psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys", 0, "Estimated systematic error", NAN);
    178     psMetadataAddBool(arguments, PS_LIST_TAIL, "-renorm", 0, "Renormalise variance maps?", false);
    179     psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-mean", 0,
    180                      "Statistic for mean in renormalisation", NULL);
    181     psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-stdev", 0,
    182                      "Statistic for stdev in renormalisation", NULL);
    183     psMetadataAddF32(arguments, PS_LIST_TAIL, "-renorm-width", 0, "Gaussian width for renormalisation", NAN);
    184     psMetadataAddS32(arguments, PS_LIST_TAIL, "-renorm-num", 0, "Number of samples for renormalisation", 0);
    185178    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-image", 0, "Suffix for temporary images", NULL);
    186179    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-mask", 0, "Suffix for temporary masks", NULL);
    … …  
    189182                      "Delete temporary files on completion?", false);
    190183    psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads to use", 0);
    191     psMetadataAddBool(arguments, PS_LIST_TAIL, "-psphot-visual", 0, "psphot visualisation", 0);
     184    psMetadataAddBool(arguments, PS_LIST_TAIL, "-visual", 0, "visualisation", 0);
    192185
    193186    if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 3) {
    … …  
    280273    }
    281274
    282     if (psMetadataLookupBool(NULL, arguments, "-renorm") ||
    283         psMetadataLookupBool(NULL, recipe, "RENORM")) {
    284         psMetadataAddBool(arguments, PS_LIST_TAIL, "RENORM", 0, "Renormalise variance maps?", true);
    285     }
    286     VALUE_ARG_RECIPE_INT("-renorm-num", "RENORM.NUM", S32, 0);
    287     VALUE_ARG_RECIPE_FLOAT("-renorm-width", "RENORM.WIDTH", F32);
    288     valueArgRecipeStr(arguments, recipe, "-renorm-mean",  "RENORM.MEAN", recipe);
    289     valueArgRecipeStr(arguments, recipe, "-renorm-stdev", "RENORM.STDEV", recipe);
    290 
    291275    valueArgRecipeStr(arguments, recipe, "-temp-image",    "TEMP.IMAGE",  recipe);
    292276    valueArgRecipeStr(arguments, recipe, "-temp-mask",     "TEMP.MASK",   recipe);
  • branches/cnb_branch_20090215/ppStack/src/ppStackLoop.c

    r21477 r21536  
    480480            psMetadataAddF32(stats, PS_LIST_TAIL, "STAMP.NUM", PS_META_DUPLICATE_OK,
    481481                             "Number of stamps", kernels->numStamps);
     482            float deconv = psMetadataLookupF32(NULL, readout->analysis,
     483                                               PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Deconvolution fraction
     484            psMetadataAddF32(stats, PS_LIST_TAIL, "KERNEL.DECONV", PS_META_DUPLICATE_OK,
     485                             "Deconvolution fraction for kernel", deconv);
    482486            psMetadataAddF32(stats, PS_LIST_TAIL, "PPSTACK.WEIGHTING", PS_META_DUPLICATE_OK,
    483487                             "Weighting for image", weightings->data.F32[i]);
    … …  
    503507            psStringAppend(&name, "covariance_%d.fits", i);
    504508            writeImage(name, hdu->header, readout->covariance->image, config);
     509            pmStackVisualPlotTestImage(readout->covariance->image, name);
    505510            psFree(name);
    506511        }
    … …  
    801806#ifdef TESTING
    802807    writeImage("combined_initial.fits", NULL, outRO->image, config);
     808    pmStackVisualPlotTestImage(outRO->image, "combined_initial.fits");
    803809#endif
    804810
    … …  
    884890                psString name = NULL;           // Name of image
    885891                psStringAppend(&name, "inspect_%03d.fits", i);
     892                pmStackVisualPlotTestImage(mask, name);
    886893                psFits *fits = psFitsOpen(name, "w");
    887894                psFree(name);
    … …  
    901908                psString name = NULL;           // Name of image
    902909                psStringAppend(&name, "reject_%03d.fits", i);
     910                pmStackVisualPlotTestImage(mask, name);
    903911                psFits *fits = psFitsOpen(name, "w");
    904912                psFree(name);
    … …  
    10341042
    10351043#ifdef TESTING
     1044    pmStackVisualPlotTestImage(outRO->image, "combined_initial.fits");
    10361045    writeImage("combined_final.fits", NULL, outRO->image, config);
    10371046#endif
    … …  
    11511160    psLogMsg("ppStack", PS_LOG_INFO, "Stage 7 : WCS & JPEGS : %f sec", psTimerClear("PPSTACK_STEPS"));
    11521161
    1153     if (psMetadataLookupBool(&mdok, recipe, "RENORM")) {
    1154         // Statistics for renormalisation
    1155         psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,
    1156                                                                                 "RENORM.MEAN"));
    1157         psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,
    1158                                                                                  "RENORM.STDEV"));
    1159         int renormNum = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); // Number of samples
    1160         float renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width of Gaussian phot
    1161         psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask
    1162         if (!pmReadoutVarianceRenormPhot(outRO, maskValue, renormNum, renormWidth,
    1163                                          renormMean, renormStdev, NULL)) {
    1164             psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
    1165             psFree(outRO);
    1166             return false;
    1167         }
    1168     }
    1169 
    1170     psLogMsg("ppStack", PS_LOG_INFO, "Stage 8 : Photometry Renormalization : %f sec", psTimerClear("PPSTACK_STEPS"));
    1171 
    11721162    if (psMetadataLookupBool(&mdok, recipe, "PHOTOMETRY")) {
    11731163        psTrace("ppStack", 1, "Photometering stacked image....\n");
    … …  
    11991189    }
    12001190
    1201     psLogMsg("ppStack", PS_LOG_INFO, "Stage 9 : Photometry Analysis : %f sec", psTimerClear("PPSTACK_STEPS"));
     1191    psLogMsg("ppStack", PS_LOG_INFO, "Stage 8 : Photometry Analysis : %f sec", psTimerClear("PPSTACK_STEPS"));
    12021192
    12031193    psThreadPoolFinalize();
    … …  
    12541244    }
    12551245
    1256     psLogMsg("ppStack", PS_LOG_INFO, "Stage 10 : Final Output : %f sec", psTimerClear("PPSTACK_STEPS"));
     1246    psLogMsg("ppStack", PS_LOG_INFO, "Stage 9 : Final Output : %f sec", psTimerClear("PPSTACK_STEPS"));
    12571247
    12581248    memDump("finish");
  • branches/cnb_branch_20090215/ppStack/src/ppStackMatch.c

    r21477 r21536  
    189189
    190190    bool mdok;                          // Status of MD lookup
    191     bool renorm = psMetadataLookupBool(&mdok, recipe, "RENORM"); // Renormalise variances?
    192191    float penalty = psMetadataLookupF32(NULL, ppsub, "PENALTY"); // Penalty for wideness
    193192    int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
    … …  
    359358                psString name = NULL;
    360359                psStringAppend(&name, "fake_%03d.fits", numInput);
     360                pmStackVisualPlotTestImage(fake->image, name);
    361361                psFits *fits = psFitsOpen(name, "w");
    362362                psFree(name);
    … …  
    368368                psString name = NULL;
    369369                psStringAppend(&name, "real_%03d.fits", numInput);
     370                pmStackVisualPlotTestImage(readout->image, name);
    370371                psFits *fits = psFitsOpen(name, "w");
    371372                psFree(name);
    … …  
    374375            }
    375376#endif
    376 
    377             // Renormalise the variances if desired
    378             if (renorm) {
    379                 // Statistics for renormalisation
    380                 psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,
    381                                                                                         "RENORM.MEAN"));
    382                 psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,
    383                                                                                          "RENORM.STDEV"));
    384 
    385                 if (!pmReadoutVarianceRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {
    386                     psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
    387                     psFree(output);
    388                     return false;
    389                 }
    390             }
    391377
    392378            if (threads > 0) {
    … …  
    413399                psString name = NULL;
    414400                psStringAppend(&name, "conv_%03d.fits", numInput);
     401                pmStackVisualPlotTestImage(output->image, name);
    415402                psFits *fits = psFitsOpen(name, "w");
    416403                psFree(name);
    … …  
    422409                psString name = NULL;
    423410                psStringAppend(&name, "diff_%03d.fits", numInput);
     411                pmStackVisualPlotTestImage(fake->image, name);
    424412                psFits *fits = psFitsOpen(name, "w");
    425413                psFree(name);
    … …  
    562550    }
    563551
    564     // Renormalise the variances if desired
    565     if (renorm) {
    566         // Statistics for renormalisation
    567         psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,
    568                                                                                 "RENORM.MEAN"));
    569         psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,
    570                                                                                  "RENORM.STDEV"));
    571 
    572         if (!pmReadoutVarianceRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {
    573             psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
    574             psFree(output);
    575             return false;
    576         }
    577     }
    578 
    579552    // Ensure the background value is zero
    580553    psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for background
    … …  
    664637        psString name = NULL;
    665638        psStringAppend(&name, "convolved_%03d.fits", numInput);
     639        pmStackVisualPlotTestImage(output->image, name);
    666640        psFits *fits = psFitsOpen(name, "w");
    667641        psFree(name);
  • branches/cnb_branch_20090215/ppStack/src/ppStackPhotometry.c

    r21259 r21536  
    118118    pmFPACopy(photFile->fpa, readout->parent->parent->parent);
    119119
    120     if (psMetadataLookupBool(NULL, config->arguments, "-psphot-visual")) {
    121         psphotSetVisual(true);
     120    if (psMetadataLookupBool(NULL, config->arguments, "-visual")) {
     121        pmVisualSetVisual(true);
    122122    }
    123123
  • branches/cnb_branch_20090215/ppStack/src/ppStackSources.c

    r21260 r21536  
    6969        psString name = NULL;
    7070        psStringAppend(&name, "start_%03d.fits", i);
     71        pmStackVisualPlotTestImage(fake->image, name);
    7172        psFits *fits = psFitsOpen(name, "w");
    7273        psFree(name);
    … …  
    154155    int minMatches = PS_MAX (2, 0.5*num);
    155156    for (int i = 0; i < matches->n; i++) {
    156         pmSourceMatch *match = matches->data[i]; // Match of interest
    157         if (match->num < minMatches) continue;
    158 
    159         // We need to grab a single instance of this source: just take the first available
    160         int nImage = match->image->data.S32[0];
    161         int nIndex = match->index->data.S32[0];
    162         psArray *sources = sourceLists->data[nImage];
    163         pmSource *source = sources->data[nIndex];
    164        
    165         // stick this sample source on sourcesBest
    166         psArrayAdd (sourcesBest, 100, source);
     157        pmSourceMatch *match = matches->data[i]; // Match of interest
     158        if (match->num < minMatches) continue;
     159
     160        // We need to grab a single instance of this source: just take the first available
     161        int nImage = match->image->data.S32[0];
     162        int nIndex = match->index->data.S32[0];
     163        psArray *sources = sourceLists->data[nImage];
     164        pmSource *source = sources->data[nIndex];
     165
     166        // stick this sample source on sourcesBest
     167        psArrayAdd (sourcesBest, 100, source);
    167168    }
    168169    psMetadataAdd (sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, "psphot sources", sourcesBest);
Note: See TracChangeset for help on using the changeset viewer.