IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 2, 2007, 3:26:52 PM (20 years ago)
Author:
eugene
Message:

fixed mosaic analysis; cleaned up test code (some in traces, some removed), general output cleanups

File:
1 edited

Legend:

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

    r10864 r10880  
    5858    return true;
    5959}
     60
     61bool psastroDumpMatches (pmFPA *fpa, char *filename) {
     62
     63    pmChip *chip = NULL;
     64    pmCell *cell = NULL;
     65    pmReadout *readout = NULL;
     66    pmFPAview *view = pmFPAviewAlloc (0);
     67
     68    FILE *f = fopen (filename, "w");
     69
     70    // this loop selects the matched stars for all chips
     71    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
     72        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     73        if (!chip->process || !chip->file_exists) continue;
     74       
     75        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
     76            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     77            if (!cell->process || !cell->file_exists) continue;
     78
     79            // process each of the readouts
     80            // XXX there can only be one readout per chip, right?
     81            while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
     82                if (! readout->data_exists) continue;
     83
     84                // select the raw objects for this readout
     85                psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
     86                if (rawstars == NULL) continue;
     87
     88                // select the raw objects for this readout
     89                psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");
     90                if (refstars == NULL) continue;
     91                psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n);
     92
     93                psArray *matches = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.MATCH");
     94                if (matches == NULL) continue;
     95
     96                for (int i = 0; i < matches->n; i++) {
     97                    pmAstromMatch *match = matches->data[i];
     98
     99                    pmAstromObj *raw = rawstars->data[match->raw];
     100                    fprintf (f, "%f %f  %f %f  %f %f  %f %f  %f   |   ", 
     101                             DEG_RAD*raw->sky->r, DEG_RAD*raw->sky->d,
     102                             raw->TP->x, raw->TP->y,
     103                             raw->FP->x, raw->FP->y,
     104                             raw->chip->x, raw->chip->y, raw->Mag);
     105
     106                    pmAstromObj *ref = refstars->data[match->ref];
     107                    fprintf (f, "%f %f  %f %f  %f %f  %f %f  %f\n",
     108                             DEG_RAD*ref->sky->r, DEG_RAD*ref->sky->d,
     109                             ref->TP->x, ref->TP->y,
     110                             ref->FP->x, ref->FP->y,
     111                             ref->chip->x, ref->chip->y, ref->Mag);
     112                }
     113            }
     114        }
     115    }
     116    fclose (f);
     117    psFree (view);
     118    return true;
     119}
Note: See TracChangeset for help on using the changeset viewer.