IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16068


Ignore:
Timestamp:
Jan 14, 2008, 4:48:58 PM (18 years ago)
Author:
eugene
Message:

allow the toTPA to be non-identity (but linear)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmAstrometryWCS.c

    r15939 r16068  
    77 *  @author EAM, IfA
    88 *
    9  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-12-28 04:37:34 $
     9 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-01-15 02:48:58 $
    1111 *
    1212 *  Copyright 2006 Institute for Astronomy, University of Hawaii
     
    182182    psProject (FP, sky, wcs->toSky); // find the RA,DEC coord of the focal-plane coordinate
    183183
    184     // I need the inverse of wcs->transform at this point
     184    // XXX I actually need the inverse of wcs->transform at this point
    185185    psPlaneTransformApply (Chip, wcs->trans, FP);
    186186
     
    427427        double rY = toSky->Ys / fpa->toSky->Ys;
    428428
    429         for (int i = 0; i <= fpa->toTPA->x->nX; i++) {
    430             for (int j = 0; j <= fpa->toTPA->x->nY; j++) {
     429        for (int i = 0; i <= toFPA->x->nX; i++) {
     430            for (int j = 0; j <= toFPA->x->nY; j++) {
    431431                toFPA->x->coeff[i][j] *= rX;
    432432                toFPA->y->coeff[i][j] *= rY;
    433433            }
    434434        }
     435
     436        // apply the exiting fromTPA transformation to make the new toFPA consistent with the toTPA layter
     437        // XXX this only works if toTPA is at most a linear transformation
     438        psPlaneTransform *toFPAnew = psPlaneTransformAlloc(toFPA->x->nX, toFPA->x->nY);
     439        for (int i = 0; i <= toFPA->x->nX; i++) {
     440          for (int j = 0; j <= toFPA->x->nY; j++) {
     441            double f1 = toFPA->x->coeffMask[i][j] ? 0.0 : fpa->fromTPA->x->coeff[1][0]*toFPA->x->coeff[i][j];
     442            double f2 = toFPA->y->coeffMask[i][j] ? 0.0 : fpa->fromTPA->x->coeff[0][1]*toFPA->y->coeff[i][j];
     443            toFPAnew->x->coeff[i][j] = f1 + f2;
     444
     445            double g1 = toFPA->x->coeffMask[i][j] ? 0.0 : fpa->fromTPA->y->coeff[1][0]*toFPA->x->coeff[i][j];
     446            double g2 = toFPA->y->coeffMask[i][j] ? 0.0 : fpa->fromTPA->y->coeff[0][1]*toFPA->y->coeff[i][j];
     447            toFPAnew->y->coeff[i][j] = g1 + g2;
     448          }
     449        }
     450        toFPAnew->x->coeff[0][0] += fpa->fromTPA->x->coeff[0][0];
     451        toFPAnew->y->coeff[0][0] += fpa->fromTPA->y->coeff[0][0];
     452
     453        psFree (toFPA);
     454        toFPA = toFPAnew;
    435455
    436456        // adjust reference pixel for new toSky reference coordinate
Note: See TracChangeset for help on using the changeset viewer.