IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 11, 2021, 11:45:42 AM (5 years ago)
Author:
eugene
Message:

add dXstdev, dYstdev stats; plug memleak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-dev-20210817/psModules/src/astrom/pmAstrometryObjects.c

    r41814 r41836  
    354354
    355355        bool isValid = true;
    356         isValid = isValid & isfinite (xFit->data.F32[i]);
    357         isValid = isValid & isfinite (yFit->data.F32[i]);
     356        isValid = isValid & isfinite (x->data.F32[i]);
     357        isValid = isValid & isfinite (y->data.F32[i]);
    358358        isValid = isValid & isfinite (xRes->data.F32[i]);
    359359        isValid = isValid & isfinite (yRes->data.F32[i]);
    360360        if (isValid) {
    361           psVectorAppend (xPosValid, xFit->data.F32[i]);
    362           psVectorAppend (yPosValid, yFit->data.F32[i]);
     361          psVectorAppend (xPosValid, x->data.F32[i]);
     362          psVectorAppend (yPosValid, y->data.F32[i]);
    363363          psVectorAppend (xResValid, xRes->data.F32[i]);
    364364          psVectorAppend (yResValid, yRes->data.F32[i]);
     
    391391      results->dXsys   = results->dYsys   = NAN;
    392392      results->dXrange = results->dYrange = NAN;
     393      results->dXstdev = results->dYstdev = NAN;
    393394    } else {
    394395      results->dXsys = psVectorSystematicError (xResGood, xErr, 0.05);
     
    427428
    428429# define VAL_COUNT 9.0
    429 # define MIN_COUNT 7.0
     430# define MIN_COUNT 5.0
    430431
    431432float pmAstrom2DSystematics (psVector *xPos, psVector *yPos, psVector *value) {
    432433
    433434    // pre-filter the values to ensure no NANs, other invalid
    434     if (xPos->n < VAL_COUNT*2*2) { return NAN; }
     435    if (xPos->n < VAL_COUNT*2*2) {
     436      return NAN;
     437    }
    435438
    436439    // generate a grid covering the full range of x,y and measure the median value in each
     
    455458    float yStep = Ncell / (yMax - yMin);
    456459 
    457     if (isnan(xStep)) { return NAN; }
    458     if (isnan(yStep)) { return NAN; }
     460    if (isnan(xStep)) {
     461      return NAN;
     462    }
     463    if (isnan(yStep)) {
     464      return NAN;
     465    }
    459466
    460467    psArray *xBin = psArrayAlloc (Ncell);
     
    487494        for (int iy = 0; iy < Ncell; iy++) {
    488495            psVector *Bin = yBin->data[iy];
    489      
     496            if (Bin->n < MIN_COUNT) { continue; }
     497
    490498            // psVectorStats resets stats so we can call this repeatedly
    491499            psVectorStats (stats, Bin, NULL, NULL, 0);
     
    499507    psVectorStats (stats, sample, NULL, NULL, 0);
    500508    float result = stats->sampleStdev;
     509
     510    if (!isfinite(stats->sampleStdev)) {
     511      fprintf (stderr, "*** bad solution ***\n");
     512    }
    501513
    502514    // NOTE: the elements of xBin are freed automatically, which extends down to the vectors
Note: See TracChangeset for help on using the changeset viewer.