IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2010, 3:55:49 PM (16 years ago)
Author:
eugene
Message:

update merges from trunk

Location:
branches/eam_branches/20100225
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20100225

  • branches/eam_branches/20100225/ppStack/src/ppStackMatch.c

    r27004 r27517  
    1818#define COVAR_FRAC 0.01                 // Truncation fraction for covariance matrix
    1919
    20 //#define TESTING                         // Enable debugging output
     20// #define TESTING                         // Enable debugging output
    2121
    2222#ifdef TESTING
     
    115115    psFree(coords);
    116116    psFree(tree);
     117    psFree(x);
     118    psFree(y);
    117119
    118120    psLogMsg("ppStack", PS_LOG_INFO, "Filtered out %d of %d sources", numFiltered, numGood);
     
    151153    if (!psImageUnbin(unbinned, binned, binning)) {
    152154        psError(PPSTACK_ERR_DATA, false, "Unable to unbin background model");
     155        psFree(binned);
    153156        psFree(unbinned);
    154157        return NULL;
    155158    }
    156 
    157     // XXX should these really be here?? (probably not...)
    158     // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");
    159     // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");
    160 
    161      return unbinned;
     159    psFree(binned);
     160
     161    return unbinned;
    162162}
    163163
     
    407407
    408408            if (threads > 0) {
    409                 pmSubtractionThreadsInit(readout, fake);
     409                pmSubtractionThreadsInit();
    410410            }
    411411
     
    423423                    psFree(conv);
    424424                    if (threads > 0) {
    425                         pmSubtractionThreadsFinalize(readout, fake);
     425                        pmSubtractionThreadsFinalize();
    426426                    }
    427427                    return false;
     
    440440                    psFree(widthsCopy);
    441441                    if (threads > 0) {
    442                         pmSubtractionThreadsFinalize(readout, fake);
     442                        pmSubtractionThreadsFinalize();
    443443                    }
    444444                    return false;
     
    458458                    psFree(widthsCopy);
    459459                    if (threads > 0) {
    460                         pmSubtractionThreadsFinalize(readout, fake);
     460                        pmSubtractionThreadsFinalize();
    461461                    }
    462462                    return false;
     
    495495
    496496            if (threads > 0) {
    497                 pmSubtractionThreadsFinalize(readout, fake);
     497                pmSubtractionThreadsFinalize();
    498498            }
    499499
     
    628628
    629629    // Measure the variance level for the weighting
    630     if (!psImageBackground(bg, NULL, readout->variance, readout->mask, maskVal | maskBad, rng)) {
    631         psError(PPSTACK_ERR_DATA, false, "Can't measure mean variance for image.");
    632         psFree(rng);
    633         psFree(bg);
    634         return false;
    635     }
    636     options->weightings->data.F32[index] = 1.0 / (psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN) *
    637                                                   psImageCovarianceFactor(readout->covariance));
     630    if (psMetadataLookupBool(NULL, recipe, "WEIGHTS")) {
     631        if (!psImageBackground(bg, NULL, readout->variance, readout->mask, maskVal | maskBad, rng)) {
     632            psError(PPSTACK_ERR_DATA, false, "Can't measure mean variance for image.");
     633            psFree(rng);
     634            psFree(bg);
     635            return false;
     636        }
     637        options->weightings->data.F32[index] = 1.0 / (psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN) *
     638                                                      psImageCovarianceFactor(readout->covariance));
     639    } else {
     640        options->weightings->data.F32[index] = 1.0;
     641    }
    638642    psLogMsg("ppStack", PS_LOG_INFO, "Weighting for image %d is %f\n",
    639643             index, options->weightings->data.F32[index]);
    640     psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHTING", 0,
    641                      "Weighting by 1/noise^2 for stack", options->weightings->data.F32[index]);
    642644
    643645    psFree(rng);
Note: See TracChangeset for help on using the changeset viewer.