Changeset 41827 for branches/eam_branches/ipp-dev-20210817
- Timestamp:
- Oct 1, 2021, 9:50:51 AM (5 years ago)
- Location:
- branches/eam_branches/ipp-dev-20210817/ppViz/src/ppCoord
- Files:
-
- 2 edited
-
ppCoordArguments.c (modified) (2 diffs)
-
ppCoordLoop.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/ppViz/src/ppCoord/ppCoordArguments.c
r27979 r41827 58 58 psMetadataAddF32(arguments, PS_LIST_TAIL, "-ds9-radius", 0, "ds9 region radii", 5.0); 59 59 psMetadataAddStr(arguments, PS_LIST_TAIL, "-ds9-color", 0, "ds9 region color", "red"); 60 psMetadataAddS32(arguments, PS_LIST_TAIL, "-extra-orders", 0, "extra orders for transform inversion", -1); 60 61 if (!psArgumentParse(arguments, &argc, argv) || argc != 1) { 61 62 usage(argv[0], arguments, data); … … 84 85 data->ds9color = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-ds9-color")); 85 86 87 int ExtraOrders = psMetadataLookupS32(NULL, arguments, "-extra-orders"); 88 if (ExtraOrders >= 0) { pmAstrometrySetExtraOrders(ExtraOrders); } 89 86 90 psTrace("ppCoord", 1, "Done reading command-line arguments\n"); 87 91 psFree(arguments); -
branches/eam_branches/ipp-dev-20210817/ppViz/src/ppCoord/ppCoordLoop.c
r32600 r41827 9 9 #include "ppCoord.h" 10 10 11 typedef struct { 12 psPlane pix; 13 psPlane fp; 14 psPlane tp; 15 psSphere sky; 16 } ppCoordSet; 17 11 18 // Convert sky coordinates to chip coordinates 12 static void coordSky2Chip(float *x, float *y, // Chip coordinates (output) 13 double ra, double dec, // Sky coordinates 19 static void coordSky2Chip(ppCoordSet *src, // Sky coordinates 14 20 bool radians, // Coordinates are in radians? 15 21 const pmFPA *astromFPA, // Astrometry FPA … … 17 23 ) 18 24 { 19 psPlane pix; // Pixel coordinates on chip 20 psPlane fp; // Focal plane coordinates 21 psPlane tp; // Tangent plane coordinates 22 psSphere sky; // Sky coordinates 23 24 sky.r = ra; 25 sky.d = dec; 26 25 // convert from src->sky to src->pix 27 26 if (!radians) { 28 sky.r *= M_PI / 180.0; 29 sky.d *= M_PI / 180.0; 30 } 31 32 psProject(&tp, &sky, astromFPA->toSky); 33 psTrace("ppCoord",2,"sky2pix tr1: %f %f\n",tp.x,tp.y); 34 psPlaneTransformApply(&fp, astromFPA->fromTPA, &tp); 35 psTrace("ppCoord",2,"sky2pix tr2: %f %f\n",fp.x,fp.y); 36 psPlaneTransformApply(&pix, astromChip->fromFPA, &fp); 37 psTrace("ppCoord",2,"sky2pix tr3: %f %f\n",pix.x,pix.y); 38 39 *x = pix.x; 40 *y = pix.y; 27 src->sky.r *= M_PI / 180.0; 28 src->sky.d *= M_PI / 180.0; 29 } 30 31 psProject(&src->tp, &src->sky, astromFPA->toSky); 32 psTrace("ppCoord",2,"sky2pix tr1: %f %f\n", src->tp.x, src->tp.y); 33 psPlaneTransformApply(&src->fp, astromFPA->fromTPA, &src->tp); 34 psTrace("ppCoord",2,"sky2pix tr2: %f %f\n", src->fp.x, src->fp.y); 35 psPlaneTransformApply(&src->pix, astromChip->fromFPA, &src->fp); 36 psTrace("ppCoord",2,"sky2pix tr3: %f %f\n", src->pix.x, src->pix.y); 41 37 42 38 return; … … 100 96 psVector *ra = radec->data[0]; // RA coordinates 101 97 long num = ra->n; // Number of coordinates 102 radecOut = psArrayAlloc( 4);98 radecOut = psArrayAlloc(8); 103 99 radecOut->data[0] = psArrayAlloc(num); 104 100 radecOut->data[1] = psVectorAlloc(num, PS_TYPE_F32); 105 101 radecOut->data[2] = psVectorAlloc(num, PS_TYPE_F32); 106 102 radecOut->data[3] = psArrayAlloc(num); 103 radecOut->data[4] = psVectorAlloc(num, PS_TYPE_F32); // FP x 104 radecOut->data[5] = psVectorAlloc(num, PS_TYPE_F32); // FP y 105 radecOut->data[6] = psVectorAlloc(num, PS_TYPE_F32); // TP x 106 radecOut->data[7] = psVectorAlloc(num, PS_TYPE_F32); // TP y 107 107 psVectorInit(radecOut->data[1], NAN); 108 108 psVectorInit(radecOut->data[2], NAN); … … 274 274 } 275 275 276 fprintf(stdout, "%s % .3f %.3f --> %.10lf %.10lf\n", chipName, pix->x, pix->y, sky->r, sky->d);276 fprintf(stdout, "%s %10.3f %10.3f --> %14.10lf %14.10lf : %11.4f %11.4f : %11.4f %11.4f\n", chipName, pix->x, pix->y, sky->r, sky->d, tp->x, tp->y, fp->x, fp->y); 277 277 } 278 278 psFree(pix); … … 358 358 psVector *yPix = radecOut->data[2]; // y coordinate for pixels 359 359 psArray *cellPix = radecOut->data[3]; // Cell for pixels 360 psVector *xFP = radecOut->data[4]; // x coordinate for FP 361 psVector *yFP = radecOut->data[5]; // y coordinate for FP 362 psVector *xTP = radecOut->data[6]; // x coordinate for TP 363 psVector *yTP = radecOut->data[7]; // y coordinate for TP 360 364 361 365 for (long i = 0; i < num; i++) { 362 float x, y; // Pixel coordinates 363 coordSky2Chip(&x, &y, ra->data.F64[i], dec->data.F64[i], 364 data->radians, astromFile->fpa, chip); 365 if ((x < 0 || x > numCols || y < 0 || y > numRows)) { 366 ppCoordSet src; 367 src.sky.r = ra->data.F64[i]; 368 src.sky.d = dec->data.F64[i]; 369 coordSky2Chip(&src, data->radians, astromFile->fpa, chip); 370 if ((src.pix.x < 0 || src.pix.x > numCols || src.pix.y < 0 || src.pix.y > numRows)) { 366 371 // Not on this chip 367 372 continue; … … 369 374 370 375 if (rawChip) { 376 float x, y; 371 377 psString cellName = NULL; // Name of cell 372 coordChip2Cell(&cellName, &x, &y, x,y, cellNames, cellBounds,378 coordChip2Cell(&cellName, &x, &y, src.pix.x, src.pix.y, cellNames, cellBounds, 373 379 cellX0, cellY0, cellParityX, cellParityY, cellBinX, cellBinY); 374 380 cellPix->data[i] = cellName; 375 } 376 381 xPix->data.F32[i] = x; 382 yPix->data.F32[i] = y; 383 } else { 384 xPix->data.F32[i] = src.pix.x; 385 yPix->data.F32[i] = src.pix.y; 386 } 377 387 chipPix->data[i] = psStringCopy(chipName); 378 xPix->data.F32[i] = x; 379 yPix->data.F32[i] = y; 388 xFP->data.F32[i] = src.fp.x; 389 yFP->data.F32[i] = src.fp.y; 390 xTP->data.F32[i] = src.tp.x; 391 yTP->data.F32[i] = src.tp.y; 380 392 } 381 393 } … … 406 418 for (long i = 0; i < xPix1->n; i++) { 407 419 float x1, y1; // Coordinates of point 1 408 coordSky2Chip(&x1, &y1, ra1->data.F64[i], dec1->data.F64[i], 409 true, astromFile->fpa, chip); 420 ppCoordSet src; 421 src.sky.r = ra1->data.F64[i]; 422 src.sky.d = dec1->data.F64[i]; 423 coordSky2Chip(&src, true, astromFile->fpa, chip); 424 x1 = src.pix.x; 425 y1 = src.pix.y; 410 426 if ((x1 >= 0 && x1 < numCols && y1 >= 0 && y1 < numRows)) { 411 427 if (rawChip) { … … 421 437 422 438 float x2, y2; // Coordinates of point 2 423 coordSky2Chip(&x2, &y2, ra2->data.F64[i], dec2->data.F64[i], 424 true, astromFile->fpa, chip); 439 src.sky.r = ra2->data.F64[i]; 440 src.sky.d = dec2->data.F64[i]; 441 coordSky2Chip(&src, true, astromFile->fpa, chip); 442 x2 = src.pix.x; 443 y2 = src.pix.y; 425 444 if ((x2 >= 0 && x2 < numCols && y2 >= 0 && y2 < numRows)) { 426 445 if (rawChip) { … … 455 474 for (long i = 0; i < num; i++) { 456 475 float x, y; // Pixel coordinates 457 coordSky2Chip(&x, &y, ra->data.F64[i], dec->data.F64[i], 458 false, astromFile->fpa, chip); 476 ppCoordSet src; 477 src.sky.r = ra->data.F64[i]; 478 src.sky.d = dec->data.F64[i]; 479 coordSky2Chip(&src, false, astromFile->fpa, chip); 480 x = src.pix.x; 481 y = src.pix.y; 459 482 if ((x < 0 || x > numCols || y < 0 || y > numRows)) { 460 483 // Not on this chip … … 503 526 psVector *ra = radec->data[0]; // RA coordinate 504 527 psVector *dec = radec->data[1]; // Dec coordinate 528 psVector *xFP = radecOut->data[4]; // x coordinate for FP 529 psVector *yFP = radecOut->data[5]; // y coordinate for FP 530 psVector *xTP = radecOut->data[6]; // x coordinate for TP 531 psVector *yTP = radecOut->data[7]; // y coordinate for TP 505 532 506 533 for (long i = 0; i < chipPix->n; i++) { … … 516 543 xPix->data.F32[i], yPix->data.F32[i], data->ds9radius, data->ds9color); 517 544 } else { 518 fprintf(stdout, "% .10lf %.10lf --> %.3f %.3f %s%s%s\n",545 fprintf(stdout, "%14.10lf %14.10lf --> %10.3f %10.3f %s%s%s : %11.4f %11.4f : %11.4f %11.4f\n", 519 546 ra->data.F64[i], dec->data.F64[i], xPix->data.F32[i], yPix->data.F32[i], 520 547 chipName ? chipName : "UNKNOWN", 521 548 rawFile ? " " : "", 522 rawFile && cellName ? cellName : (rawFile ? "UNKNOWN" : "")); 549 rawFile && cellName ? cellName : (rawFile ? "UNKNOWN" : ""), 550 xFP->data.F32[i], yFP->data.F32[i], xTP->data.F32[i], yTP->data.F32[i] ); 523 551 } 524 552 }
Note:
See TracChangeset
for help on using the changeset viewer.
