IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31924


Ignore:
Timestamp:
Jul 22, 2011, 5:04:46 PM (15 years ago)
Author:
eugene
Message:

moving local astrometry to pmSourceOutputs.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c

    r31451 r31924  
    7171        pmSource *source = (pmSource *) sources->data[0];
    7272        if (source->seq == -1) {
    73           // let's write these out in S/N order
    74           sources = psArraySort (sources, pmSourceSortByFlux);
     73            // let's write these out in S/N order
     74            sources = psArraySort (sources, pmSourceSortByFlux);
    7575        } else {
    76           sources = psArraySort (sources, pmSourceSortBySeq);
     76            sources = psArraySort (sources, pmSourceSortBySeq);
    7777        }
    7878    }
     
    9797        // generated on Alloc, and would thus be wrong for read in sources.
    9898        if (source->seq == -1) {
    99           source->seq = i;
     99            source->seq = i;
    100100        }
    101101
     
    600600}
    601601
    602 bool pmSourceLocalAstrometry (psSphere *ptSky, float *posAngle, float *pltScale, pmChip *chip, float xPos, float yPos) {
    603 
    604     pmFPA *fpa = chip->parent;
    605 
    606     if (!chip->toFPA) goto escape;
    607     if (!fpa->toTPA) goto escape;
    608     if (!fpa->toSky) goto escape;
    609 
    610     // generate RA,DEC
    611     psPlane ptCH, ptFP, ptTP_o, ptTP_x, ptTP_y;
    612 
    613     // calculate the astrometry for the coordinate of interest
    614     ptCH.x = xPos;
    615     ptCH.y = yPos;
    616     psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
    617     psPlaneTransformApply (&ptTP_o, fpa->toTPA, &ptFP);
    618     psDeproject (ptSky, &ptTP_o, fpa->toSky);
    619 
    620     // calculate the astrometry for the coordinate + 1pix in X
    621     ptCH.x = xPos + 1.0;
    622     ptCH.y = yPos;
    623     psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
    624     psPlaneTransformApply (&ptTP_x, fpa->toTPA, &ptFP);
    625 
    626     // calculate the astrometry for the coordinate + 1pix in Y
    627     ptCH.x = xPos;
    628     ptCH.y = yPos + 1.0;
    629     psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
    630     psPlaneTransformApply (&ptTP_y, fpa->toTPA, &ptFP);
    631 
    632     // the resulting Tangent Plane coordinates are in TP pixels; convert to local Tangent Plane
    633     // degrees
    634 
    635     float dTPx_dCHx = fpa->toSky->Xs * (ptTP_x.x - ptTP_o.x);
    636     float dTPy_dCHx = fpa->toSky->Ys * (ptTP_x.y - ptTP_o.y);
    637 
    638     float dTPx_dCHy = fpa->toSky->Xs * (ptTP_y.x - ptTP_o.x);
    639     float dTPy_dCHy = fpa->toSky->Ys * (ptTP_y.y - ptTP_o.y);
    640 
    641     float pltScale_x = hypot(dTPx_dCHx, dTPy_dCHx);
    642     float pltScale_y = hypot(dTPx_dCHy, dTPy_dCHy);
    643     *pltScale = 0.5*(pltScale_x + pltScale_y);
    644 
    645     float posAngle_x = atan2 (+dTPy_dCHx, +dTPx_dCHx);
    646     float posAngle_y = atan2 (-dTPy_dCHy, +dTPx_dCHy);
    647     *posAngle = 0.5*(posAngle_x + posAngle_y);
    648 
    649     return true;
    650 
    651 escape:
    652     // no astrometry calibration, give up
    653     ptSky->r = NAN;
    654     ptSky->d = NAN;
    655     *posAngle = NAN;
    656     *pltScale = NAN;
    657 
    658     return false;
    659 }
    660 
    661602bool pmSourcesWrite_CMF_PS1_V1_XRAD(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe)
    662603{
Note: See TracChangeset for help on using the changeset viewer.