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

Location:
branches/eam_branches/ipp-dev-20210817/psModules/src
Files:
3 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
  • branches/eam_branches/ipp-dev-20210817/psModules/src/objects/pmSourceIO_CMF.c.in

    r41825 r41836  
    761761bool pmSourcesWrite_CMF_@CMFMODE@ (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe)
    762762{
    763     // bool status = pmSourcesWrite_CMF_@CMFMODE@_Old (fits, readout, sources, imageHeader, tableHeader, extname, recipe);
    764     bool status = pmSourcesWrite_CMF_@CMFMODE@_New (fits, readout, sources, imageHeader, tableHeader, extname, recipe);
     763  // bool status = pmSourcesWrite_CMF_@CMFMODE@_Old (fits, readout, sources, imageHeader, tableHeader, extname, recipe);
     764     bool status = pmSourcesWrite_CMF_@CMFMODE@_New (fits, readout, sources, imageHeader, tableHeader, extname, recipe);
    765765    return status;
    766766}
     
    11951195
    11961196psArray *pmSourcesRead_CMF_@CMFMODE@ (psFits *fits, psMetadata *header) {
    1197 // psArray *array = pmSourcesRead_CMF_@CMFMODE@_Old (fits, header);
    1198     psArray *array = pmSourcesRead_CMF_@CMFMODE@_New (fits, header);
     1197  // psArray *array = pmSourcesRead_CMF_@CMFMODE@_Old (fits, header);
     1198      psArray *array = pmSourcesRead_CMF_@CMFMODE@_New (fits, header);
    11991199    return array;
    12001200}
  • branches/eam_branches/ipp-dev-20210817/psModules/src/objects/pmSourceIO_Ghosts.c

    r41391 r41836  
    136136    pmFPAview *view = pmFPAviewAlloc (0);
    137137
    138     //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
     138    // We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
    139139    float mirCheck = 0;
    140140    md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD");
     
    153153    GET_1D_POLY ("GHOST.INNER.MINOR", innerMinor);
    154154
    155 
    156155    // select the input astrometry data (also carries the refstars)
    157156    pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     
    211210                        double theta0 = atan2(ref->FP->y,ref->FP->x);
    212211
    213                         if(mirCheck) {
     212                        // EAM: XXX we should just use the existence of mirrorRad (!= NULL) instead of carrying a different bool
     213                        if (mirCheck) {
    214214                            //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
    215215                            double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
     
    220220                            ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    221221                            ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    222                         } 
    223                         if(!mirCheck) {
     222                        } else {
    224223                            //Use the old-style ghost position determination
    225224                            ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
     
    303302        psFree (outerMajor);
    304303        psFree (outerMinor);
     304        psFree (mirrorRad);
    305305        psFree (ghostModel);
    306306        psFree (view);
     
    327327    psFree (outerMajor);
    328328    psFree (outerMinor);
     329    psFree (mirrorRad);
    329330    psFree (ghostModel);
    330331    psFree (view);
Note: See TracChangeset for help on using the changeset viewer.