IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 22, 2006, 9:53:37 AM (20 years ago)
Author:
eugene
Message:

working towards integration with ppImage

File:
1 edited

Legend:

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

    r5575 r6176  
    3232}
    3333
    34 // measure per-chip astrometry terms
    35 bool psastroChipAstrom (pmFPA *fpa, psMetadata *config) {
    36 
    37     bool status;
    38     psArray *match;
    39     pmAstromStats stats;
     34bool psastroNormFPA (pmFPA *fpa, psMetadata *config) {
    4035
    4136    // save the raw astrometry for later reference
     
    4540    for (int i = 0; i < fpa->chips->n; i++) {
    4641        pmChip *chip = fpa->chips->data[i];
    47 
    48         // cells->n > 1 is not yet well-defined
    49         if (chip->cells->n > 1) {
    50             psLogMsg ("pmSourcesReadCMP", 3, "undefined behavior for nCells > 1");
    51             return false;
    52         }
    53 
    54         for (int j = 0; j < chip->cells->n; j++) {
    55             pmCell *cell = chip->cells->data[j];
    56 
    57             // readouts->n > 1 is not yet well-defined
    58             if (cell->readouts->n > 1) {
    59                 psLogMsg ("pmSourcesReadCMP", 3, "undefined behavior for nReadouts > 1");
    60                 return false;
    61             }
    62 
    63             // load the corresponding reference data (DVO command)
    64             psArray *refstars = psastroLoadReference (cell->header, config);
    65 
    66             for (int k = 0; k < cell->readouts->n; k++) {
    67 
    68                 pmReadout *readout = cell->readouts->data[k];
    69 
    70                 // pull out the SUBSET rawstars (a view)
    71                 psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "STARS.SUBSET");
    72 
    73                 // project the rawstars to the current best guess astrometry
    74                 psastroProjectRawstars (rawstars, readout);
    75 
    76                 // use the header & config info to project refstars onto the focal plane
    77                 psastroProjectRefstars (refstars, readout);
    78 
    79                 // testWriteRaw ("ref.inp", refstars);
    80                 // testWriteRaw ("raw.inp", rawstars);
    81 
    82                 // fprintf (stderr, "rawstars:\n");
    83                 // psastroDumpStars (rawstars);
    84                 // fprintf (stderr, "refstars:\n");
    85                 // psastroDumpStars (refstars);
    86 
    87                 // find initial offset / rotation
    88                 stats = pmAstromGridMatch (rawstars, refstars, config);
    89 
    90                 // adjust the chip.toFPA terms only
    91                 pmAstromGridApply (chip->toFPA, stats);
    92                 chip->fromFPA = p_psPlaneTransformLinearInvert (chip->toFPA);
    93 
    94                 // use fit result to re-project rawstars
    95                 psastroProjectRawstars (rawstars, readout);
    96                 psastroProjectRefstars (refstars, readout);
    97 
    98                 // testWriteRaw ("ref.dat", refstars);
    99                 // testWriteRaw ("raw.dat", rawstars);
    100    
    101                 // use small radius to match stars
    102                 match = pmAstromRadiusMatch (rawstars, refstars, config);
    103 
    104                 // improved fit for astrometric terms
    105                 pmAstromMatchFit (chip->toFPA, rawstars, refstars, match, config);
    106                 chip->fromFPA = p_psPlaneTransformLinearInvert (chip->toFPA);
    107             }
    108             pmAstromWriteWCS (chip->toFPA, fpa->toSky, cell->header);
    109         }
     42        psastroChipAstrom (chip, config);
    11043    }
    11144
Note: See TracChangeset for help on using the changeset viewer.