IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27571


Ignore:
Timestamp:
Apr 1, 2010, 5:02:37 PM (16 years ago)
Author:
Paul Price
Message:

Fix assertion failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotSourceStats.c

    r27136 r27571  
    1616    // loop over the available readouts
    1717    for (int i = 0; i < num; i++) {
    18         if (!psphotSourceStatsReadout (config, view, "PSPHOT.INPUT", i, recipe, setWindow)) {
     18        if (!psphotSourceStatsReadout (config, view, "PSPHOT.INPUT", i, recipe, setWindow)) {
    1919            psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);
    20             return false;
    21         }
     20            return false;
     21        }
    2222    }
    2323    return true;
     
    4444    // XXX TEST:
    4545    if (detections->allSources) {
    46         psphotMaskCosmicRayFootprintCheck(detections->allSources);
     46        psphotMaskCosmicRayFootprintCheck(detections->allSources);
    4747    }
    4848    if (detections->newSources) {
    49         psphotMaskCosmicRayFootprintCheck(detections->newSources);
     49        psphotMaskCosmicRayFootprintCheck(detections->newSources);
    5050    }
    5151
     
    8888    // if there are no peaks, we save the empty source array and return
    8989    if (!peaks->n) {
    90         // save the new sources on the detection structure:
    91         detections->newSources = sources;
    92         return true;
     90        // save the new sources on the detection structure:
     91        detections->newSources = sources;
     92        return true;
    9393    }
    9494
     
    119119        psLogMsg ("psphot", PS_LOG_INFO, "break point PEAKS, skipping MOMENTS\n");
    120120        psphotVisualShowMoments (sources);
    121         detections->newSources = sources;
     121        detections->newSources = sources;
    122122        return true;
    123123    }
     
    126126        if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) {
    127127            psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");
    128             psFree(sources);
     128            psFree(sources);
    129129            return false;
    130130        }
     
    134134    float SIGMA = psMetadataLookupF32 (&status, readout->analysis, "MOMENTS_GAUSS_SIGMA");
    135135    if (!status) {
    136         SIGMA = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");
     136        SIGMA = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");
    137137    }
    138138    float RADIUS = psMetadataLookupF32 (&status, readout->analysis, "PSF_MOMENTS_RADIUS");
    139139    if (!status) {
    140         RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
     140        RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
    141141    }
    142142
     
    178178                psError(PS_ERR_UNKNOWN, false, "Unable to launch thread job PSPHOT_SOURCE_STATS");
    179179                psFree (job);
    180                 psFree(sources);
     180                psFree(sources);
    181181                return false;
    182182            }
     
    187187        if (!psThreadPoolWait (false)) {
    188188            psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS");
    189             psFree(sources);
     189            psFree(sources);
    190190            return false;
    191191        }
     
    220220
    221221    if (detections->allSources) {
    222         psphotMaskCosmicRayFootprintCheck(detections->allSources);
     222        psphotMaskCosmicRayFootprintCheck(detections->allSources);
    223223    }
    224224    if (detections->newSources) {
    225         psphotMaskCosmicRayFootprintCheck(detections->newSources);
     225        psphotMaskCosmicRayFootprintCheck(detections->newSources);
    226226    }
    227227
     
    229229}
    230230
    231 // this function is currently only called by psphotCheckExtSources 
     231// this function is currently only called by psphotCheckExtSources
    232232bool psphotSourceStatsUpdate (psArray *sources, pmConfig *config, pmReadout *readout) {
    233233
     
    261261
    262262        // allocate space for moments
    263         if (!source->moments) {
    264             source->moments = pmMomentsAlloc();
    265         }
     263        if (!source->moments) {
     264            source->moments = pmMomentsAlloc();
     265        }
    266266
    267267        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
     
    279279    // XXX how else could we get the window size in?
    280280    if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) {
    281         psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");
    282         return NULL;
     281        psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");
     282        return NULL;
    283283    }
    284284
     
    303303            psThreadJob *job = psThreadJobAlloc ("PSPHOT_SOURCE_STATS");
    304304
    305             // XXX: this must match the above
     305            // XXX: this must match the above
    306306            psArrayAdd(job->args, 1, cells->data[j]); // sources
    307307            psArrayAdd(job->args, 1, recipe);
     
    515515    if (maxS < 0.65) Sigma = sigma[0];
    516516
    517     for (int i = 0; i < NSIGMA - 1; i++) {
     517    for (int i = 0; i < NSIGMA - 1 && isnan(Sigma); i++) {
     518        if (!isfinite(Sout[i]) || !isfinite(Sout[i+1])) continue;
    518519        if ((Sout[i] > 0.65) && (Sout[i+1] > 0.65)) continue;
    519520        if ((Sout[i] < 0.65) && (Sout[i+1] < 0.65)) continue;
Note: See TracChangeset for help on using the changeset viewer.