Changeset 10775 for trunk/psModules/src/astrom/pmAstrometryWCS.c
- Timestamp:
- Dec 15, 2006, 7:34:54 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/astrom/pmAstrometryWCS.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometryWCS.c
r10712 r10775 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-12-1 4 06:26:15$9 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-12-16 05:34:54 $ 11 11 * 12 12 * Copyright 2006 Institute for Astronomy, University of Hawaii … … 190 190 wcs->trans->x->coeff[0][1] = -wcs->cdelt2 * sin(rotate*PM_RAD_DEG); // == PC1_2 191 191 wcs->trans->y->coeff[1][0] = +wcs->cdelt1 * sin(rotate*PM_RAD_DEG); // == PC2_1 192 wcs->trans->y->coeff[ 1][0] = +wcs->cdelt2 * cos(rotate*PM_RAD_DEG); // == PC2_2192 wcs->trans->y->coeff[0][1] = +wcs->cdelt2 * cos(rotate*PM_RAD_DEG); // == PC2_2 193 193 return wcs; 194 194 } … … 207 207 if (i + j < 2) 208 208 continue; 209 if (i + j > fitOrder) 209 if (i + j > fitOrder) { 210 wcs->trans->x->mask[i][j] = 1; 211 wcs->trans->y->mask[i][j] = 1; 210 212 continue; 213 } 211 214 sprintf (name, "PCA1X%1dY%1d", i, j); 212 215 wcs->trans->x->coeff[i][j] = pow(wcs->cdelt1, i) * pow(wcs->cdelt2, j) * psMetadataLookupF32 (&status, header, name); … … 487 490 { 488 491 // techinically, we can have a plate scale here (fpa->toTPA:dx,dy != 1) 489 if (!psPlaneDistortIs Identity(fpa->toTPA))492 if (!psPlaneDistortIsDiagonal (fpa->toTPA)) 490 493 psAbort ("psastro", "invalid TPA transformation"); 491 494 … … 505 508 // crpix1,2 = X,Y(crval1,2) 506 509 // start with linear solution for Xo,Yo: 507 double R = (chip->toFPA->x->coeff[1][0]*chip->toFPA-> x->coeff[0][1] - chip->toFPA->x->coeff[0][1]*chip->toFPA->x->coeff[1][0]);508 double Xo = (chip->toFPA-> x->coeff[0][0]*chip->toFPA->x->coeff[0][1] - chip->toFPA->x->coeff[0][0]*chip->toFPA->x->coeff[0][1])/R;509 double Yo = (chip->toFPA->x->coeff[0][0]*chip->toFPA-> x->coeff[1][0] - chip->toFPA->x->coeff[0][0]*chip->toFPA->x->coeff[1][0])/R;510 double R = (chip->toFPA->x->coeff[1][0]*chip->toFPA->y->coeff[0][1] - chip->toFPA->x->coeff[0][1]*chip->toFPA->y->coeff[0][1]); 511 double Xo = (chip->toFPA->y->coeff[0][0]*chip->toFPA->x->coeff[0][1] - chip->toFPA->x->coeff[0][0]*chip->toFPA->y->coeff[0][1])/R; 512 double Yo = (chip->toFPA->x->coeff[0][0]*chip->toFPA->y->coeff[1][0] - chip->toFPA->y->coeff[0][0]*chip->toFPA->x->coeff[1][0])/R; 510 513 511 514 // iterate to actual solution: requires small non-linear terms … … 582 585 double cdelt1 = fpa->toTPA->x->coeff[1][0][0][0]*fpa->toSky->Xs*PM_DEG_RAD; 583 586 double cdelt2 = fpa->toTPA->y->coeff[0][1][0][0]*fpa->toSky->Ys*PM_DEG_RAD; 587 wcs->cdelt1 = cdelt1; 588 wcs->cdelt2 = cdelt2; 584 589 585 590 // convert wcs->trans to a matrix which yields L,M in pixels … … 741 746 } 742 747 743 // check that the given psPlaneDistort is the identity 744 bool psPlaneDistortIs Identity(psPlaneDistort *distort)748 // check that the given psPlaneDistort is the identity * (Xs,Ys) 749 bool psPlaneDistortIsDiagonal (psPlaneDistort *distort) 745 750 { 746 751 … … 787 792 if (i + j > order) { 788 793 // high-order cross terms must be masked (eg, x^3 y^2) 794 status &= distort->x->mask[i][j][0][0]; 795 } else { 789 796 status &= !distort->x->mask[i][j][0][0]; 790 } else { 791 if (i + j != 1) { 797 if ((i == 1) && (i + j == 1)) { 798 // linear, diagonal terms must be 1.0 799 status &= (fabs(distort->x->coeff[i][j][0][0]) > FLT_EPSILON); 800 } else { 792 801 // non-linear and off-diagonal terms must be 0 (eg, x^2, x y) 793 status &= (distort->x->coeff[i][j][0][0] == 0.0); 794 } else { 795 // linear, diagonal terms must be 1.0 796 status &= (distort->x->coeff[i][j][0][0] == 1.0); 802 status &= (fabs(distort->x->coeff[i][j][0][0]) < FLT_EPSILON); 797 803 } 798 804 } … … 805 811 if (i + j > order) { 806 812 // high-order cross terms must be masked (eg, x^3 y^2) 813 status &= distort->y->mask[i][j][0][0]; 814 } else { 807 815 status &= !distort->y->mask[i][j][0][0]; 808 } else { 809 if (i + j != 1) { 816 if ((j == 1) && (i + j == 1)) { 817 // linear, diagonal terms must be 1.0 818 status &= (fabs(distort->y->coeff[i][j][0][0]) > FLT_EPSILON); 819 } else { 810 820 // non-linear and off-diagonal terms must be 0 (eg, x^2, x y) 811 status &= (distort->y->coeff[i][j][0][0] == 0.0); 812 } else { 813 // linear, diagonal terms must be 1.0 814 status &= (distort->y->coeff[i][j][0][0] == 1.0); 821 status &= (fabs(distort->y->coeff[i][j][0][0]) < FLT_EPSILON); 815 822 } 816 823 }
Note:
See TracChangeset
for help on using the changeset viewer.
