IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 22, 2009, 2:57:41 PM (16 years ago)
Author:
eugene
Message:

various fixes to psastro:

1) added bootstrap resampling to zero point error analysis
2) added iterative clump removal from refstars and rawstars
3) added unique reference match option
4) some improved visualizations
5) improved mosaic iterations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroOneChipFit.c

    r24035 r26259  
    2828    REQUIRED_RECIPE_VALUE (int nIter, "PSASTRO.MATCH.FIT.NITER", S32);
    2929
     30    // for iterations >= uniqIter, require a single match per reference
     31    REQUIRED_RECIPE_VALUE (int uniqIter, "PSASTRO.MATCH.UNIQ.ITER", S32);
     32
    3033    // correct radius to FP units (physical pixel scale in microns per pixel)
    3134    REQUIRED_RECIPE_VALUE (double pixelScale, "PSASTRO.PIXEL.SCALE", F32);
     
    6164            return false;
    6265        }
     66
     67        if (iter >= uniqIter) {
     68            psArray *unique = pmAstromRadiusMatchUniq (rawstars, refstars, match);
     69            if (!unique) {
     70                psLogMsg ("psastro", 3, "failed to generate a uniq set of matched sources\n");
     71                return false;
     72            }
     73            psFree (match);
     74            match = unique;
     75        }
    6376
    6477        // modify the order to correspond to the actual number of matched stars:
     
    101114        }
    102115
    103         // XXX allow statitic to be set by the user
     116        // XXX allow statistic to be set by the user
    104117        // fitStats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
    105118        fitStats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
     
    117130
    118131        // determine fromFPA transformation and apply new transformation to raw & ref stars
    119         psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
     132        // this applies the transformation to all stars (including subset)
     133        psastroUpdateChipToFPA (fpa, chip); // updates PSASTRO.RAWSTARS and PSASTRO.REFSTARS
    120134
    121135        // toSky converts from FPA & TPA units (microns) to sky units (radians)
    122136        float plateScale = 0.5*(fpa->toSky->Xs + fpa->toSky->Ys)*3600.0*PM_DEG_RAD;
    123         // float astError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) * plateScale;
    124         float astError = 0.5*(results->xStats->robustStdev + results->yStats->robustStdev) * plateScale;
     137
     138        float rawXstdev = psStatsGetValue (results->xStats, psStatsStdevOption(results->xStats->options));
     139        float rawYstdev = psStatsGetValue (results->yStats, psStatsStdevOption(results->yStats->options));
     140
     141        float astError = 0.5*(rawXstdev + rawYstdev) * plateScale;
    125142        int astNstar = results->yStats->clippedNvalues;
    126143        psLogMsg ("psastro", PS_LOG_INFO, "pass %d, error: %f arcsec, Nstars: %d", iter, astError, astNstar);
     
    136153    float plateScale = 0.5*(fpa->toSky->Xs + fpa->toSky->Ys)*3600.0*PM_DEG_RAD;
    137154
     155    float rawXstdev = psStatsGetValue (results->xStats, psStatsStdevOption(results->xStats->options));
     156    float rawYstdev = psStatsGetValue (results->yStats, psStatsStdevOption(results->yStats->options));
     157
    138158    // pixError is the average 1D scatter in pixels ('results' are in FPA units = microns)
    139     // float pixError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) / pixelScale;
    140     float pixError = 0.5*(results->xStats->robustStdev + results->yStats->robustStdev) / pixelScale;
     159    float pixError = 0.5*(rawXstdev + rawYstdev) / pixelScale;
    141160
    142161    // astError is the average 1D scatter in arcsec ('results' are in FPA units = microns)
    143     // float astError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) * plateScale;
    144     float astError = 0.5*(results->xStats->robustStdev + results->yStats->robustStdev) * plateScale;
     162    float astError = 0.5*(rawXstdev + rawYstdev) * plateScale;
     163
     164    // x and y are forced to use the same subset of values:
    145165    int astNstar = results->yStats->clippedNvalues;
    146166
     
    170190    psMetadataAddF32 (updates, PS_LIST_TAIL, "EQUINOX",  PS_META_REPLACE, "equinox of ref catalog", 2000.0); // XXX this is bogus: should be defined based on equinox of refstars
    171191
    172     // XXX drop from here : determine fromFPA transformation and apply new transformation to raw & ref stars
    173     // psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
     192    // additional error measurements:
     193    psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_CDX",   PS_META_REPLACE, "chip astrometry X stdev (arcsec)", rawXstdev * plateScale);
     194    psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_CSX",   PS_META_REPLACE, "chip astrometry X systematic err (arcsec)", results->dXsys * plateScale);
     195    psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_CRX",   PS_META_REPLACE, "chip astrometry X 10-90 percentile (arcsec)", results->dXrange * plateScale);
     196
     197    psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_CDY",   PS_META_REPLACE, "chip astrometry Y stdev (arcsec)", rawYstdev * plateScale);
     198    psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_CSY",   PS_META_REPLACE, "chip astrometry Y systematic err (arcsec)", results->dYsys * plateScale);
     199    psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_CRY",   PS_META_REPLACE, "chip astrometry Y 10-90 percentile (arcsec)", results->dYrange * plateScale);
    174200
    175201    // XXX check if we correctly applied the new transformation:
     
    189215    psFree (results);
    190216    psFree (fitStats);
     217
    191218    return validSolution;
    192219}
Note: See TracChangeset for help on using the changeset viewer.