IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20796


Ignore:
Timestamp:
Nov 18, 2008, 5:50:56 PM (17 years ago)
Author:
eugene
Message:

exclude bad fits from the boresite analyisis

File:
1 edited

Legend:

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

    r19977 r20796  
    265265    psVector *cornerDn = psVectorAllocEmpty (100, PS_TYPE_F32);
    266266
     267    psVector *cornerMK = psVectorAllocEmpty (100, PS_TYPE_U8);
     268
    267269    if (DEBUG) psastroDumpCorners ("corners.up.guess3.dat", "corners.dn.guess3.dat", fpa);
    268270
     
    272274    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    273275        if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; }
     276
     277        // XXX we are currently inconsistent with marking the good vs the bad data
     278        // psastroChipAstrom sets data_exists to false if the fit is bad.  this is
     279        // probably wrong since it implies there is no data!
     280
     281        // skip chips for which the astrometry failed (NASTRO == 0)
     282        if (!chip->cells->n) goto skip_chip;
     283        pmCell *cell = chip->cells->data[0];
     284        if (!cell) goto skip_chip;
     285
     286        if (!cell->readouts->n) goto skip_chip;
     287        pmReadout *readout = cell->readouts->data[0];
     288        if (!readout) goto skip_chip;
     289
     290        psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER");
     291        if (!updates) goto skip_chip;
     292       
     293        int nAstro = psMetadataLookupS32 (&status, updates, "NASTRO");
     294        if (!nAstro) goto skip_chip;
     295
     296        float astError = psMetadataLookupF32 (&status, updates, "CERROR");
     297        if (fabs(astError) < 1e-6) goto skip_chip;
    274298
    275299        psPlane ptCH, ptFP, ptTP;
     
    290314        psVectorAppend (cornerRn, ptSky.r);
    291315        psVectorAppend (cornerDn, ptSky.d);
     316        psVectorAppend (cornerMK, 0);
     317        continue;
     318
     319    skip_chip:
     320        // new corner locations based on the calibrated astrometry
     321        psVectorAppend (cornerLn, 0.0);
     322        psVectorAppend (cornerMn, 0.0);
     323        psVectorAppend (cornerPn, 0.0);
     324        psVectorAppend (cornerQn, 0.0);
     325        psVectorAppend (cornerRn, 0.0);
     326        psVectorAppend (cornerDn, 0.0);
     327        psVectorAppend (cornerMK, 1);
    292328    }
    293329
     
    314350    map->y->coeffMask[1][1] = PS_POLY_MASK_SET;
    315351   
    316     psVectorFitPolynomial2D (map->x, NULL, 0, cornerPn, NULL, cornerPs, cornerQs);
    317     psVectorFitPolynomial2D (map->y, NULL, 0, cornerQn, NULL, cornerPs, cornerQs);
     352    // fit the valid chips, mask the invalid chips
     353    psVectorFitPolynomial2D (map->x, cornerMK, 1, cornerPn, NULL, cornerPs, cornerQs);
     354    psVectorFitPolynomial2D (map->y, cornerMK, 1, cornerQn, NULL, cornerPs, cornerQs);
    318355   
    319356    // apply the linear fit...
     
    328365    psStats *statsQ = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
    329366
    330     psVectorStats (statsP, cornerPd, NULL, NULL, 0);
    331     psVectorStats (statsQ, cornerQd, NULL, NULL, 0);
     367    psVectorStats (statsP, cornerPd, NULL, cornerMK, 1);
     368    psVectorStats (statsQ, cornerQd, NULL, cornerMK, 1);
    332369
    333370    float angle = atan2 (map->y->coeff[1][0], map->x->coeff[1][0]);
     
    353390    psMetadataAddF32 (header, PS_LIST_TAIL, "AST_DS", PS_META_REPLACE, "boresite scatter in DEC (TP units)", statsQ->sampleStdev);
    354391
    355     if (0) {
     392    if (DEBUG) {
    356393        FILE *f = fopen ("corners.dat", "w");
    357394        for (int i = 0; i < cornerRo->n; i++) {
     
    370407    psFree (statsP);
    371408    psFree (statsQ);
     409
     410    psFree (cornerMK);
    372411
    373412    psFree (cornerLn);
Note: See TracChangeset for help on using the changeset viewer.