Changeset 5739
- Timestamp:
- Dec 7, 2005, 2:00:57 PM (20 years ago)
- Location:
- trunk/psModules
- Files:
-
- 3 edited
-
src/astrom/pmAstrometry.c (modified) (2 diffs)
-
src/astrom/pmAstrometry.h (modified) (2 diffs)
-
test/astrom/tst_pmAstrometry01.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometry.c
r5681 r5739 13 13 * XXX: Should we implement non-linear cell->chip transforms? 14 14 * 15 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2005-12-0 5 21:28:55$15 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-12-08 00:00:57 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 799 799 return(cellCoord); 800 800 } 801 802 /***************************************************************************** 803 *****************************************************************************/ 804 bool pmFPASelectChip( 805 pmFPA *fpa, 806 int chipNum) 807 { 808 PS_ASSERT_PTR_NON_NULL(fpa, false); 809 if ((fpa->chips == NULL) || (chipNum >= fpa->chips->n)) { 810 return(false); 811 } 812 psBool rc = true; 813 814 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 815 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 816 if (tmpChip == NULL) { 817 rc = false; 818 } else { 819 if (i == chipNum) { 820 tmpChip->valid = true; 821 } else { 822 tmpChip->valid = false; 823 } 824 } 825 } 826 827 return(rc); 828 } 829 830 831 /***************************************************************************** 832 XXX: The SDRS is ambiguous on a few things: 833 Whether or not the other chips should be set valid=true. 834 Should we return the number of chip valid=true before or after they're set, 835 *****************************************************************************/ 836 /** 837 * 838 * pmFPAExcludeChip shall set valid to false only for the specified chip 839 * number (chipNum). In the event that the specified chip number does not exist 840 * within the fpa, the function shall generate a warning, and perform no action. 841 * The function shall return the number of chips within the fpa that have valid 842 * set to true. 843 * 844 */ 845 int pmFPAExcludeChip( 846 pmFPA *fpa, 847 int chipNum) 848 { 849 PS_ASSERT_PTR_NON_NULL(fpa, false); 850 851 if (fpa->chips == NULL) { 852 psLogMsg(__func__, PS_LOG_WARN, "WARNING: fpa->chips == NULL\n"); 853 return(0); 854 } 855 if ((chipNum >= fpa->chips->n) || (NULL == (pmChip *) fpa->chips->data[chipNum])) { 856 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the specified chip (%d) does not exist.\n", chipNum); 857 return(0); 858 } 859 860 psS32 numChips = 0; 861 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 862 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 863 if (tmpChip != NULL) { 864 if (i == chipNum) { 865 tmpChip->valid = false; 866 } else { 867 tmpChip->valid = true; 868 numChips++; 869 } 870 } 871 } 872 873 return(numChips); 874 } -
trunk/psModules/src/astrom/pmAstrometry.h
r5681 r5739 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-12-0 5 21:28:55$10 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-12-08 00:00:57 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 423 423 ); 424 424 425 /** 426 * 427 * pmFPASelectChip shall set valid to true for the specified chip number 428 * (chipNum), and all other chips shall have valid set to false. In the event 429 * that the specified chip number does not exist within the fpa, the function 430 * shall return false. 431 * 432 */ 433 bool pmFPASelectChip( 434 pmFPA *fpa, 435 int chipNum 436 ); 437 438 /** 439 * 440 * pmFPAExcludeChip shall set valid to false only for the specified chip 441 * number (chipNum). In the event that the specified chip number does not exist 442 * within the fpa, the function shall generate a warning, and perform no action. 443 * The function shall return the number of chips within the fpa that have valid 444 * set to true. 445 * 446 */ 447 int pmFPAExcludeChip( 448 pmFPA *fpa, 449 int chipNum 450 ); 451 452 425 453 #endif // #ifndef PS_ASTROMETRY_H 454 -
trunk/psModules/test/astrom/tst_pmAstrometry01.c
r5681 r5739 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-12-0 5 21:28:55$7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-12-08 00:00:57 $ 9 9 * 10 10 * XXX: Add tests were the coordinate does not transform to any legitimate cell … … 12 12 * 13 13 * XXX: For each function, add tests for bad input parameters, as well as failed transforms. 14 * 15 * XXX: Must test pmFPASelectChip() and pmFPAExcludeChip(). 14 16 * 15 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 25 static psS32 test3( void ); 24 26 static psS32 test4( void ); 27 static psS32 test5( void ); 25 28 26 29 testDescription tests[] = { 27 30 {test3, -3, "pmAstrometry focal plane transformations", 0, false}, 28 31 {test4, -3, "pmCheckParents()", 0, false}, 32 {test5, -3, "pmFPASelectChip() and pmFPAExcludeChip()", 0, false}, 29 33 {NULL} 30 34 }; … … 584 588 return(testStatus); 585 589 } 590 591 /****************************************************************************** 592 test5(): This routine wil test the pmFPASelectChip() and pmFPAExcludeChip() 593 functions. We generate an pmFPA hierarchy, then set the ->valid members with 594 those routines, then verify. 595 *****************************************************************************/ 596 psS32 test5( void ) 597 { 598 psS32 testStatus = 0; 599 pmChip *tmpChip = NULL; 600 601 // 602 // Generate a pmFPA hierarchy. 603 // 604 pmFPA *tmpFPA = genSystem(); 605 606 // 607 // We test the ->valid member for each chip. 608 // 609 for (psS32 i = 0 ; i < tmpFPA->chips->n ; i++) { 610 tmpChip = (pmChip *) tmpFPA->chips->data[i]; 611 if ((tmpChip == NULL) || (tmpChip->valid != false)) { 612 printf("TEST ERROR: Could not properly generate an FPA hierarchy.\n"); 613 testStatus = 1; 614 } 615 } 616 617 // 618 // Exclude chip number 0, include all others, then test return value 619 // 620 psS32 numChips = pmFPAExcludeChip(tmpFPA, 0); 621 if (numChips != (NUM_CHIPS-1)) { 622 printf("TEST ERROR: pmFPAExcludeChip() did not return the correct number of chips.\n"); 623 testStatus = 2; 624 } 625 626 // 627 // We test the ->valid member for each chip. 628 // 629 tmpChip = (pmChip *) tmpFPA->chips->data[0]; 630 if (tmpChip->valid != false) { 631 printf("TEST ERROR: pmFPAExcludeChip() did not set the proper chip->valid to FALSE.\n"); 632 testStatus = 3; 633 } 634 for (psS32 i = 1 ; i < tmpFPA->chips->n ; i++) { 635 pmChip *tmpChip = (pmChip *) tmpFPA->chips->data[i]; 636 if (tmpChip->valid != true) { 637 printf("TEST ERROR: pmFPAExcludeChip() did not set the proper chip->valids to FALSE.\n"); 638 testStatus = 4; 639 } 640 } 641 642 643 // 644 // Include chip number 0, exclude all others, then test return value 645 // 646 psBool tmpBool = pmFPASelectChip(tmpFPA, 0); 647 if (tmpBool != true) { 648 printf("TEST ERROR: pmFPASelectChip() returned FALSE.\n"); 649 testStatus = 5; 650 } 651 652 // 653 // We test the ->valid member for each chip. 654 // 655 tmpChip = (pmChip *) tmpFPA->chips->data[0]; 656 if (tmpChip->valid != true) { 657 printf("TEST ERROR: pmFPASelectChip() did not set the proper chip->valid to FALSE.\n"); 658 testStatus = 6; 659 } 660 for (psS32 i = 1 ; i < tmpFPA->chips->n ; i++) { 661 pmChip *tmpChip = (pmChip *) tmpFPA->chips->data[i]; 662 if (tmpChip->valid != false) { 663 printf("TEST ERROR: pmFPASelectChip() did not set the proper chip->valids to FALSE.\n"); 664 testStatus = 7; 665 } 666 } 667 668 psFree(tmpFPA); 669 return(testStatus); 670 }
Note:
See TracChangeset
for help on using the changeset viewer.
