IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2006, 7:02:16 AM (20 years ago)
Author:
eugene
Message:

substantial updates

File:
1 edited

Legend:

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

    r7154 r7332  
    77    pmReadout *readout = NULL;
    88    pmFPAview *view = pmFPAviewAlloc (0);
     9
     10    FILE *f;
     11    char name[128];
     12
     13    FILE *g1 = fopen ("raw.ps.dat", "w");
     14    FILE *g2 = fopen ("ref.ps.dat", "w");
    915
    1016    // this loop selects the matched stars for all chips
     
    2329
    2430                // select the raw objects for this readout
    25                 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.OBJECTS");
     31                psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
    2632                if (rawstars == NULL) { continue; }
    2733
     
    2935                psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");
    3036                if (refstars == NULL) { continue; }
     37                psTrace (__func__, 4, "Trying %d refstars\n", refstars->n);
    3138
    3239                // use small radius to match stars (assume starting astrometry is good)
    3340                // XXX should this take a (double radius)?
    34                 psArray *matches = pmAstromRadiusMatch (rawstars, refstars, recipe);
     41                psArray *matches = pmAstromRadiusMatchChip (rawstars, refstars, recipe);
     42                psTrace (__func__, 4, "Matched %d refstars\n", matches->n);
     43
     44                sprintf (name, "raw.%02d.dat", view->chip);
     45                f = fopen (name, "w");
     46                for (int i = 0; i < rawstars->n; i++) {
     47                    pmAstromObj *raw = rawstars->data[i];
     48                    fprintf (f, "%f %f  %f %f  %f %f\n", raw->chip->x, raw->chip->y, raw->FP->x, raw->FP->y, raw->sky->r, raw->sky->d);
     49                }
     50                fclose (f);
     51
     52                sprintf (name, "ref.%02d.dat", view->chip);
     53                f = fopen (name, "w");
     54                for (int i = 0; i < refstars->n; i++) {
     55                    pmAstromObj *ref = refstars->data[i];
     56                    fprintf (f, "%f %f  %f %f  %f %f\n", ref->chip->x, ref->chip->y, ref->FP->x, ref->FP->y, ref->sky->r, ref->sky->d);
     57                }
     58                fclose (f);
     59
     60                for (int i = 0; i < matches->n; i++) {
     61                    pmAstromMatch *match = matches->data[i];
     62
     63                    pmAstromObj *raw = rawstars->data[match->raw];
     64                    fprintf (g1, "%d %f %f  %f %f  %f %f  %f %f\n", i,
     65                             DEG_RAD*raw->sky->r, DEG_RAD*raw->sky->d,
     66                             raw->TP->x, raw->TP->y,
     67                             raw->FP->x, raw->FP->y,
     68                             raw->chip->x, raw->chip->y);
     69
     70                    pmAstromObj *ref = refstars->data[match->ref];
     71                    fprintf (g2, "%d %f %f  %f %f  %f %f  %f %f\n", i,
     72                             DEG_RAD*ref->sky->r, DEG_RAD*ref->sky->d,
     73                             ref->TP->x, ref->TP->y,
     74                             ref->FP->x, ref->FP->y,
     75                             ref->chip->x, ref->chip->y);
     76                }
    3577
    3678                // XXX drop the old one
    37                 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.MATCH", PS_DATA_ARRAY, "astrometry matches", matches);
     79                psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.MATCH", PS_DATA_ARRAY | PS_META_REPLACE, "astrometry matches", matches);
    3880            }
    3981        }
    4082    }
     83    fclose (g1);
     84    fclose (g2);
    4185    return true;
    4286}
Note: See TracChangeset for help on using the changeset viewer.