Changeset 8294
- Timestamp:
- Aug 11, 2006, 4:49:24 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libdvo/src/coordops.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/src/coordops.c
r8242 r8294 41 41 42 42 /** extra polynomial terms **/ 43 if (Polynomial) { 44 if (coords[0].Npolyterms > 1) { 45 L += X*X*coords[0].polyterms[0][0] + X*Y*coords[0].polyterms[1][0] + Y*Y*coords[0].polyterms[2][0]; 46 M += X*X*coords[0].polyterms[0][1] + X*Y*coords[0].polyterms[1][1] + Y*Y*coords[0].polyterms[2][1]; 47 } 48 if (coords[0].Npolyterms > 2) { 49 L += X*X*X*coords[0].polyterms[3][0] + X*X*Y*coords[0].polyterms[4][0] + X*Y*Y*coords[0].polyterms[5][0] + Y*Y*Y*coords[0].polyterms[6][0]; 50 M += X*X*X*coords[0].polyterms[3][1] + X*X*Y*coords[0].polyterms[4][1] + X*Y*Y*coords[0].polyterms[5][1] + Y*Y*Y*coords[0].polyterms[6][1]; 51 } 43 if (coords[0].Npolyterms > 1) { 44 L += X*X*coords[0].polyterms[0][0] + X*Y*coords[0].polyterms[1][0] + Y*Y*coords[0].polyterms[2][0]; 45 M += X*X*coords[0].polyterms[0][1] + X*Y*coords[0].polyterms[1][1] + Y*Y*coords[0].polyterms[2][1]; 46 } 47 if (coords[0].Npolyterms > 2) { 48 L += X*X*X*coords[0].polyterms[3][0] + X*X*Y*coords[0].polyterms[4][0] + X*Y*Y*coords[0].polyterms[5][0] + Y*Y*Y*coords[0].polyterms[6][0]; 49 M += X*X*X*coords[0].polyterms[3][1] + X*X*Y*coords[0].polyterms[4][1] + X*Y*Y*coords[0].polyterms[5][1] + Y*Y*Y*coords[0].polyterms[6][1]; 52 50 } 53 51 … … 253 251 254 252 /** extra polynomial terms **/ 255 if ( Polynomial) {253 if (coords[0].Npolyterms > 1) { 256 254 for (i = 0; i < 10; i++) { 257 255 Lo = (X*coords[0].pc1_1 + Y*coords[0].pc1_2); … … 310 308 int GetCoords (Coords *coords, Header *header) { 311 309 312 int status, itmp, Polynomial ;310 int status, itmp, Polynomial, Polyterm; 313 311 double Lambda, rotate, scale; 314 312 double equinox; … … 345 343 } 346 344 345 /* set NPLYTERM based on header. if NPLYTERM is missing, it should have a 346 value of 0, unless the projection type is one of PLY, DIS, WRP, in which 347 case it should be set to 3 */ 347 348 ctype = &coords[0].ctype[4]; 348 349 Polynomial = !strcmp (ctype, "-PLY") || !strcmp (ctype, "-DIS") || !strcmp (ctype, "-WRP"); 349 350 if (Polynomial) { 351 if (gfits_scan (header, "NPLYTERM", "%d", 1, &itmp)) { 352 coords[0].Npolyterms = itmp; 353 } else { 354 coords[0].Npolyterms = 3; 355 } 356 switch (coords[0].Npolyterms) { 357 case 3: 358 status &= gfits_scan (header, "PCA1X3Y0", "%f", 1, &coords[0].polyterms[3][0]); 359 status &= gfits_scan (header, "PCA1X2Y1", "%f", 1, &coords[0].polyterms[4][0]); 360 status &= gfits_scan (header, "PCA1X1Y2", "%f", 1, &coords[0].polyterms[5][0]); 361 status &= gfits_scan (header, "PCA1X0Y3", "%f", 1, &coords[0].polyterms[6][0]); 362 status &= gfits_scan (header, "PCA2X3Y0", "%f", 1, &coords[0].polyterms[3][1]); 363 status &= gfits_scan (header, "PCA2X2Y1", "%f", 1, &coords[0].polyterms[4][1]); 364 status &= gfits_scan (header, "PCA2X1Y2", "%f", 1, &coords[0].polyterms[5][1]); 365 status &= gfits_scan (header, "PCA2X0Y3", "%f", 1, &coords[0].polyterms[6][1]); 366 case 2: 367 status &= gfits_scan (header, "PCA1X2Y0", "%f", 1, &coords[0].polyterms[0][0]); 368 status &= gfits_scan (header, "PCA1X1Y1", "%f", 1, &coords[0].polyterms[1][0]); 369 status &= gfits_scan (header, "PCA1X0Y2", "%f", 1, &coords[0].polyterms[2][0]); 370 status &= gfits_scan (header, "PCA2X2Y0", "%f", 1, &coords[0].polyterms[0][1]); 371 status &= gfits_scan (header, "PCA2X1Y1", "%f", 1, &coords[0].polyterms[1][1]); 372 status &= gfits_scan (header, "PCA2X0Y2", "%f", 1, &coords[0].polyterms[2][1]); 373 case 0: 374 case 1: 375 break; 376 } 350 Polyterm = gfits_scan (header, "NPLYTERM", "%d", 1, &itmp); 351 352 coords[0].Npolyterms = 0; 353 if (Polynomial && !Polyterm) coords[0].Npolyterms = 3; 354 if (Polyterm) coords[0].Npolyterms = itmp; 355 356 switch (coords[0].Npolyterms) { 357 case 3: 358 status &= gfits_scan (header, "PCA1X3Y0", "%f", 1, &coords[0].polyterms[3][0]); 359 status &= gfits_scan (header, "PCA1X2Y1", "%f", 1, &coords[0].polyterms[4][0]); 360 status &= gfits_scan (header, "PCA1X1Y2", "%f", 1, &coords[0].polyterms[5][0]); 361 status &= gfits_scan (header, "PCA1X0Y3", "%f", 1, &coords[0].polyterms[6][0]); 362 status &= gfits_scan (header, "PCA2X3Y0", "%f", 1, &coords[0].polyterms[3][1]); 363 status &= gfits_scan (header, "PCA2X2Y1", "%f", 1, &coords[0].polyterms[4][1]); 364 status &= gfits_scan (header, "PCA2X1Y2", "%f", 1, &coords[0].polyterms[5][1]); 365 status &= gfits_scan (header, "PCA2X0Y3", "%f", 1, &coords[0].polyterms[6][1]); 366 case 2: 367 status &= gfits_scan (header, "PCA1X2Y0", "%f", 1, &coords[0].polyterms[0][0]); 368 status &= gfits_scan (header, "PCA1X1Y1", "%f", 1, &coords[0].polyterms[1][0]); 369 status &= gfits_scan (header, "PCA1X0Y2", "%f", 1, &coords[0].polyterms[2][0]); 370 status &= gfits_scan (header, "PCA2X2Y0", "%f", 1, &coords[0].polyterms[0][1]); 371 status &= gfits_scan (header, "PCA2X1Y1", "%f", 1, &coords[0].polyterms[1][1]); 372 status &= gfits_scan (header, "PCA2X0Y2", "%f", 1, &coords[0].polyterms[2][1]); 373 case 0: 374 case 1: 375 break; 377 376 } 378 377 } else { … … 574 573 575 574 # endif 575 576 /* 577 578 Projections and Transformations 579 580 The Coords structure is used to represent the standard FITS header representations of the WCS terms. 581 The FITS WCS encapsulates several concepts in one system: coordinate frame, projection, and 582 transformations. The ctype variable defines both the frame (ie, RA/DEC, GLON/GLAT, etc) and the 583 projection (ie, AIT, SIN, TAN, etc). The associated terms (PC00i00j) define transformations from 584 the projection system to another linear coordinate system. I have extended the basic WCS 585 transformation terms to include higher-order polynomial terms. The presence of higher-order terms 586 is indicated in the header by the NPLYTERM keyword, with a value greater than 1 (a value of 0 or 1 587 implies no higher-order coefficients). The coefficients have keywords of the form PCAnXiYj where 588 'n' is the axis corresponding to the dependent variable, 'i' is the order of the X component and 'j' 589 is the order of the Y component. A value of 2 indicates that the second-order coefficients are 590 defined (PCAnX2Y0, PCAnX1Y1, PCAnX0Y2); A value of 3 indicates that the third-order coefficients are 591 also defined (PCAnX3Y0, PCAnX2Y1, PCAnX1Y2, PCAnX0Y3). Some headers in the past were generated 592 without the NPLYTERM keyword. a value of PLY, DIS, or WRP for the projection without a 593 corresponding value for NPLYTERM implies that the value should be interpreted as '3'. 594 595 */
Note:
See TracChangeset
for help on using the changeset viewer.
