IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 4, 2021, 6:08:21 PM (5 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-dev-20210817 (add CERSTD, NASTUSED to header, allow rejection no CERSTD, add psastroTIO)

Location:
trunk/psastro
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro

  • trunk/psastro/src/psastroMosaicOneChip.c

    r39926 r41895  
    2323    bool status;
    2424    char errorWord[64];
     25    char stdevWord[64];
    2526    char orderWord[64];
    2627
     
    4445
    4546    // allowed limits for valid solutions
     47    // CERROR is currently tested during the iterations, but not CERSTD
    4648    snprintf (errorWord, 64, "PSASTRO.MOSAIC.MAX.ERROR.N%d", iteration);
    47     REQUIRED_RECIPE_VALUE (float maxError, errorWord, F32, "failed to find single-chip max allowed error\n");
    48     REQUIRED_RECIPE_VALUE (int minNstar, "PSASTRO.MOSAIC.MIN.NSTAR", S32, "failed to find single-chip min allowed stars\n");
     49    snprintf (stdevWord, 64, "PSASTRO.MOSAIC.MAX.STDEV.N%d", iteration);
     50    REQUIRED_RECIPE_VALUE (float maxError,                  errorWord, F32, "failed to find single-chip max allowed error\n");
     51    REQUIRED_RECIPE_VALUE (float maxStdev,                  stdevWord, F32, "failed to find single-chip max allowed stdev\n");
     52    REQUIRED_RECIPE_VALUE (int   minNstar, "PSASTRO.MOSAIC.MIN.NSTAR", S32, "failed to find single-chip min allowed stars\n");
    4953
    5054    // set the order of the per-chip fit (higher order only if iteration > 0)
     
    8892        }
    8993    } else {
     94        // Forward transformations (chip->fpa->tpa->sky) use Ordinary polynomials
    9095        psFree (chip->toFPA);
    91         chip->toFPA = psPlaneTransformAlloc (order, order);
     96        chip->toFPA = psPlaneTransformAlloc (order, order, PS_POLYNOMIAL_ORD);
    9297        for (int i = 0; i <= chip->toFPA->x->nX; i++) {
    9398            for (int j = 0; j <= chip->toFPA->x->nY; j++) {
     
    134139    int astNstar = results->yStats->clippedNvalues;
    135140
     141    // astStdev is the average 1D stdev of median residuals in arcsec ('results' are in FPA units = microns)
     142    // the median residuals are calculated in a grid of N x N bins
     143    float astStdev = 0.5*(results->dXstdev + results->dYstdev) * plateScale;
     144
    136145    // if we clip away too many stars, the order may be invalid
    137146    if (order == 3) { minNstar = PS_MAX (15, minNstar); }
     
    141150    bool validSolution = true;
    142151
    143     // XXX should these result in errors or be handled another way?
    144     psLogMsg ("psastro", PS_LOG_INFO, "astrometry solution: error: %f arcsec, Nstars: %d", astError, astNstar);
     152    // We have options to exclude chips on the basis of NASTRO, CERROR, CERSTD
     153    psLogMsg ("psastro", PS_LOG_INFO, "astrometry solution: error: %f arcsec, Nstars: %d, stdev: %f arcsec", astError, astNstar, astStdev);
    145154    if ((maxError > 0) && (astError > maxError)) {
    146155        psLogMsg("psastro", PS_LOG_INFO, "residual error is too large, failed to find a solution: %f > %f", astError, maxError);
    147156        validSolution = false;
    148157    }
     158    if ((maxStdev > 0) && (astStdev > maxStdev)) {
     159        psLogMsg("psastro", PS_LOG_INFO, "residual stdev is too large, failed to find a solution: %f > %f", astStdev, maxStdev);
     160        validSolution = false;
     161    }
    149162    if (astNstar < minNstar) {
    150163        psLogMsg("psastro", PS_LOG_INFO, "solution uses too few stars: %d < %d", astNstar, minNstar);
     
    152165    }
    153166
    154     // DVO expects NASTRO = 0 if we fail to find a solution
     167    // DVO expects NASTRO = 0 if we fail to find a solution, NASTUSED is the true number
    155168    psMetadataAddF32 (updates, PS_LIST_TAIL, "PERROR",   PS_META_REPLACE, "astrometry error (pixels)", pixError);
    156169    psMetadataAddF32 (updates, PS_LIST_TAIL, "CERROR",   PS_META_REPLACE, "astrometry error (arcsec)", astError);
     170    psMetadataAddF32 (updates, PS_LIST_TAIL, "CERSTD",   PS_META_REPLACE, "astrometry stdev (arcsec)", astStdev);
    157171    if (validSolution) {
    158172        psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", astError/sqrt(astNstar));
    159173        psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO",   PS_META_REPLACE, "number of astrometry stars", astNstar);
     174        psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTUSED", PS_META_REPLACE, "number of astrometry stars", astNstar);
    160175    } else {
    161176        psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", 0.0);
    162177        psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO",   PS_META_REPLACE, "number of astrometry stars", 0);
     178        psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTUSED", PS_META_REPLACE, "number of astrometry stars", astNstar);
    163179    }
    164180    psMetadataAddF32 (updates, PS_LIST_TAIL, "EQUINOX",  PS_META_REPLACE, "", 2000.0); // XXX this is bogus: should be defined based on equinox of refstars
Note: See TracChangeset for help on using the changeset viewer.