Changeset 2097
- Timestamp:
- Oct 13, 2004, 2:06:17 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astronomy/psAstrometry.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psAstrometry.c
r2077 r2097 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-1 3 19:40:42$10 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-14 00:06:17 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 504 504 const psFPA* FPA) 505 505 { 506 //printf("Entering psCellInFPA()\n"); 506 507 psChip* tmpChip = NULL; 507 psPlane * chipCoord = NULL;508 psPlane chipCoord; 508 509 psCell* outCell = NULL; 509 510 510 if (fpaCoord == NULL) { 511 psAbort(__func__, "input parameter fpaCoord is NULL."); 512 } 513 if (FPA == NULL) { 514 psAbort(__func__, "input parameter FPA is NULL."); 515 } 511 PS_CHECK_NULL_PTR_RETURN_NULL(fpaCoord); 512 PS_CHECK_NULL_PTR_RETURN_NULL(FPA); 516 513 517 514 // Determine which chip contains the fpaCoords. 518 515 tmpChip = psChipInFPA(fpaCoord, FPA); 516 if (tmpChip == NULL) { 517 return(NULL); 518 } 519 519 520 520 // Convert to those chip coordinates. 521 chipCoord = psCoordFPAToChip(chipCoord, fpaCoord, tmpChip);521 psCoordFPAToChip(&chipCoord, fpaCoord, tmpChip); 522 522 523 523 // Determine which cell contains those chip coordinates. 524 outCell = psCellInChip(chipCoord, tmpChip); 525 526 psFree(tmpChip); 527 psFree(chipCoord); 528 524 outCell = psCellInChip(&chipCoord, tmpChip); 525 526 //printf("Exiting psCellInFPA()\n"); 529 527 return (outCell); 530 528 } … … 533 531 const psFPA* FPA) 534 532 { 533 //printf("Entering psChipInFPA()\n"); 534 PS_CHECK_NULL_PTR_RETURN_NULL(fpaCoord); 535 PS_CHECK_NULL_PTR_RETURN_NULL(FPA); 536 PS_CHECK_NULL_PTR_RETURN_NULL(FPA->chips); 535 537 psArray* chips = FPA->chips; 536 538 int nChips = chips->n; 537 psPlane * chipCoord = NULL;539 psPlane chipCoord; 538 540 psCell *tmpCell = NULL; 539 540 if (fpaCoord == NULL) {541 psAbort(__func__, "input parameter fpaCoord is NULL.");542 }543 if (FPA == NULL) {544 psAbort(__func__, "input parameter FPA is NULL.");545 }546 541 547 542 // Loop through every chip in this FPA. Convert the original … … 550 545 // coordinates. 551 546 for (int i = 0; i < nChips; i++) { 547 //printf("HERE 01 (checking chip %d)\n", i); 552 548 psChip* tmpChip = chips->data[i]; 553 chipCoord = psPlaneTransformApply(chipCoord, tmpChip->fromFPA, 554 fpaCoord); 555 556 tmpCell = psCellInChip(chipCoord, tmpChip); 549 psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord); 550 551 tmpCell = psCellInChip(&chipCoord, tmpChip); 557 552 if (tmpCell != NULL) { 558 psFree(chipCoord);553 //printf("Exiting psChipInFPA()\n"); 559 554 return(tmpChip); 560 555 } 561 psFree(chipCoord);562 } 563 556 } 557 558 //printf("Exiting psChipInFPA()\n"); 564 559 return (NULL); 565 560 } … … 568 563 const psChip* chip) 569 564 { 570 psPlane* cellCoord = NULL; 565 //printf("Entering psCellInChip(%f, %f, %d)\n", chipCoord->x, chipCoord->y, chip); 566 PS_CHECK_NULL_PTR_RETURN_NULL(chipCoord); 567 PS_CHECK_NULL_PTR_RETURN_NULL(chip); 568 569 psPlane cellCoord; 571 570 psArray* cells; 572 573 // We return NULL if either of the input parameters is NULL.574 if (chipCoord == NULL) {575 psAbort(__func__, "the 'chipCoord' parameter is NULL\n");576 }577 if (chip == NULL) {578 psAbort(__func__, "the 'chip' parameter is NULL\n");579 }580 571 581 572 cells = chip->cells; 582 573 if (cells == NULL) { 574 //printf("Exiting psCellInChip()\n"); 583 575 return NULL; 584 576 } … … 587 579 // a cellCoord for that cell and determine if that cellCoord is valid. 588 580 // If so, then we return that cell. 581 589 582 for (int i = 0; i < cells->n; i++) { 590 583 psCell* tmpCell = (psCell* ) cells->data[i]; … … 595 588 psReadout* tmpReadout = readouts->data[j]; 596 589 597 cellCoord = psPlaneTransformApply(cellCoord,598 tmpCell->fromChip,599 chipCoord);600 601 if (checkValidImageCoords(cellCoord ->x,602 cellCoord ->y,590 psPlaneTransformApply(&cellCoord, 591 tmpCell->fromChip, 592 chipCoord); 593 594 if (checkValidImageCoords(cellCoord.x, 595 cellCoord.y, 603 596 tmpReadout->image)) { 604 psFree(cellCoord);597 //printf("Exiting psCellInChip()\n"); 605 598 return (tmpCell); 606 599 } … … 609 602 } 610 603 611 psFree(cellCoord);604 //printf("Exiting psCellInChip()\n"); 612 605 return (NULL); 613 606 }
Note:
See TracChangeset
for help on using the changeset viewer.
