IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 1, 2007, 11:03:03 AM (20 years ago)
Author:
eugene
Message:

added various plots, more work on the mosaic astrometry

File:
1 edited

Legend:

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

    r10830 r10864  
    4949    return true;
    5050}
     51
     52bool psastroMosaicSetAstrom_tmp (pmFPA *fpa) {
     53
     54    pmChip *chip = NULL;
     55    pmCell *cell = NULL;
     56    pmReadout *readout = NULL;
     57    pmFPAview *view = pmFPAviewAlloc (0);
     58
     59    FILE *f1 = fopen ("raw.tmp.dat", "w");
     60    FILE *f2 = fopen ("ref.tmp.dat", "w");
     61
     62    // this loop selects the matched stars for all chips
     63    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
     64        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     65        if (!chip->process || !chip->file_exists) { continue; }
     66       
     67        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
     68            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     69            if (!cell->process || !cell->file_exists) { continue; }
     70
     71            // process each of the readouts
     72            // XXX there can only be one readout per chip, right?
     73            while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
     74                if (! readout->data_exists) { continue; }
     75
     76                // select the raw objects for this readout
     77                psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
     78                if (rawstars == NULL) { continue; }
     79
     80                for (int i = 0; i < rawstars->n; i++) {
     81                    pmAstromObj *raw = rawstars->data[i];
     82       
     83                    fprintf (f1, "%f %f  %f %f  %f %f  ", raw->sky->r, raw->sky->d, raw->TP->x, raw->TP->y, raw->FP->x, raw->FP->y);
     84
     85                    psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);
     86                    psPlaneTransformApply (raw->TP, fpa->toTPA, raw->FP);
     87                    psDeproject (raw->sky, raw->TP, fpa->toSky);
     88
     89                    fprintf (f1, "|  %f %f  %f %f  %f %f   %f\n", raw->sky->r, raw->sky->d, raw->TP->x, raw->TP->y, raw->FP->x, raw->FP->y, raw->Mag);
     90                }
     91
     92                psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");
     93                if (refstars == NULL) { continue; }
     94
     95                for (int i = 0; i < refstars->n; i++) {
     96                    pmAstromObj *ref = refstars->data[i];
     97       
     98                    fprintf (f2, "%f %f  %f %f  %f %f  ", ref->sky->r, ref->sky->d, ref->TP->x, ref->TP->y, ref->FP->x, ref->FP->y);
     99
     100                    psProject (ref->TP, ref->sky, fpa->toSky);
     101                    psPlaneTransformApply (ref->FP, fpa->fromTPA, ref->TP);
     102                    psPlaneTransformApply (ref->chip, chip->fromFPA, ref->FP);
     103
     104                    fprintf (f2, "|  %f %f  %f %f  %f %f   %f\n", ref->sky->r, ref->sky->d, ref->TP->x, ref->TP->y, ref->FP->x, ref->FP->y, ref->Mag);
     105                }
     106            }
     107        }
     108    }
     109    fclose (f1);
     110    fclose (f2);
     111    return true;
     112}
Note: See TracChangeset for help on using the changeset viewer.