Commits

Suminori Nishie authored bd2222fa873 Merge
Merge branch 'master' into CAS-8418
No tags

code/calanalysis/CalAnalysis/CalAnalysis.cc

Modified
334 334 fieldSet( fieldGet(oTableName) );
335 335
336 336 antennaSet( antennaGet(oTableName) );
337 337 antenna1Set( antenna1Get(oTableName) );
338 338 antenna2Set( antenna2Get(oTableName) );
339 339
340 340 timeSet( timeGet(oTableName) );
341 341
342 342 feedSet( feedGet(oTableName) );
343 343
344 - spwInfoSet( spwInfoGet(oTableName) );
344 + spwInfoSet(CalAnalysis::SPW_INFO(oTableName));
345 345
346 346
347 347 // Return
348 348
349 349 return;
350 350
351 351 }
352 352
353 353 // -----------------------------------------------------------------------------
354 354
393 393 Description:
394 394 ------------
395 395 This member function returns the new format calibration table.
396 396
397 397 Inputs:
398 398 -------
399 399 None.
400 400
401 401 Outputs:
402 402 --------
403 -The reference to the String instance containing the new format calibration table
403 +The String instance containing the new format calibration table
404 404 name, returned via the function value.
405 405
406 406 Modification history:
407 407 ---------------------
408 408 2012 Apr 03 - Nick Elias, NRAO
409 409 Initial version.
410 410
411 411 */
412 412
413 413 // -----------------------------------------------------------------------------
414 414
415 -String& CalAnalysis::calName( void ) const {
416 -
417 - // Copy the private variable containing the new format calibration table name
418 - // and return it
415 +String CalAnalysis::calName( void ) const {
419 416
420 - String* poCalName = new String( oCalName );
417 + // return the variable containing the new format calibration table name
421 418
422 - return( *poCalName );
419 + return oCalName;
423 420
424 421 }
425 422
426 423 // -----------------------------------------------------------------------------
427 424
428 425 /*
429 426
430 427 CalAnalysis::msName
431 428
432 429 Description:
433 430 ------------
434 431 This member function returns the MS name.
435 432
436 433 Inputs:
437 434 -------
438 435 None.
439 436
440 437 Outputs:
441 438 --------
442 -The reference to the String instance containing the MS name, returned via the
439 +The String instance containing the MS name, returned via the
443 440 function value.
444 441
445 442 Modification history:
446 443 ---------------------
447 444 2012 Apr 03 - Nick Elias, NRAO
448 445 Initial version.
449 446
450 447 */
451 448
452 449 // -----------------------------------------------------------------------------
453 450
454 -String& CalAnalysis::msName( void ) const {
451 +String CalAnalysis::msName( void ) const {
455 452
456 - // Copy the private variable containing the MS name and return it
453 + // return the private variable containing the MS name
457 454
458 - String* poMSName = new String( oMSName );
459 -
460 - return( *poMSName );
455 + return oMSName;
461 456
462 457 }
463 458
464 459 // -----------------------------------------------------------------------------
465 460
466 461 /*
467 462
468 463 CalAnalysis::visCal
469 464
470 465 Description:
471 466 ------------
472 467 This member function returns the visibility calibration type.
473 468
474 469 Inputs:
475 470 -------
476 471 None.
477 472
478 473 Outputs:
479 474 --------
480 -The reference to the String instance containing the visibility calibration type,
475 +The String instance containing the visibility calibration type,
481 476 returned via the function value.
482 477
483 478 Modification history:
484 479 ---------------------
485 480 2012 Apr 03 - Nick Elias, NRAO
486 481 Initial version.
487 482
488 483 */
489 484
490 485 // -----------------------------------------------------------------------------
491 486
492 -String& CalAnalysis::visCal( void ) const {
493 -
494 - // Copy the private variable containing the visibility calibration type and
495 - // return it
487 +String CalAnalysis::visCal( void ) const {
496 488
497 - String* poVisCal = new String( oVisCal );
489 + // Return opy the private variable containing the visibility calibration type
498 490
499 - return( *poVisCal );
491 + return oVisCal;
500 492
501 493 }
502 494
503 495 // -----------------------------------------------------------------------------
504 496
505 497 /*
506 498
507 499 CalAnalysis::parType
508 500
509 501 Description:
510 502 ------------
511 503 This member function returns the parameter type ("Complex" or "Float").
512 504
513 505 Inputs:
514 506 -------
515 507 None.
516 508
517 509 Outputs:
518 510 --------
519 -The reference to the String instance containing the parameter type, returned via
511 +The String instance containing the parameter type, returned via
520 512 the function value.
521 513
522 514 Modification history:
523 515 ---------------------
524 516 2012 Apr 03 - Nick Elias, NRAO
525 517 Initial version.
526 518
527 519 */
528 520
529 521 // -----------------------------------------------------------------------------
530 522
531 -String& CalAnalysis::parType( void ) const {
523 +String CalAnalysis::parType( void ) const {
532 524
533 - // Copy the private variable containing the parameter type and return it
525 + // Return the private variable containing the parameter type
534 526
535 - String* poParType = new String( oParType );
536 -
537 - return( *poParType );
527 + return oParType;
538 528
539 529 }
540 530
541 531 // -----------------------------------------------------------------------------
542 532
543 533 /*
544 534
545 535 CalAnalysis::polBasis
546 536
547 537 Description:
559 549
560 550 Modification history:
561 551 ---------------------
562 552 2012 Apr 03 - Nick Elias, NRAO
563 553 Initial version.
564 554
565 555 */
566 556
567 557 // -----------------------------------------------------------------------------
568 558
569 -String& CalAnalysis::polBasis( void ) const {
570 -
571 - // Copy the private variable containing the polarization basis and return it
559 +String CalAnalysis::polBasis( void ) const {
572 560
573 - String* poPolBasis = new String( oPolBasis );
561 + // Return the variable containing the polarization basis
574 562
575 - return( *poPolBasis );
563 + return oPolBasis;
576 564
577 565 }
578 566
579 567 // -----------------------------------------------------------------------------
580 568
581 569 /*
582 570
583 571 CalAnalysis::field
584 572
585 573 Description:
586 574 ------------
587 575 This member function returns the field numbers.
588 576
589 577 Inputs:
590 578 -------
591 579 None.
592 580
593 581 Outputs:
594 582 --------
595 -The reference to the Vector<uInt> instance containing the fields, returned via
583 +The Vector<uInt> instance containing the fields, returned via
596 584 the function value.
597 585
598 586 Modification history:
599 587 ---------------------
600 588 2012 Apr 17 - Nick Elias, NRAO
601 589 Initial version.
602 590
603 591 */
604 592
605 593 // -----------------------------------------------------------------------------
606 594
607 -Vector<uInt>& CalAnalysis::field( void ) const {
595 +Vector<uInt> CalAnalysis::field( void ) const {
608 596
609 597 // Copy the private variable containing the field numbers and return it
610 598
611 - Vector<uInt>* poField = new Vector<uInt>( oField.copy() );
612 -
613 - return( *poField );
599 + return oField.copy();
614 600
615 601 }
616 602
617 603 // -----------------------------------------------------------------------------
618 604
619 605 /*
620 606
621 607 CalAnalysis::antenna
622 608
623 609 Description:
624 610 ------------
625 611 This member function returns the antenna numbers.
626 612
627 613 Inputs:
628 614 -------
629 615 None.
630 616
631 617 Outputs:
632 618 --------
633 -The reference to the Vector<uInt> instance containing the antenna numbers,
619 +The Vector<uInt> instance containing the antenna numbers,
634 620 returned via the function value.
635 621
636 622 Modification history:
637 623 ---------------------
638 624 2012 Apr 17 - Nick Elias, NRAO
639 625 Initial version.
640 626
641 627 */
642 628
643 629 // -----------------------------------------------------------------------------
644 630
645 -Vector<uInt>& CalAnalysis::antenna( void ) const {
646 -
647 - // Copy the private variable containing the antenna numbers and return it
631 +Vector<uInt> CalAnalysis::antenna( void ) const {
648 632
649 - Vector<uInt>* poAntenna = new Vector<uInt>( oAntenna.copy() );
633 + // Return a copy of the private variable containing the antenna numbers
650 634
651 - return( *poAntenna );
635 + return oAntenna.copy();
652 636
653 637 }
654 638
655 639 // -----------------------------------------------------------------------------
656 640
657 641 /*
658 642
659 643 CalAnalysis::antenna1
660 644
661 645 Description:
662 646 ------------
663 647 This member function returns the antenna 1 numbers.
664 648
665 649 Inputs:
666 650 -------
667 651 None.
668 652
669 653 Outputs:
670 654 --------
671 -The reference to the Vector<uInt> instance containing the antenna 1 numbers,
655 +The the Vector<uInt> instance containing the antenna 1 numbers,
672 656 returned via the function value.
673 657
674 658 Modification history:
675 659 ---------------------
676 660 2012 May 07 - Nick Elias, NRAO
677 661 Initial version.
678 662
679 663 */
680 664
681 665 // -----------------------------------------------------------------------------
682 666
683 -Vector<uInt>& CalAnalysis::antenna1( void ) const {
667 +Vector<uInt> CalAnalysis::antenna1( void ) const {
684 668
685 669 // Copy the private variable containing the antenna 1 numbers and return it
686 670
687 - Vector<uInt>* poAntenna1 = new Vector<uInt>( oAntenna1.copy() );
688 -
689 - return( *poAntenna1 );
671 + return oAntenna1.copy();
690 672
691 673 }
692 674
693 675 // -----------------------------------------------------------------------------
694 676
695 677 /*
696 678
697 679 CalAnalysis::antenna2
698 680
699 681 Description:
700 682 ------------
701 683 This member function returns the antenna 2 numbers.
702 684
703 685 Inputs:
704 686 -------
705 687 None.
706 688
707 689 Outputs:
708 690 --------
709 -The reference to the Vector<Int> instance containing the antenna 2 numbers,
691 +The Vector<Int> instance containing the antenna 2 numbers,
710 692 returned via the function value.
711 693
712 694 Modification history:
713 695 ---------------------
714 696 2012 May 07 - Nick Elias, NRAO
715 697 Initial version.
716 698
717 699 */
718 700
719 701 // -----------------------------------------------------------------------------
720 702
721 -Vector<Int>& CalAnalysis::antenna2( void ) const {
703 +Vector<Int> CalAnalysis::antenna2( void ) const {
722 704
723 705 // Copy the private variable containing the antenna 2 numbers and return it
724 706
725 - Vector<Int>* poAntenna2 = new Vector<Int>( oAntenna2.copy() );
726 -
727 - return( *poAntenna2 );
707 + return oAntenna2.copy();
728 708
729 709 }
730 710
731 711 // -----------------------------------------------------------------------------
732 712
733 713 /*
734 714
735 715 CalAnalysis::time
736 716
737 717 Description:
738 718 ------------
739 719 This member function returns the times.
740 720
741 721 Inputs:
742 722 -------
743 723 None.
744 724
745 725 Outputs:
746 726 --------
747 -The reference to the Vector<Double> instance containing the times, returned via
727 +The Vector<Double> instance containing the times, returned via
748 728 the function value.
749 729
750 730 Modification history:
751 731 ---------------------
752 732 2012 Apr 04 - Nick Elias, NRAO
753 733 Initial version.
754 734
755 735 */
756 736
757 737 // -----------------------------------------------------------------------------
758 738
759 -Vector<Double>& CalAnalysis::time( void ) const {
739 +Vector<Double> CalAnalysis::time( void ) const {
760 740
761 741 // Copy the private variable containing the times and return it
762 742
763 - Vector<Double>* poTime = new Vector<Double>( oTime.copy() );
764 -
765 - return( *poTime );
743 + return oTime.copy();
766 744
767 745 }
768 746
769 747 // -----------------------------------------------------------------------------
770 748
771 749 /*
772 750
773 751 CalAnalysis::feed
774 752
775 753 Description:
776 754 ------------
777 755 This member function returns the feeds.
778 756
779 757 Inputs:
780 758 -------
781 759 None.
782 760
783 761 Outputs:
784 762 --------
785 -The reference to the Vector<String> instance containing the feeds, returned via
763 +The Vector<String> instance containing the feeds, returned via
786 764 the function value.
787 765
788 766 Modification history:
789 767 ---------------------
790 768 2012 Apr 04 - Nick Elias, NRAO
791 769 Initial version.
792 770
793 771 */
794 772
795 773 // -----------------------------------------------------------------------------
796 774
797 -Vector<String>& CalAnalysis::feed( void ) const {
775 +Vector<String> CalAnalysis::feed( void ) const {
798 776
799 777 // Copy the private variable containing the feeds and return it
800 778
801 - Vector<String>* poFeed = new Vector<String>( oFeed.copy() );
802 -
803 - return( *poFeed );
779 + return oFeed.copy();
804 780
805 781 }
806 782
807 783 // -----------------------------------------------------------------------------
808 784
809 785 /*
810 786
811 787 CalAnalysis::numspw
812 788
813 789 Description:
814 790 ------------
815 791 This member function returns the number of spectral windows.
816 792
817 793 Inputs:
818 794 -------
819 795 None.
820 796
821 797 Outputs:
822 798 --------
823 -The reference to the uInt variable containing the spectral windows, returned via
799 +The uInt variable containing the spectral windows, returned via
824 800 the function value.
825 801
826 802 Modification history:
827 803 ---------------------
828 804 2012 Apr 04 - Nick Elias, NRAO
829 805 Initial version.
830 806 2012 Apr 17 - Nick Elias, NRAO
831 807 Modified to handle the SPW_INFO instance.
832 808
833 809 */
834 810
835 811 // -----------------------------------------------------------------------------
836 812
837 -uInt& CalAnalysis::numspw( void ) const {
838 -
839 - // Copy the private variable containing the number of spectral windows and
840 - // return it
813 +uInt CalAnalysis::numspw( void ) const {
841 814
842 - uInt* puiNumSPW = new uInt( oSPWInfo.uiNumSPW );
815 + // Return the variable containing the number of spectral windows
843 816
844 - return( *puiNumSPW );
817 + return oSPWInfo.uiNumSPW;
845 818
846 819 }
847 820
848 821 // -----------------------------------------------------------------------------
849 822
850 823 /*
851 824
852 825 CalAnalysis::spw
853 826
854 827 Description:
855 828 ------------
856 829 This member function returns the spectral windows.
857 830
858 831 Inputs:
859 832 -------
860 833 None.
861 834
862 835 Outputs:
863 836 --------
864 -The reference to the Vector<uInt> instance containing the spectral windows,
837 +The Vector<uInt> instance containing the spectral windows,
865 838 returned via the function value.
866 839
867 840 Modification history:
868 841 ---------------------
869 842 2012 Apr 04 - Nick Elias, NRAO
870 843 Initial version.
871 844 2012 Apr 17 - Nick Elias, NRAO
872 845 Modified to handle the SPW_INFO instance.
873 846
874 847 */
875 848
876 849 // -----------------------------------------------------------------------------
877 850
878 -Vector<uInt>& CalAnalysis::spw( void ) const {
851 +Vector<uInt> CalAnalysis::spw( void ) const {
879 852
880 853 // Copy the private variable containing the spectral windows and return it
881 854
882 - Vector<uInt>* poSPW = new Vector<uInt>( oSPWInfo.oSPW.copy() );
883 -
884 - return( *poSPW );
855 + return oSPWInfo.oSPW.copy();
885 856
886 857 }
887 858
888 859 // -----------------------------------------------------------------------------
889 860
890 861 /*
891 862
892 863 CalAnalysis::numChannel
893 864
894 865 Description:
906 877
907 878 Modification history:
908 879 ---------------------
909 880 2012 Apr 17 - Nick Elias, NRAO
910 881 Initial version.
911 882
912 883 */
913 884
914 885 // -----------------------------------------------------------------------------
915 886
916 -Vector<uInt>& CalAnalysis::numChannel( void ) const {
887 +Vector<uInt> CalAnalysis::numChannel( void ) const {
917 888
918 889 // Copy the private variable containing the number of channels for each
919 890 // spectral window and return it
920 891
921 - Vector<uInt>* poNumChannel = new Vector<uInt>( oSPWInfo.oNumChannel.copy() );
922 -
923 - return( *poNumChannel );
892 + return oSPWInfo.oNumChannel.copy();
924 893
925 894 }
926 895
927 896 // -----------------------------------------------------------------------------
928 897
929 898 /*
930 899
931 900 CalAnalysis::freq
932 901
933 902 Description:
945 914
946 915 Modification history:
947 916 ---------------------
948 917 2012 Apr 17 - Nick Elias, NRAO
949 918 Initial version.
950 919
951 920 */
952 921
953 922 // -----------------------------------------------------------------------------
954 923
955 -Vector<Vector<Double> >& CalAnalysis::freq( void ) const {
924 +Vector<Vector<Double> > CalAnalysis::freq( void ) const {
956 925
957 926 // Copy the private variable containing the frequencies for each spectral
958 927 // window and return it
959 928
960 929 uInt uiNumSPW = oSPWInfo.uiNumSPW;
961 930
962 - Vector<Vector<Double> >* poFreq = new Vector<Vector<Double> >( uiNumSPW );
931 + Vector<Vector<Double> > freq( uiNumSPW );
963 932
964 933 for ( uInt s=0; s<uiNumSPW; s++ ) {
965 - poFreq->operator[](s) = oSPWInfo.oFrequency[s].copy();
934 + freq[s] = oSPWInfo.oFrequency[s].copy();
966 935 }
967 936
968 - return( *poFreq );
937 + return freq;
969 938
970 939 }
971 940
972 941 // -----------------------------------------------------------------------------
973 942 // End of CalAnalysis public member functions
974 943 // -----------------------------------------------------------------------------
975 944
976 945 // -----------------------------------------------------------------------------
977 946 // Start of CalAnalysis private member functions
978 947 // -----------------------------------------------------------------------------
1001 970
1002 971 Modification history:
1003 972 ---------------------
1004 973 2012 Apr 03 - Nick Elias, NRAO
1005 974 Initial version.
1006 975
1007 976 */
1008 977
1009 978 // -----------------------------------------------------------------------------
1010 979
1011 -String& CalAnalysis::calNameGet( const String& oTableName ) {
980 +String CalAnalysis::calNameGet( const String& oTableName ) {
1012 981
1013 982 // Get the new format calibration table name and return it
1014 983
1015 - String* poTableName = new String( oTableName );
984 + String poTableName = oTableName;
1016 985
1017 - return( *poTableName );
986 + return poTableName;
1018 987
1019 988 }
1020 989
1021 990 // -----------------------------------------------------------------------------
1022 991
1023 992 /*
1024 993
1025 994 CalAnalysis::calNameSet
1026 995
1027 996 Description:
1080 1049
1081 1050 Modification history:
1082 1051 ---------------------
1083 1052 2012 Mar 13 - Nick Elias, NRAO
1084 1053 Initial version.
1085 1054
1086 1055 */
1087 1056
1088 1057 // -----------------------------------------------------------------------------
1089 1058
1090 -String& CalAnalysis::msNameGet( const String& oTableName ) {
1059 +String CalAnalysis::msNameGet( const String& oTableName ) {
1091 1060
1092 1061 // Get the record containing the main table keywords
1093 1062
1094 1063 Table oTable( oTableName );
1095 1064 TableProxy oTP( oTable );
1096 1065 Record oR( oTP.getKeywordSet( String("") ) );
1097 1066
1098 1067
1099 1068 // Get the associated MS name and return it
1100 1069
1101 1070 uInt uiIndex = oR.fieldNumber( String( "MSName" ) );
1102 - String* poMSName = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
1071 + String poMSName = RecordFieldPtr<String>(oR,uiIndex).get();
1103 1072
1104 - return( *poMSName );
1073 + return poMSName;
1105 1074
1106 1075 }
1107 1076
1108 1077 // -----------------------------------------------------------------------------
1109 1078
1110 1079 /*
1111 1080
1112 1081 CalAnalysis::msNameSet
1113 1082
1114 1083 Description:
1165 1134
1166 1135 Modification history:
1167 1136 ---------------------
1168 1137 2012 Mar 13 - Nick Elias, NRAO
1169 1138 Initial version.
1170 1139
1171 1140 */
1172 1141
1173 1142 // -----------------------------------------------------------------------------
1174 1143
1175 -String& CalAnalysis::visCalGet( const String& oTableName ) {
1144 +String CalAnalysis::visCalGet( const String& oTableName ) {
1176 1145
1177 1146 // Get the record containing the main table keywords
1178 1147
1179 1148 Table oTable( oTableName );
1180 1149 TableProxy oTP( oTable );
1181 1150 Record oR( oTP.getKeywordSet( String("") ) );
1182 1151
1183 1152
1184 1153 // Get the visibility calibration type and return it
1185 1154
1186 1155 uInt uiIndex = oR.fieldNumber( String( "VisCal" ) );
1187 - String* poVisCal = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
1156 + String poVisCal = RecordFieldPtr<String>(oR,uiIndex).get();
1188 1157
1189 - return( *poVisCal );
1158 + return poVisCal;
1190 1159
1191 1160 }
1192 1161
1193 1162 // -----------------------------------------------------------------------------
1194 1163
1195 1164 /*
1196 1165
1197 1166 CalAnalysis::visCalSet
1198 1167
1199 1168 Description:
1253 1222 ---------------------
1254 1223 2012 Jan 20 - Nick Elias, NRAO
1255 1224 Initial version.
1256 1225 2012 Mar 13 - Nick Elias, NRAO
1257 1226 Function renamed to parType().
1258 1227
1259 1228 */
1260 1229
1261 1230 // -----------------------------------------------------------------------------
1262 1231
1263 -String& CalAnalysis::parTypeGet( const String& oTableName ) {
1232 +String CalAnalysis::parTypeGet( const String& oTableName ) {
1264 1233
1265 1234 // Get the record containing the main table keywords
1266 1235
1267 1236 Table oTable( oTableName );
1268 1237 TableProxy oTP( oTable );
1269 1238 Record oR( oTP.getKeywordSet( String("") ) );
1270 1239
1271 1240
1272 1241 // Get the parameter column type and return it
1273 1242
1274 1243 uInt uiIndex = oR.fieldNumber( String( "ParType" ) );
1275 - String* poParType = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
1244 + String poParType = RecordFieldPtr<String>(oR,uiIndex).get();
1276 1245
1277 - return( *poParType );
1246 + return poParType;
1278 1247
1279 1248 }
1280 1249
1281 1250 // -----------------------------------------------------------------------------
1282 1251
1283 1252 /*
1284 1253
1285 1254 CalAnalysis::parTypeSet
1286 1255
1287 1256 Description:
1340 1309
1341 1310 Modification history:
1342 1311 ---------------------
1343 1312 2012 Jan 20 - Nick Elias, NRAO
1344 1313 Initial version.
1345 1314
1346 1315 */
1347 1316
1348 1317 // -----------------------------------------------------------------------------
1349 1318
1350 -String& CalAnalysis::polBasisGet( const String& oTableName ) {
1319 +String CalAnalysis::polBasisGet( const String& oTableName ) {
1351 1320
1352 1321 // Get the record containing the main table keywords
1353 1322
1354 1323 Table oTable( oTableName );
1355 1324 TableProxy oTP( oTable );
1356 1325 Record oR( oTP.getKeywordSet( String("") ) );
1357 1326
1358 1327
1359 1328 // Get the polarization basis, make it upper case, keep only the initial
1360 1329 // letter, and return it
1361 1330
1362 1331 uInt uiIndex = oR.fieldNumber( String( "PolBasis" ) );
1363 - String* poPolBasis = new String( RecordFieldPtr<String>(oR,uiIndex).get() );
1332 + String poPolBasis = RecordFieldPtr<String>(oR,uiIndex).get();
1364 1333
1365 - poPolBasis->upcase();
1366 - poPolBasis->operator=( poPolBasis->operator[](0) );
1334 + poPolBasis.upcase();
1335 + poPolBasis.operator=( poPolBasis.operator[](0) );
1367 1336
1368 - return( *poPolBasis );
1337 + return poPolBasis;
1369 1338
1370 1339 }
1371 1340
1372 1341 // -----------------------------------------------------------------------------
1373 1342
1374 1343 /*
1375 1344
1376 1345 CalAnalysis::polBasisSet
1377 1346
1378 1347 Description:
1418 1387 This member function gets the field numbers from the new format calibration
1419 1388 table.
1420 1389
1421 1390 Inputs:
1422 1391 -------
1423 1392 oTableName - This reference to a String instance contains the new format
1424 1393 calibration table name.
1425 1394
1426 1395 Outputs:
1427 1396 --------
1428 -The reference to the Vector<uInt> instance containing the field numbers,
1397 +The Vector<uInt> instance containing the field numbers,
1429 1398 returned via the function value.
1430 1399
1431 1400 Modification history:
1432 1401 ---------------------
1433 1402 2012 Apr 17 - Nick Elias, NRAO
1434 1403 Initial version.
1435 1404 2012 May 02 - Nick Elias, NRAO
1436 1405 Fields are now obtained directly from the FIELD_ID column of the
1437 1406 main table.
1438 1407
1439 1408 */
1440 1409
1441 1410 // -----------------------------------------------------------------------------
1442 1411
1443 -Vector<uInt>& CalAnalysis::fieldGet( const String& oTableName ) {
1412 +Vector<uInt> CalAnalysis::fieldGet( const String& oTableName ) {
1444 1413
1445 1414 // Get the field numbers from the new format calibration table
1446 1415
1447 1416 Table oTable( oTableName, Table::Old );
1448 1417 ScalarColumn<Int> oROSC( oTable, String("FIELD_ID") );
1449 1418
1450 1419 Vector<Int> oFieldInt;
1451 1420 oROSC.getColumn( oFieldInt, true );
1452 1421
1453 - Vector<Int> oFieldUnique( unique<Int>(oFieldInt) );
1422 + Vector<Int> oFieldUnique;
1423 + unique<Int>(oFieldInt, oFieldUnique);
1454 1424
1455 - Vector<uInt>* poField = new Vector<uInt>( oFieldUnique.nelements() );
1456 - convertArray<uInt,Int>( *poField, oFieldUnique );
1425 + Vector<uInt> field( oFieldUnique.nelements() );
1426 + convertArray<uInt,Int>( field, oFieldUnique );
1457 1427
1458 - return( *poField );
1428 + return field;
1459 1429
1460 1430 }
1461 1431
1462 1432 // -----------------------------------------------------------------------------
1463 1433
1464 1434 /*
1465 1435
1466 1436 CalAnalysis::fieldSet
1467 1437
1468 1438 Description:
1509 1479 vector.
1510 1480
1511 1481 Inputs:
1512 1482 -------
1513 1483 oFieldIn - This reference to a Vector<uInt> instance contains the field numbers.
1514 1484
1515 1485 Outputs:
1516 1486 --------
1517 1487 oFieldOut - This reference to the Vector<uInt> instance contains the checked and
1518 1488 fixed field numbers.
1519 -The reference to the Bool variable containing the check boolean, returned via
1489 +The Bool variable containing the check boolean, returned via
1520 1490 the function value.
1521 1491
1522 1492 Modification history:
1523 1493 ---------------------
1524 1494 2012 Apr 17 - Nick Elias, NRAO
1525 1495 Initial version.
1526 1496
1527 1497 */
1528 1498
1529 1499 // -----------------------------------------------------------------------------
1530 1500
1531 -Bool& CalAnalysis::fieldCheck( const Vector<uInt>& oFieldIn,
1501 +Bool CalAnalysis::fieldCheck( const Vector<uInt>& oFieldIn,
1532 1502 Vector<uInt>& oFieldOut ) const {
1533 1503
1534 1504 // Declare the success boolean
1535 1505
1536 - Bool* poSuccess = new Bool( false );
1506 + Bool success = false;
1537 1507
1538 1508
1539 1509 // Check the input field numbers and return the fixed field numbers
1540 1510
1541 1511 if ( oFieldIn.nelements() == 0 ) {
1542 - *poSuccess = false;
1543 - return( *poSuccess );
1512 + success = false;
1513 + return success;
1544 1514 }
1545 1515
1546 1516 uInt uiNumFieldOut = 0;
1547 1517 oFieldOut.resize();
1548 1518
1549 1519 for ( uInt f=0; f<oFieldIn.nelements(); f++ ) {
1550 1520 if ( exists<uInt>( oFieldIn[f], oField ) ) {
1551 1521 uiNumFieldOut += 1;
1552 1522 oFieldOut.resize( uiNumFieldOut, true );
1553 1523 oFieldOut[uiNumFieldOut-1] = oFieldIn[f];
1554 1524 }
1555 1525 }
1556 1526
1557 1527 if ( uiNumFieldOut == 0 ) {
1558 - *poSuccess = false;
1559 - return( *poSuccess );
1528 + success = false;
1529 + return success;
1560 1530 }
1561 1531
1562 1532
1563 1533 // Return true
1564 1534
1565 - *poSuccess = true;
1535 + success = true;
1566 1536
1567 - return( *poSuccess );
1537 + return success;
1568 1538
1569 1539 }
1570 1540
1571 1541 // -----------------------------------------------------------------------------
1572 1542
1573 1543 /*
1574 1544
1575 1545 CalAnalysis::antennaGet
1576 1546
1577 1547 Description:
1578 1548 ------------
1579 1549 This member function gets the antenna numbers from the new format calibration
1580 1550 table.
1581 1551
1582 1552 Inputs:
1583 1553 -------
1584 1554 oTableName - This reference to a String instance contains the new format
1585 1555 calibration table name.
1586 1556
1587 1557 Outputs:
1588 1558 --------
1589 -The reference to the Vector<uInt> instance containing the antenna numbers,
1559 +The Vector<uInt> instance containing the antenna numbers,
1590 1560 returned via the function value.
1591 1561
1592 1562 Modification history:
1593 1563 ---------------------
1594 1564 2012 Apr 17 - Nick Elias, NRAO
1595 1565 Initial version.
1596 1566
1597 1567 */
1598 1568
1599 1569 // -----------------------------------------------------------------------------
1600 1570
1601 -Vector<uInt>& CalAnalysis::antennaGet( const String& oTableName ) {
1571 +Vector<uInt> CalAnalysis::antennaGet( const String& oTableName ) {
1602 1572
1603 1573 // Create a temporary antenna subtable instance and get the number of antennas
1604 1574 // (the number of rows)
1605 1575
1606 1576 Table oTableAntenna( oTableName+"/ANTENNA", Table::Old );
1607 1577 uInt uiNumRow = oTableAntenna.nrow();
1608 1578
1609 1579
1610 1580 // Create the vector containing the antenna numbers and return it
1611 1581
1612 - Vector<uInt>* poAntenna = new Vector<uInt>( uiNumRow );
1613 - indgen<uInt>( *poAntenna, 0 );
1582 + Vector<uInt> antenna( uiNumRow );
1583 + indgen<uInt>( antenna, 0 );
1614 1584
1615 - return( *poAntenna );
1585 + return antenna;
1616 1586
1617 1587
1618 1588 }
1619 1589
1620 1590 // -----------------------------------------------------------------------------
1621 1591
1622 1592 /*
1623 1593
1624 1594 CalAnalysis::antennaSet
1625 1595
1667 1637 This member function gets the antenna 1 numbers from the new format calibration
1668 1638 table.
1669 1639
1670 1640 Inputs:
1671 1641 -------
1672 1642 oTableName - This reference to a String instance contains the new format
1673 1643 calibration table name.
1674 1644
1675 1645 Outputs:
1676 1646 --------
1677 -The reference to the Vector<uInt> instance containing the antenna 1 numbers,
1647 +The Vector<uInt> instance containing the antenna 1 numbers,
1678 1648 returned via the function value.
1679 1649
1680 1650 Modification history:
1681 1651 ---------------------
1682 1652 2012 May 02 - Nick Elias, NRAO
1683 1653 Initial version.
1684 1654
1685 1655 */
1686 1656
1687 1657 // -----------------------------------------------------------------------------
1688 1658
1689 -Vector<uInt>& CalAnalysis::antenna1Get( const String& oTableName ) {
1659 +Vector<uInt> CalAnalysis::antenna1Get( const String& oTableName ) {
1690 1660
1691 1661 // Get the antenna 1 numbers from the new format calibration table
1692 1662
1693 1663 Table oTable( oTableName, Table::Old );
1694 1664 ScalarColumn<Int> oROSC( oTable, String("ANTENNA1") );
1695 1665
1696 1666 Vector<Int> oAntenna1Int;
1697 1667 oROSC.getColumn( oAntenna1Int, true );
1698 1668
1699 - Vector<Int> oAntenna1Unique( unique<Int>(oAntenna1Int) );
1669 + Vector<Int> oAntenna1Unique;
1670 + unique<Int>(oAntenna1Int, oAntenna1Unique);
1700 1671
1701 - Vector<uInt>* poAntenna1 = new Vector<uInt>( oAntenna1Unique.nelements() );
1702 - convertArray<uInt,Int>( *poAntenna1, oAntenna1Unique );
1672 + Vector<uInt> antenna1( oAntenna1Unique.nelements() );
1673 + convertArray<uInt,Int>( antenna1, oAntenna1Unique );
1703 1674
1704 - return( *poAntenna1 );
1675 + return antenna1;
1705 1676
1706 1677 }
1707 1678
1708 1679 // -----------------------------------------------------------------------------
1709 1680
1710 1681 /*
1711 1682
1712 1683 CalAnalysis::antenna1Set
1713 1684
1714 1685 Description:
1757 1728
1758 1729 Inputs:
1759 1730 -------
1760 1731 oAntenna1In - This reference to a Vector<uInt> instance contains the antenna 1
1761 1732 numbers.
1762 1733
1763 1734 Outputs:
1764 1735 --------
1765 1736 oAntenna1Out - This reference to the Vector<uInt> instance contains the checked
1766 1737 and fixed antenna 1 numbers.
1767 -The reference to the Bool variable containing the check boolean, returned via
1738 +The Bool variable containing the check boolean, returned via
1768 1739 the function value.
1769 1740
1770 1741 Modification history:
1771 1742 ---------------------
1772 1743 2012 Apr 17 - Nick Elias, NRAO
1773 1744 Initial version.
1774 1745 2012 Apr 25 - Nick Elias, NRAO
1775 1746 Member function antennaCheck() renamed to antenna1Check().
1776 1747 2012 May 02 - Nick Elias, NRAO
1777 1748 The comparison is now made to an internal list of antenna 2.
1778 1749
1779 1750 */
1780 1751
1781 1752 // -----------------------------------------------------------------------------
1782 1753
1783 -Bool& CalAnalysis::antenna1Check( const Vector<uInt>& oAntenna1In,
1754 +Bool CalAnalysis::antenna1Check( const Vector<uInt>& oAntenna1In,
1784 1755 Vector<uInt>& oAntenna1Out ) const {
1785 1756
1786 1757 // Declare the success boolean
1787 1758
1788 - Bool* poSuccess = new Bool( false );
1759 + Bool success(false);
1789 1760
1790 1761
1791 1762 // Check the input antenna 1 numbers and return the fixed antenna 1 numbers
1792 1763
1793 1764 if ( oAntenna1In.nelements() == 0 ) {
1794 - *poSuccess = false;
1795 - return( *poSuccess );
1765 + success = false;
1766 + return success;
1796 1767 }
1797 1768
1798 1769 uInt uiNumAntenna1Out = 0;
1799 1770 oAntenna1Out.resize();
1800 1771
1801 1772 for ( uInt a=0; a<oAntenna1In.nelements(); a++ ) {
1802 1773 if ( exists<uInt>( oAntenna1In[a], oAntenna1 ) ) {
1803 1774 uiNumAntenna1Out += 1;
1804 1775 oAntenna1Out.resize( uiNumAntenna1Out, true );
1805 1776 oAntenna1Out[uiNumAntenna1Out-1] = oAntenna1In[a];
1806 1777 }
1807 1778 }
1808 1779
1809 1780 if ( uiNumAntenna1Out == 0 ) {
1810 - *poSuccess = false;
1811 - return( *poSuccess );
1781 + success = false;
1782 + return success;
1812 1783 }
1813 1784
1814 1785
1815 1786 // Return true
1816 1787
1817 - *poSuccess = true;
1788 + success = true;
1818 1789
1819 - return( *poSuccess );
1790 + return success;
1820 1791
1821 1792 }
1822 1793
1823 1794 // -----------------------------------------------------------------------------
1824 1795
1825 1796 /*
1826 1797
1827 1798 CalAnalysis::antenna2Get
1828 1799
1829 1800 Description:
1830 1801 ------------
1831 1802 This member function gets the antenna 2 numbers from the new format calibration
1832 1803 table.
1833 1804
1834 1805 Inputs:
1835 1806 -------
1836 1807 oTableName - This reference to a String instance contains the new format
1837 1808 calibration table name.
1838 1809
1839 1810 Outputs:
1840 1811 --------
1841 -The reference to the Vector<Int> instance containing the antenna 2 numbers,
1812 +The Vector<Int> instance containing the antenna 2 numbers,
1842 1813 returned via the function value.
1843 1814
1844 1815 Modification history:
1845 1816 ---------------------
1846 1817 2012 May 02 - Nick Elias, NRAO
1847 1818 Initial version.
1848 1819
1849 1820 */
1850 1821
1851 1822 // -----------------------------------------------------------------------------
1852 1823
1853 -Vector<Int>& CalAnalysis::antenna2Get( const String& oTableName ) {
1824 +Vector<Int> CalAnalysis::antenna2Get( const String& oTableName ) {
1854 1825
1855 1826 // Get the antenna 2 numbers from the new format calibration table
1856 1827
1857 1828 Table oTable( oTableName, Table::Old );
1858 1829 ScalarColumn<Int> oROSC( oTable, String("ANTENNA2") );
1859 1830
1860 1831 Vector<Int> oAntenna2Int;
1861 1832 oROSC.getColumn( oAntenna2Int, true );
1862 1833
1863 - Vector<Int>* poAntenna2 = new Vector<Int>( unique<Int>(oAntenna2Int) );
1864 1834
1865 - return( *poAntenna2 );
1835 + Vector<Int> uniqueA2;
1836 + unique<Int>(oAntenna2Int, uniqueA2);
1837 +
1838 + Vector<Int> antenna2( uniqueA2 );
1839 +
1840 + return antenna2;
1866 1841
1867 1842 }
1868 1843
1869 1844 // -----------------------------------------------------------------------------
1870 1845
1871 1846 /*
1872 1847
1873 1848 CalAnalysis::antenna2Set
1874 1849
1875 1850 Description:
1918 1893
1919 1894 Inputs:
1920 1895 -------
1921 1896 oAntenna2In - This reference to a Vector<Int> instance contains the antenna 2
1922 1897 numbers.
1923 1898
1924 1899 Outputs:
1925 1900 --------
1926 1901 oAntenna2Out - This reference to the Vector<Int> instance contains the checked
1927 1902 and fixed antenna 2 numbers.
1928 -The reference to the Bool variable containing the check boolean, returned via
1903 +The Bool variable containing the check boolean, returned via
1929 1904 the function value.
1930 1905
1931 1906 Modification history:
1932 1907 ---------------------
1933 1908 2012 Apr 25 - Nick Elias, NRAO
1934 1909 Initial version.
1935 1910 2012 May 02 - Nick Elias, NRAO
1936 1911 The comparison is now made to an internal list of antenna 2.
1937 1912
1938 1913 */
1939 1914
1940 1915 // -----------------------------------------------------------------------------
1941 1916
1942 -Bool& CalAnalysis::antenna2Check( const Vector<Int>& oAntenna2In,
1917 +Bool CalAnalysis::antenna2Check( const Vector<Int>& oAntenna2In,
1943 1918 Vector<Int>& oAntenna2Out ) const {
1944 1919
1945 1920 // Declare the success boolean
1946 1921
1947 - Bool* poSuccess = new Bool( false );
1922 + Bool success( false );
1948 1923
1949 1924
1950 1925 // Check the input antenna 1 numbers and return the fixed antenna 1 numbers
1951 1926
1952 1927 if ( oAntenna2In.nelements() == 0 ) {
1953 - *poSuccess = false;
1954 - return( *poSuccess );
1928 + success = false;
1929 + return success;
1955 1930 }
1956 1931
1957 1932 uInt uiNumAntenna2Out = 0;
1958 1933 oAntenna2Out.resize();
1959 1934
1960 1935 for ( uInt a=0; a<oAntenna2In.nelements(); a++ ) {
1961 1936 if ( oAntenna2In[a] == -1 || exists<Int>( oAntenna2In[a], oAntenna2 ) ) {
1962 1937 uiNumAntenna2Out += 1;
1963 1938 oAntenna2Out.resize( uiNumAntenna2Out, true );
1964 1939 oAntenna2Out[uiNumAntenna2Out-1] = oAntenna2In[a];
1965 1940 }
1966 1941 }
1967 1942
1968 1943 if ( uiNumAntenna2Out == 0 ) {
1969 - *poSuccess = false;
1970 - return( *poSuccess );
1944 + success = false;
1945 + return success;
1971 1946 }
1972 1947
1973 1948
1974 1949 // Return true
1975 1950
1976 - *poSuccess = true;
1951 + success = true;
1977 1952
1978 - return( *poSuccess );
1953 + return success;
1979 1954
1980 1955 }
1981 1956
1982 1957 // -----------------------------------------------------------------------------
1983 1958
1984 1959 /*
1985 1960
1986 1961 CalAnalysis::timeGet
1987 1962
1988 1963 Description:
1989 1964 ------------
1990 1965 This member function gets the times from the new format calibration table.
1991 1966
1992 1967 Inputs:
1993 1968 -------
1994 1969 oTableName - This reference to a String instance contains the new format
1995 1970 calibration table name.
1996 1971
1997 1972 Outputs:
1998 1973 --------
1999 -The reference to the Vector<Double> instance containing the times, returned via
1974 +The Vector<Double> instance containing the times, returned via
2000 1975 the function value.
2001 1976
2002 1977 Modification history:
2003 1978 ---------------------
2004 1979 2012 Apr 04 - Nick Elias, NRAO
2005 1980 Initial version.
2006 1981
2007 1982 */
2008 1983
2009 1984 // -----------------------------------------------------------------------------
2010 1985
2011 -Vector<Double>& CalAnalysis::timeGet( const String& oTableName ) {
1986 +Vector<Double> CalAnalysis::timeGet( const String& oTableName ) {
2012 1987
2013 1988 // Create a temporary new format calibration table instance
2014 1989
2015 1990 Table oTable( oTableName, Table::Old );
2016 1991 ScalarColumn<Double> oROSC( oTable, String("TIME") );
2017 1992
2018 1993
2019 1994 // Get the sorted and unique time stamps
2020 1995
2021 1996 Vector<Double> oTimeTemp;
2022 1997 oROSC.getColumn( oTimeTemp, true );
2023 1998
2024 - Vector<Double>* poTime = new Vector<Double>( 0 );
2025 - *poTime = unique<Double>( oTimeTemp );
1999 + Vector<Double> timev( 0 );
2000 + unique<Double>( oTimeTemp, timev );
2026 2001
2027 2002
2028 2003 // Return the time stamps
2029 2004
2030 - return( *poTime );
2005 + return timev;
2031 2006
2032 2007 }
2033 2008
2034 2009 // -----------------------------------------------------------------------------
2035 2010
2036 2011 /*
2037 2012
2038 2013 CalAnalysis::timeSet
2039 2014
2040 2015 Description:
2084 2059 -------
2085 2060 dStartTimeIn - This reference to a Double variable contains the start time.
2086 2061 dStopTimeIn - This reference to a Double variable contains the stop time.
2087 2062
2088 2063 Outputs:
2089 2064 --------
2090 2065 dStartTimeOut - This reference to a Double variable contains the start time.
2091 2066 dStopTimeOut - This reference to a Double variable contains the stop time.
2092 2067 oTimeOut - This reference to the Vector<Double> instance containing the
2093 2068 time stamps.
2094 -The reference to the Bool variable containing the check boolean, returned via
2069 +The Bool variable containing the check boolean, returned via
2095 2070 the function value.
2096 2071
2097 2072 Modification history:
2098 2073 ---------------------
2099 2074 2012 Jan 20 - Nick Elias, NRAO
2100 2075 Initial version.
2101 2076 2012 May 06 - Nick Elias, NRAO
2102 2077 Output start and stop times added.
2103 2078
2104 2079 */
2105 2080
2106 2081 // -----------------------------------------------------------------------------
2107 2082
2108 -Bool& CalAnalysis::timeCheck( const Double& dStartTimeIn,
2083 +Bool CalAnalysis::timeCheck( const Double& dStartTimeIn,
2109 2084 const Double& dStopTimeIn, Double& dStartTimeOut, Double& dStopTimeOut,
2110 2085 Vector<Double>& oTimeOut ) const {
2111 2086
2112 2087 // Declare the success boolean
2113 2088
2114 - Bool* poSuccess = new Bool( false );
2089 + Bool success( false );
2115 2090
2116 2091
2117 2092 // Check the start and stop times
2118 2093
2119 2094 if ( dStartTimeIn > dStopTimeIn ) {
2120 - *poSuccess = false;
2121 - return( *poSuccess );
2095 + success = false;
2096 + return success;
2122 2097 }
2123 2098
2124 2099 if ( dStartTimeIn > oTime[uiNumTime-1] ) {
2125 - *poSuccess = false;
2126 - return( *poSuccess );
2100 + success = false;
2101 + return success;
2127 2102 }
2128 2103
2129 2104 if ( dStopTimeIn < oTime[0] ) {
2130 - *poSuccess = false;
2131 - return( *poSuccess );
2105 + success = false;
2106 + return success;
2132 2107 }
2133 2108
2134 2109
2135 2110 // Get the unique time values and the new start and stop times
2136 2111
2137 2112 uInt uiNumTimeOut = 0;
2138 2113 oTimeOut.resize();
2139 2114
2140 2115 for ( uInt t=0; t<uiNumTime; t++ ) {
2141 2116 if ( oTime[t] >= dStartTimeIn && oTime[t] <= dStopTimeIn ) {
2142 2117 oTimeOut.resize( ++uiNumTimeOut, true );
2143 2118 oTimeOut[uiNumTimeOut-1] = oTime[t];
2144 2119 }
2145 2120 }
2146 2121
2147 2122 if ( oTimeOut.nelements() == 0 ) {
2148 - *poSuccess = false;
2149 - return( *poSuccess );
2123 + success = false;
2124 + return success;
2150 2125 }
2151 2126
2152 2127 dStartTimeOut = min( oTimeOut );
2153 2128 dStopTimeOut = max( oTimeOut );
2154 2129
2155 2130
2156 2131 // Return true
2157 2132
2158 - *poSuccess = true;
2133 + success = true;
2159 2134
2160 - return( *poSuccess );
2135 + return success;
2161 2136
2162 2137 }
2163 2138
2164 2139 // -----------------------------------------------------------------------------
2165 2140
2166 2141 /*
2167 2142
2168 2143 CalAnalysis::feedGet
2169 2144
2170 2145 Description:
2174 2149 NB: If the number of feeds in the column is a function of row, this function
2175 2150 will fail.
2176 2151
2177 2152 Inputs:
2178 2153 -------
2179 2154 oTableName - This reference to a String instance contains the new format
2180 2155 calibration table name.
2181 2156
2182 2157 Outputs:
2183 2158 --------
2184 -The reference to the Vector<String> instance containing the feeds, returned via
2159 +The Vector<String> instance containing the feeds, returned via
2185 2160 the function value.
2186 2161
2187 2162 Modification history:
2188 2163 ---------------------
2189 2164 2012 Apr 04 - Nick Elias, NRAO
2190 2165 Initial version.
2191 2166 2012 May 02 - Nick Elias, NRAO
2192 2167 The new format calibration table iterator is no longer used. A
2193 2168 call to the main table is now used instead.
2194 2169
2195 2170 */
2196 2171
2197 2172 // -----------------------------------------------------------------------------
2198 2173
2199 -Vector<String>& CalAnalysis::feedGet( const String& oTableName ) {
2174 +Vector<String> CalAnalysis::feedGet( const String& oTableName ) {
2200 2175
2201 2176 // Get the number of feeds from the new format calibration table
2202 2177
2203 2178 Table oTable( oTableName, Table::Old );
2204 2179
2205 2180 Array<Float> oParamErrCell0;
2206 2181
2207 2182 try {
2208 2183
2209 2184 ArrayColumn<Float> oROAC( oTable, String("PARAMERR") );
2214 2189 }
2215 2190
2216 2191 catch ( AipsError oAipsError ) {
2217 2192 throw( oAipsError );
2218 2193 }
2219 2194
2220 2195
2221 2196 // Set the feeds
2222 2197
2223 2198 uInt uiNumFeedTemp = oParamErrCell0.shape()[0];
2224 - Vector<String>* poFeed = new Vector<String>( uiNumFeedTemp, "" );
2199 + Vector<String> feed( uiNumFeedTemp, "" );
2225 2200
2226 2201 if ( uiNumFeedTemp == 1 ) {
2227 - poFeed->operator[](0) = "S";
2202 + feed[0] = "S";
2228 2203 } else {
2229 2204 if ( polBasisGet(oTableName) == "L" ) {
2230 - poFeed->operator[](0) = "X";
2231 - poFeed->operator[](1) = "Y";
2205 + feed[0] = "X";
2206 + feed[1] = "Y";
2232 2207 } else if ( polBasisGet(oTableName) == "R" ) {
2233 - poFeed->operator[](0) = "R";
2234 - poFeed->operator[](1) = "L";
2208 + feed[0] = "R";
2209 + feed[1] = "L";
2235 2210 } else {
2236 - poFeed->operator[](0) = "1";
2237 - poFeed->operator[](1) = "2";
2211 + feed[0] = "1";
2212 + feed[1] = "2";
2238 2213 }
2239 2214 }
2240 2215
2241 2216
2242 2217 // Return the feeds
2243 2218
2244 - return( *poFeed );
2219 + return feed;
2245 2220
2246 2221 }
2247 2222
2248 2223 // -----------------------------------------------------------------------------
2249 2224
2250 2225 /*
2251 2226
2252 2227 CalAnalysis::feedSet
2253 2228
2254 2229 Description:
2296 2271
2297 2272 Inputs:
2298 2273 -------
2299 2274 oFeedIn - This reference to a Vector<String> instance contains the feeds ("R"
2300 2275 and "L" for circular, "X" and "Y" for linear).
2301 2276
2302 2277 Outputs:
2303 2278 --------
2304 2279 oFeedOut - This reference to the Vector<String> instance contains the checked
2305 2280 and fixed feeds.
2306 -The reference to the Bool variable containing the check boolean, returned via
2281 +The Bool variable containing the check boolean, returned via
2307 2282 the function value.
2308 2283
2309 2284 Modification history:
2310 2285 ---------------------
2311 2286 2012 Jan 20 - Nick Elias, NRAO
2312 2287 Initial version.
2313 2288 2012 Mar 13 - Nick Elias, NRAO
2314 2289 Now checking for null.
2315 2290
2316 2291 */
2317 2292
2318 2293 // -----------------------------------------------------------------------------
2319 2294
2320 -Bool& CalAnalysis::feedCheck( const Vector<String>& oFeedIn,
2295 +Bool CalAnalysis::feedCheck( const Vector<String>& oFeedIn,
2321 2296 Vector<String>& oFeedOut ) const {
2322 2297
2323 2298 // Declare the success boolean
2324 2299
2325 - Bool* poSuccess = new Bool( false );
2300 + Bool success( false );
2326 2301
2327 2302
2328 2303 // Check the input feed values
2329 2304
2330 2305 if ( oFeedIn.nelements() == 0 ) {
2331 - *poSuccess = false;
2332 - return( *poSuccess );
2306 + success = false;
2307 + return success;
2333 2308 }
2334 2309
2335 2310 uInt uiNumFeedOut = 0;
2336 2311 oFeedOut.resize();
2337 2312
2338 2313 for ( uInt f=0; f<oFeedIn.nelements(); f++ ) {
2339 2314 if ( exists<String>( oFeedIn[f], oFeed ) ) {
2340 2315 uiNumFeedOut += 1;
2341 2316 oFeedOut.resize( uiNumFeedOut, true );
2342 2317 oFeedOut[uiNumFeedOut-1] = oFeedIn[f];
2343 2318 }
2344 2319 }
2345 2320
2346 2321 if ( uiNumFeedOut == 0 ) {
2347 - *poSuccess = false;
2348 - return( *poSuccess );
2322 + success = false;
2323 + return success;
2349 2324 }
2350 2325
2351 2326
2352 2327 // Get the unique feed vector
2353 2328
2354 2329 oFeedOut.resize();
2355 - oFeedOut = unique<String>( oFeedIn );
2330 + unique<String>( oFeedIn, oFeedOut );
2356 2331
2357 2332 if ( oFeedOut.nelements() > 2 ) {
2358 - *poSuccess = false;
2359 - return( *poSuccess );
2333 + success = false;
2334 + return success;
2360 2335 }
2361 2336
2362 2337 if ( oFeedOut.nelements() == 1 ) {
2363 2338 if ( oFeedOut[0] != "R" && oFeedOut[0] != "L" &&
2364 2339 oFeedOut[0] != "X" && oFeedOut[0] != "Y" &&
2365 2340 oFeedOut[0] != "1" && oFeedOut[0] != "2" && oFeedOut[0] != "S" ) {
2366 - *poSuccess = false;
2367 - return( *poSuccess );
2341 + success = false;
2342 + return success;
2368 2343 }
2369 2344 }
2370 2345
2371 2346 if ( oFeedOut.nelements() == 2 ) {
2372 2347
2373 2348 if ( oFeedOut[0] != "R" && oFeedOut[0] != "L" &&
2374 2349 oFeedOut[0] != "X" && oFeedOut[0] != "Y" &&
2375 2350 oFeedOut[0] != "1" && oFeedOut[0] != "2" ) {
2376 - *poSuccess = false;
2377 - return( *poSuccess );
2351 + success = false;
2352 + return success;
2378 2353 }
2379 2354
2380 2355 if ( oFeedOut[1] != "R" && oFeedOut[1] != "L" &&
2381 2356 oFeedOut[1] != "X" && oFeedOut[1] != "Y" &&
2382 2357 oFeedOut[1] != "1" && oFeedOut[1] != "2" ) {
2383 - *poSuccess = false;
2384 - return( *poSuccess );
2358 + success = false;
2359 + return success;
2385 2360 }
2386 2361
2387 2362 if ( oFeedOut[0] == "L" && oFeedOut[1] == "R" ) {
2388 2363 oFeedOut[0] = "R";
2389 2364 oFeedOut[1] = "L";
2390 2365 }
2391 2366
2392 2367 if ( oFeedOut[0] == "Y" && oFeedOut[1] == "X" ) {
2393 2368 oFeedOut[0] = "X";
2394 2369 oFeedOut[1] = "Y";
2397 2372 if ( oFeedOut[0] == "2" && oFeedOut[1] == "1" ) {
2398 2373 oFeedOut[0] = "1";
2399 2374 oFeedOut[1] = "2";
2400 2375 }
2401 2376
2402 2377 }
2403 2378
2404 2379
2405 2380 // Return true
2406 2381
2407 - *poSuccess = true;
2382 + success = true;
2408 2383
2409 - return( *poSuccess );
2384 + return success;
2410 2385
2411 2386 }
2412 2387
2413 2388 // -----------------------------------------------------------------------------
2414 2389
2415 2390 /*
2416 2391
2417 2392 CalAnalysis::spwInfoGet
2418 2393
2419 2394 Description:
2502 2477
2503 2478 Inputs:
2504 2479 -------
2505 2480 oInputIn - This reference to an INPUT instance contains the inputs to the
2506 2481 CalAnalysis::stats<T>() member function.
2507 2482
2508 2483 Outputs:
2509 2484 --------
2510 2485 oInputOut - This reference to an INPUT instance contains the checked and fixed
2511 2486 inputs to the CalAnalysis::stats<T>() member function.
2512 -The reference to the Bool variable containing the check boolean, returned via
2487 +The Bool variable containing the check boolean, returned via
2513 2488 the function value.
2514 2489
2515 2490 Modification history:
2516 2491 ---------------------
2517 2492 2012 Apr 27 - Nick Elias, NRAO
2518 2493 Initial version.
2519 2494
2520 2495 */
2521 2496
2522 2497 // -----------------------------------------------------------------------------
2523 2498
2524 -Bool& CalAnalysis::statsCheckInput( const CalAnalysis::INPUT& oInputIn,
2499 +Bool CalAnalysis::statsCheckInput( const CalAnalysis::INPUT& oInputIn,
2525 2500 CalAnalysis::INPUT& oInputOut ) {
2526 2501
2527 2502 // Declare the success boolean
2528 2503
2529 - Bool* poSuccess = new Bool( false );
2504 + Bool success( false );
2530 2505
2531 2506
2532 2507 // Check the fields and create a new field vector
2533 2508
2534 2509 if ( !fieldCheck( oInputIn.oField, oInputOut.oField ) ) {
2535 2510 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput()", WHERE ) );
2536 2511 log << LogIO::WARN << "One or more invalid fields" << LogIO::POST;
2537 - *poSuccess = false;
2538 - return( *poSuccess );
2512 + success = false;
2513 + return success;
2539 2514 }
2540 2515
2541 2516
2542 2517 // Check the antennas and create the new antenna vectors
2543 2518
2544 2519 if ( !antenna1Check( oInputIn.oAntenna1, oInputOut.oAntenna1 ) ) {
2545 2520 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput()", WHERE ) );
2546 2521 log << LogIO::WARN << "One or more invalid antenna 1" << LogIO::POST;
2547 - *poSuccess = false;
2548 - return( *poSuccess );
2522 + success = false;
2523 + return success;
2549 2524 }
2550 2525
2551 2526 if ( !antenna2Check( oInputIn.oAntenna2, oInputOut.oAntenna2 ) ) {
2552 2527 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2553 2528 log << LogIO::WARN << "One or more invalid antenna 2" << LogIO::POST;
2554 - *poSuccess = false;
2555 - return( *poSuccess );
2529 + success = false;
2530 + return success;
2556 2531 }
2557 2532
2558 2533
2559 2534 // Check the time range and create the corresponding time vector
2560 2535
2561 2536 Bool bTimeCheck = timeCheck( oInputIn.dStartTime, oInputIn.dStopTime,
2562 2537 oInputOut.dStartTime, oInputOut.dStopTime, oInputOut.oTime );
2563 2538
2564 2539 if ( !bTimeCheck ) {
2565 2540 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2566 2541 log << LogIO::WARN << "Invalid start and/or stop times" << LogIO::POST;
2567 - *poSuccess = false;
2568 - return( *poSuccess );
2542 + success = false;
2543 + return success;
2569 2544 }
2570 2545
2571 2546
2572 2547 // Check the feeds and create the new feed vector
2573 2548
2574 2549 if ( !feedCheck( oInputIn.oFeed, oInputOut.oFeed ) ) {
2575 2550 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2576 2551 log << LogIO::WARN << "Invalid feed(s)" << LogIO::POST;
2577 - *poSuccess = false;
2578 - return( *poSuccess );
2552 + success = false;
2553 + return success;
2579 2554 }
2580 2555
2581 2556
2582 2557 // Check the spectral window info and create the frequency vector
2583 2558
2584 2559 Vector<uInt> oSPWOld( oInputIn.oSPW );
2585 2560 Vector<Vector<uInt> > oChannelOld( oInputIn.oChannel );
2586 2561
2587 2562 Vector<uInt> oSPWNew;
2588 2563 Vector<Vector<uInt> > oChannelNew;
2589 2564
2590 2565 Bool bSPWCheck = oSPWInfo.spwInfoCheck( oInputIn.oSPW, oInputIn.oChannel,
2591 2566 oInputOut.oSPW, oInputOut.oChannel );
2592 2567
2593 2568 if ( !bSPWCheck ) {
2594 2569 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2595 2570 log << LogIO::WARN << "Invalid spectral window information" << LogIO::POST;
2596 - *poSuccess = false;
2597 - return( *poSuccess );
2571 + success = false;
2572 + return success;
2598 2573 }
2599 2574
2600 2575
2601 2576 // Check the user-defined iteration axis
2602 2577
2603 2578 if ( oInputIn.eAxisIterUserID != CalStats::FREQUENCY &&
2604 2579 oInputIn.eAxisIterUserID != CalStats::TIME ) {
2605 2580 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2606 2581 log << LogIO::WARN << "User-defined iteration axis must be frequency/time"
2607 2582 << LogIO::POST;
2608 - *poSuccess = false;
2609 - return( *poSuccess );
2583 + success = false;
2584 + return success;
2610 2585 }
2611 2586
2612 2587 oInputOut.eAxisIterUserID = oInputIn.eAxisIterUserID;
2613 2588
2614 2589
2615 2590 // Check the RAP (real, amplitude, phase) parameter
2616 2591
2617 2592 if ( oInputIn.eRAP != CalAnalysis::REAL &&
2618 2593 oInputIn.eRAP != CalAnalysis::AMPLITUDE &&
2619 2594 oInputIn.eRAP != CalAnalysis::PHASE ) {
2620 2595 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2621 2596 log << LogIO::WARN << "Invalid RAP parameter" << LogIO::POST;
2622 - *poSuccess = false;
2623 - return( *poSuccess );
2597 + success = false;
2598 + return success;
2624 2599 }
2625 2600
2626 2601 oInputOut.eRAP = oInputIn.eRAP;
2627 2602
2628 2603
2629 2604 // Set the normalization and unwrap booleans
2630 2605
2631 2606 oInputOut.bNorm = oInputIn.bNorm;
2632 2607
2633 2608 oInputOut.bUnwrap = oInputIn.bUnwrap;
2634 2609
2635 2610
2636 2611 // Check the maximum phase jump parameter
2637 2612
2638 2613 if ( oInputIn.dJumpMax < 0.0 ) {
2639 2614 LogIO log( LogOrigin( "CalAnalysis", "statsCheckInput<T>()", WHERE ) );
2640 2615 log << LogIO::WARN << "Invalid maximum jump parameter" << LogIO::POST;
2641 - *poSuccess = false;
2642 - return( *poSuccess );
2616 + success = false;
2617 + return success;
2643 2618 }
2644 2619
2645 2620 oInputOut.dJumpMax = oInputIn.dJumpMax;
2646 2621
2647 2622
2648 2623 // Return true
2649 2624
2650 - *poSuccess = true;
2625 + success = true;
2651 2626
2652 - return( *poSuccess );
2627 + return success;
2653 2628
2654 2629 }
2655 2630
2656 2631 // -----------------------------------------------------------------------------
2657 2632
2658 2633 /*
2659 2634
2660 2635 CalAnalysis::getGroup
2661 2636
2662 2637 Description:
2703 2678 --------
2704 2679 oCParamGroup - This Vector<Cube<DComplex> > instance contains the complex
2705 2680 parameters. This instance is empty for new format calibration
2706 2681 tables with real parameters.
2707 2682 oFParamGroup - This Vector<Cube<Double> > instance contains the real
2708 2683 parameters. This instance is empty for new format calibration
2709 2684 tables with complex parameters.
2710 2685 oParamErrGroup - This Vector<Cube<Double> > instance contains the parameter
2711 2686 errors.
2712 2687 oFlagGroup - This Vector<Cube<Bool> > instance contains the flags.
2713 -The reference to the Bool variable containing the check boolean, returned via
2688 +The Bool variable containing the check boolean, returned via
2714 2689 the function value.
2715 2690
2716 2691 Modification history:
2717 2692 ---------------------
2718 2693 2012 May 06 - Nick Elias, NRAO
2719 2694 Initial version.
2720 2695
2721 2696 */
2722 2697
2723 2698 // -----------------------------------------------------------------------------
2724 2699
2725 -Bool& CalAnalysis::getGroup( const NewCalTable& oNCT,
2700 +Bool CalAnalysis::getGroup( const NewCalTable& oNCT,
2726 2701 const CalAnalysis::INPUT& oInput, Vector<uInt>& oFieldGroup,
2727 2702 Vector<uInt>& oAntenna1Group, Vector<Int>& oAntenna2Group,
2728 2703 Vector<Vector<Double> >& oTimeUniqueGroup,
2729 2704 Vector<Vector<Double> >& oFreqGroup, Vector<Cube<DComplex> >& oCParamGroup,
2730 2705 Vector<Cube<Double> >& oFParamGroup, Vector<Cube<Double> >& oParamErrGroup,
2731 2706 Vector<Cube<Bool> >& oFlagGroup ) const {
2732 2707
2733 2708 // Declare the success boolean
2734 2709
2735 - Bool* poSuccess = new Bool( false );
2710 + Bool success( false );
2736 2711
2737 2712
2738 2713 // Get the selected rows
2739 2714
2740 2715 Vector<uInt> oRowSelect;
2741 2716
2742 2717 if ( !rowSelect( oNCT, oInput, oRowSelect ) ) {
2743 2718 LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
2744 2719 log << LogIO::WARN << "No matching rows selected" << LogIO::POST;
2745 - *poSuccess = false;
2746 - return( *poSuccess );
2720 + success = false;
2721 + return success;
2747 2722 }
2748 2723
2749 2724
2750 2725 // Group the selected rows according to unique combinations of field, antenna
2751 2726 // 1, and antenna 2
2752 2727
2753 2728 Vector<Vector<uInt> > oRowGroup;
2754 2729
2755 2730 Vector<Vector<uInt> > oSPWGroup;
2756 2731 Vector<Vector<uInt> > oSPWUniqueGroup;
2757 2732
2758 2733 Vector<Vector<Double> > oTimeGroup;
2759 2734
2760 2735 Bool bRowGroup = rowGroup( oNCT, oRowSelect, oRowGroup, oFieldGroup,
2761 2736 oAntenna1Group, oAntenna2Group, oSPWGroup, oSPWUniqueGroup, oTimeGroup,
2762 2737 oTimeUniqueGroup );
2763 2738
2764 2739 if ( !bRowGroup ) {
2765 2740 LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
2766 2741 log << LogIO::WARN << "Cannot group the data" << LogIO::POST;
2767 - *poSuccess = false;
2768 - return( *poSuccess );
2742 + success = false;
2743 + return success;
2769 2744 }
2770 2745
2771 2746
2772 2747 // Get the frequency vector, start channel vector, and relative channel vector
2773 2748 // for each group
2774 2749
2775 2750 Bool bFreqGroup = freqGroup( oInput, oSPWUniqueGroup, oFreqGroup );
2776 2751
2777 2752 if ( !bFreqGroup ) {
2778 2753 LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
2779 2754 log << LogIO::WARN << "Cannot group frequencies" << LogIO::POST;
2780 - *poSuccess = false;
2781 - return( *poSuccess );
2755 + success = false;
2756 + return success;
2782 2757 }
2783 2758
2784 2759
2785 2760 // Get the cubes for each group
2786 2761
2787 2762 Bool bCubeGroup = cubeGroup( oNCT, oInput, oRowGroup, oSPWGroup,
2788 2763 oSPWUniqueGroup, oTimeGroup, oTimeUniqueGroup, oFreqGroup, oCParamGroup,
2789 2764 oFParamGroup, oParamErrGroup, oFlagGroup );
2790 2765
2791 2766 if ( !bCubeGroup ) {
2792 2767 LogIO log( LogOrigin( "CalAnalysis", "getGroup()", WHERE ) );
2793 2768 log << LogIO::WARN << "Cannot group cubes" << LogIO::POST;
2794 - *poSuccess = false;
2795 - return( *poSuccess );
2769 + success = false;
2770 + return success;
2796 2771 }
2797 2772
2798 2773
2799 2774 // Return true
2800 2775
2801 - *poSuccess = true;
2776 + success = true;
2802 2777
2803 - return( *poSuccess );
2778 + return success;
2804 2779
2805 2780 }
2806 2781
2807 2782 // -----------------------------------------------------------------------------
2808 2783
2809 2784 /*
2810 2785
2811 2786 CalAnalysis::rowSelect
2812 2787
2813 2788 Description:
2816 2791
2817 2792 Inputs:
2818 2793 -------
2819 2794 oNCT - This NewCalTable instance contains the new format calibration table.
2820 2795 oInput - This INPUT instance contains the input selections.
2821 2796
2822 2797 Outputs:
2823 2798 --------
2824 2799 oRowSelect - This Vector<uInt> instance contains the row numbers selected by the
2825 2800 inputs.
2826 -The reference to the Bool variable containing the check boolean, returned via
2801 +The Bool variable containing the check boolean, returned via
2827 2802 the function value.
2828 2803
2829 2804 Modification history:
2830 2805 ---------------------
2831 2806 2012 May 06 - Nick Elias, NRAO
2832 2807 Initial version.
2833 2808
2834 2809 */
2835 2810
2836 2811 // -----------------------------------------------------------------------------
2837 2812
2838 -Bool& CalAnalysis::rowSelect( const NewCalTable& oNCT,
2813 +Bool CalAnalysis::rowSelect( const NewCalTable& oNCT,
2839 2814 const CalAnalysis::INPUT& oInput, Vector<uInt>& oRowSelect ) const {
2840 2815
2841 2816 // Declare the success boolean
2842 2817
2843 - Bool* poSuccess = new Bool( false );
2818 + Bool success( false );
2844 2819
2845 2820
2846 2821 // Create the column accessors
2847 2822
2848 2823 ScalarColumn<Int> oFieldCol( oNCT, String("FIELD_ID") );
2849 2824 ScalarColumn<Int> oAntenna1Col( oNCT, String("ANTENNA1") );
2850 2825 ScalarColumn<Int> oAntenna2Col( oNCT, String("ANTENNA2") );
2851 2826 ScalarColumn<Int> oSPWCol( oNCT, String("SPECTRAL_WINDOW_ID") );
2852 2827 ScalarColumn<Double> oTimeCol( oNCT, String("TIME") );
2853 2828
2884 2859 // Record the selected row
2885 2860 oRowSelect.resize( ++uiNumRowSelect, true );
2886 2861 oRowSelect[uiNumRowSelect-1] = r;
2887 2862
2888 2863 }
2889 2864
2890 2865
2891 2866 // Were any rows found? It not, return false
2892 2867
2893 2868 if ( uiNumRowSelect == 0 ) {
2894 - *poSuccess = false;
2895 - return( *poSuccess );
2869 + success = false;
2870 + return success;
2896 2871 }
2897 2872
2898 2873
2899 2874 // Return true
2900 2875
2901 - *poSuccess = true;
2876 + success = true;
2902 2877
2903 - return( *poSuccess );
2878 + return success;
2904 2879
2905 2880 }
2906 2881
2907 2882 // -----------------------------------------------------------------------------
2908 2883
2909 2884 /*
2910 2885
2911 2886 CalAnalysis::rowGroup
2912 2887
2913 2888 Description:
2934 2909 oAntenna2Group - This Vector<Int> instance contains the antenna 2 for each
2935 2910 group.
2936 2911 oSPWGroup - This Vector<Vector<uInt> > instance contains the spectral
2937 2912 windows for each group.
2938 2913 oSPWUniqueGroup - This Vector<Vector<uInt> > instance contains the unique
2939 2914 spectral windows for each group.
2940 2915 oTimeGroup - This Vector<Vector<Double> > instance contains the times for
2941 2916 each group.
2942 2917 oTimeUniqueGroup - This Vector<Vector<Double> > instance contains the unique
2943 2918 times for each group.
2944 -The reference to the Bool variable containing the check boolean, returned via
2919 +The Bool variable containing the check boolean, returned via
2945 2920 the function value.
2946 2921
2947 2922 Modification history:
2948 2923 ---------------------
2949 2924 2012 May 06 - Nick Elias, NRAO
2950 2925 Initial version.
2951 2926
2952 2927 */
2953 2928
2954 2929 // -----------------------------------------------------------------------------
2955 2930
2956 -Bool& CalAnalysis::rowGroup( const NewCalTable& oNCT,
2931 +Bool CalAnalysis::rowGroup( const NewCalTable& oNCT,
2957 2932 const Vector<uInt>& oRowSelect, Vector<Vector<uInt> >& oRowGroup,
2958 2933 Vector<uInt>& oFieldGroup, Vector<uInt>& oAntenna1Group,
2959 2934 Vector<Int>& oAntenna2Group, Vector<Vector<uInt> >& oSPWGroup,
2960 2935 Vector<Vector<uInt> >& oSPWUniqueGroup, Vector<Vector<Double> >& oTimeGroup,
2961 2936 Vector<Vector<Double> >& oTimeUniqueGroup ) const {
2962 2937
2963 2938 // Declare the success boolean
2964 2939
2965 - Bool* poSuccess = new Bool( false );
2940 + Bool success( false );
2966 2941
2967 2942
2968 2943 // If there are no rows, return false
2969 2944
2970 2945 uInt uiNumRow = oRowSelect.nelements();
2971 2946
2972 2947 if ( uiNumRow == 0 ) {
2973 - *poSuccess = false;
2974 - return( *poSuccess );
2948 + success = false;
2949 + return success;
2975 2950 }
2976 2951
2977 2952
2978 2953 // Create the column accessors
2979 2954
2980 2955 ScalarColumn<Int> oFieldCol( oNCT, String("FIELD_ID") );
2981 2956 ScalarColumn<Int> oAntenna1Col( oNCT, String("ANTENNA1") );
2982 2957 ScalarColumn<Int> oAntenna2Col( oNCT, String("ANTENNA2") );
2983 2958 ScalarColumn<Int> oSPWCol( oNCT, String("SPECTRAL_WINDOW_ID") );
2984 2959 ScalarColumn<Double> oTimeCol( oNCT, String("TIME") );
3079 3054 }
3080 3055
3081 3056
3082 3057 // Create the unique sorted spectral window and time vectors for each group
3083 3058
3084 3059 oSPWUniqueGroup.resize( uiNumGroup, false );
3085 3060 oTimeUniqueGroup.resize( uiNumGroup, false );
3086 3061
3087 3062 for ( uInt g=0; g<uiNumGroup; g++ ) {
3088 3063 oSPWUniqueGroup[g].resize();
3089 - oSPWUniqueGroup[g] = unique<uInt>( oSPWGroup[g] );
3064 + unique<uInt>( oSPWGroup[g], oSPWUniqueGroup[g] );
3090 3065 oTimeUniqueGroup[g].resize();
3091 - oTimeUniqueGroup[g] = unique<Double>( oTimeGroup[g] );
3066 + unique<Double>( oTimeGroup[g], oTimeUniqueGroup[g] );
3092 3067 }
3093 3068
3094 3069
3095 3070 // Return true
3096 3071
3097 - *poSuccess = true;
3072 + success = true;
3098 3073
3099 - return( *poSuccess );
3074 + return success;
3100 3075
3101 3076 }
3102 3077
3103 3078 // -----------------------------------------------------------------------------
3104 3079
3105 3080 /*
3106 3081
3107 3082 CalAnalysis::chanSPW
3108 3083
3109 3084 Description:
3117 3092 Inputs:
3118 3093 -------
3119 3094 oSPW - This Vector<uInt> instance contains the unique and sorted spectral
3120 3095 windows.
3121 3096 oInput - This INPUT instance contains the input selections.
3122 3097
3123 3098 Outputs:
3124 3099 --------
3125 3100 oSPWMap - This Vector<uInt> instance contains the mapped spectral windows.
3126 3101 oChanStart - This Vector<uInt> instance contains the start channels.
3127 -The reference to the Bool variable containing the check boolean, returned via
3102 +The Bool variable containing the check boolean, returned via
3128 3103 the function value.
3129 3104
3130 3105 Modification history:
3131 3106 ---------------------
3132 3107 2012 May 06 - Nick Elias, NRAO
3133 3108 Initial version.
3134 3109
3135 3110 */
3136 3111
3137 3112 // -----------------------------------------------------------------------------
3138 3113
3139 -Bool& CalAnalysis::chanSPW( const Vector<uInt>& oSPW, const INPUT& oInput,
3114 +Bool CalAnalysis::chanSPW( const Vector<uInt>& oSPW, const INPUT& oInput,
3140 3115 Vector<uInt>& oSPWMap, Vector<uInt>& oChanStart ) const {
3141 3116
3142 3117 // Declare the success boolean
3143 3118
3144 - Bool* poSuccess = new Bool( false );
3119 + Bool success( false );
3145 3120
3146 3121
3147 3122 // Initialize the number of spectral windows, the spectral window map and
3148 3123 // start instances
3149 3124
3150 3125 uInt uiNumSPW = oSPW.nelements();
3151 3126
3152 3127 oSPWMap.resize( uiNumSPW, false );
3153 3128 oChanStart.resize( uiNumSPW, false );
3154 3129
3155 3130
3156 3131 // Load the spectral window map
3157 3132
3158 3133 for ( uInt s=0; s<uiNumSPW; s++ ) {
3159 3134 if ( !where( oSPW[s], oInput.oSPW, oSPWMap[s] ) ) {
3160 - *poSuccess = false;
3161 - return( *poSuccess );
3135 + success = false;
3136 + return success;
3162 3137 }
3163 3138 }
3164 3139
3165 3140
3166 3141 // Load the start channels
3167 3142
3168 3143 oChanStart[0] = 0;
3169 3144 for ( uInt s=1; s<uiNumSPW; s++ ) {
3170 3145 oChanStart[s] = oChanStart[s-1];
3171 3146 oChanStart[s] += oInput.oChannel[oSPWMap[s-1]].nelements();
3172 3147 }
3173 3148
3174 3149
3175 3150 // Return true
3176 3151
3177 - *poSuccess = true;
3152 + success = true;
3178 3153
3179 - return( *poSuccess );
3154 + return success;
3180 3155
3181 3156 }
3182 3157
3183 3158 // -----------------------------------------------------------------------------
3184 3159
3185 3160 /*
3186 3161
3187 3162 CalAnalysis::freqGroup
3188 3163
3189 3164 Description:
3195 3170 -------
3196 3171 oInput - This INPUT instance contains the input selections.
3197 3172 oSPWUniqueGroup - This Vector<Vector<uInt> > instance contains the unique
3198 3173 spectral windows for each group.
3199 3174
3200 3175 Outputs:
3201 3176 --------
3202 3177 oFreqGroup - This Vector<Vector<Double> >instance contains the frequencies (for
3203 3178 each group. They can come from multiple spectral windows (which
3204 3179 are in different rows).
3205 -The reference to the Bool variable containing the success boolean, returned via
3180 +The Bool variable containing the success boolean, returned via
3206 3181 the function value.
3207 3182
3208 3183 Modification history:
3209 3184 ---------------------
3210 3185 2012 May 06 - Nick Elias, NRAO
3211 3186 Initial version.
3212 3187
3213 3188 */
3214 3189
3215 3190 // -----------------------------------------------------------------------------
3216 3191
3217 -Bool& CalAnalysis::freqGroup( const INPUT& oInput,
3192 +Bool CalAnalysis::freqGroup( const INPUT& oInput,
3218 3193 const Vector<Vector<uInt> >& oSPWUniqueGroup,
3219 3194 Vector<Vector<Double> >& oFreqGroup ) const {
3220 3195
3221 3196 // Declare the success boolean
3222 3197
3223 - Bool* poSuccess = new Bool( false );
3198 + Bool success = new Bool( false );
3224 3199
3225 3200
3226 3201 // Create the instance for the spectral window subtable of the new format
3227 3202 // calibration table and the accessor instance for the CHAN_FREQ column
3228 3203
3229 3204 Table oTableSPW( oCalName+String("/SPECTRAL_WINDOW"), Table::Old );
3230 3205
3231 3206 ArrayColumn<Double> oChanFreqCol( oTableSPW, String("CHAN_FREQ") );
3232 3207
3233 3208
3239 3214
3240 3215
3241 3216 // Load the output instances
3242 3217
3243 3218 for ( uInt g=0; g<uiNumGroup; g++ ) {
3244 3219
3245 3220 // Get the start channels for all spectral windows in the group
3246 3221 Vector<uInt> oSPWMap;
3247 3222 Vector<uInt> oChanStart;
3248 3223 if ( !chanSPW( oSPWUniqueGroup[g], oInput, oSPWMap, oChanStart ) ) {
3249 - *poSuccess = false;
3250 - return( *poSuccess );
3224 + success = false;
3225 + return success;
3251 3226 }
3252 3227
3253 3228 for ( uInt s=0; s<oSPWUniqueGroup[g].nelements(); s++ ) {
3254 3229
3255 3230 // Get the number of channels for the mapped spectral window
3256 3231 uInt uiNumChannelInput = oInput.oChannel[oSPWMap[s]].nelements();
3257 3232
3258 3233 // Resize the frequency vector for the group
3259 3234 oFreqGroup[g].resize( oChanStart[s]+uiNumChannelInput, true );
3260 3235
3269 3244 oFreqGroup[g][uiChanGroup] = oFreqTemp[uiChanTemp];
3270 3245 }
3271 3246
3272 3247 }
3273 3248
3274 3249 }
3275 3250
3276 3251
3277 3252 // Return true
3278 3253
3279 - *poSuccess = true;
3254 + success = true;
3280 3255
3281 - return( *poSuccess );
3256 + return success;
3282 3257
3283 3258 }
3284 3259
3285 3260 // -----------------------------------------------------------------------------
3286 3261
3287 3262 /*
3288 3263
3289 3264 CalAnalysis::cubeGroup
3290 3265
3291 3266 Description:
3316 3291 --------
3317 3292 oCParamGroup - This Vector<Cube<DComplex> > instance contains the complex
3318 3293 parameters. This instance is empty for new format calibration
3319 3294 tables with real parameters.
3320 3295 oFParamGroup - This Vector<Cube<Double> > instance contains the real
3321 3296 parameters. This instance is empty for new format calibration
3322 3297 tables with complex parameters.
3323 3298 oParamErrGroup - This Vector<Cube<Double> > instance contains the parameter
3324 3299 errors.
3325 3300 oFlagGroup - This Vector<Cube<Bool> > instance contains the flags.
3326 -The reference to the Bool variable containing the check boolean, returned via
3301 +The Bool variable containing the check boolean, returned via
3327 3302 the function value.
3328 3303
3329 3304 Modification history:
3330 3305 ---------------------
3331 3306 2012 May 06 - Nick Elias, NRAO
3332 3307 Initial version.
3333 3308
3334 3309 */
3335 3310
3336 3311 // -----------------------------------------------------------------------------
3337 3312
3338 -Bool& CalAnalysis::cubeGroup( const NewCalTable& oNCT, const INPUT& oInput,
3313 +Bool CalAnalysis::cubeGroup( const NewCalTable& oNCT, const INPUT& oInput,
3339 3314 const Vector<Vector<uInt> >& oRowGroup,
3340 3315 const Vector<Vector<uInt> >& oSPWGroup,
3341 3316 const Vector<Vector<uInt> >& oSPWUniqueGroup,
3342 3317 const Vector<Vector<Double> >& oTimeGroup,
3343 3318 const Vector<Vector<Double> >& oTimeUniqueGroup,
3344 3319 const Vector<Vector<Double> >& oFreqGroup,
3345 3320 Vector<Cube<DComplex> >& oCParamGroup, Vector<Cube<Double> >& oFParamGroup,
3346 3321 Vector<Cube<Double> >& oParamErrGroup,
3347 3322 Vector<Cube<Bool> >& oFlagGroup ) const {
3348 3323
3349 3324 // Declare the success boolean
3350 3325
3351 - Bool* poSuccess = new Bool( false );
3326 + Bool success( false );
3352 3327
3353 3328
3354 3329 // Create accessors for the CPARAM/FPARAM, PARAMERR, and FLAG columns
3355 3330
3356 3331 ArrayColumn<Complex>* poCParamCol = NULL;
3357 3332 ArrayColumn<Float>* poFParamCol = NULL;
3358 3333
3359 3334 if ( oParType == String("Complex") ) {
3360 3335 poCParamCol = new ArrayColumn<Complex>( oNCT, String("CPARAM") );
3361 3336 } else {
3378 3353
3379 3354
3380 3355 // Load the output instances for each group
3381 3356
3382 3357 for ( uInt g=0; g<uiNumGroup; g++ ) { // Loop over group
3383 3358
3384 3359 // Get the spectral window maps and start channels for the group
3385 3360 Vector<uInt> oSPWMap;
3386 3361 Vector<uInt> oChanStart;
3387 3362 if ( !chanSPW( oSPWUniqueGroup[g], oInput, oSPWMap, oChanStart ) ) {
3388 - *poSuccess = false;
3389 - return( *poSuccess );
3363 + success = false;
3364 + return success;
3390 3365 }
3391 3366
3392 3367 // Initialize the shape of the output instances for the group
3393 3368 uInt uiNumFreq = oFreqGroup[g].nelements();
3394 3369 uInt uiNumTimeUnique = oTimeUniqueGroup[g].nelements();
3395 3370 IPosition oShape( 3, uiNumFeed, uiNumFreq, uiNumTimeUnique );
3396 3371
3397 3372 // Allocate the output instances for the group
3398 3373 oCParamGroup[g].resize( oShape, false );
3399 3374 oFParamGroup[g].resize( oShape, false );
3433 3408 Array<Float> oParamErrCube( oParamErrCol(uiRow).shape(), 0.0 );
3434 3409 oParamErrCube = oParamErrCol( uiRow );
3435 3410
3436 3411 // Get the FLAG cell from the new format calibration table
3437 3412 Array<Bool> oFlagCube( oFlagCol(uiRow).shape(), false );
3438 3413 oFlagCube = oFlagCol( uiRow );
3439 3414
3440 3415 // Map the spectral window
3441 3416 uInt s = 0;
3442 3417 if ( !where( oSPWGroup[g][r], oSPWUniqueGroup[g], s ) ) {
3443 - *poSuccess = false;
3444 - return( *poSuccess );
3418 + success = false;
3419 + return success;
3445 3420 }
3446 3421
3447 3422 // Get the number of input channels and the channels for the mapped
3448 3423 // spectral window
3449 3424 uInt uiNumChannelC = oInput.oChannel[oSPWMap[s]].nelements();
3450 3425 Vector<uInt> oChannelC( oInput.oChannel[oSPWMap[s]] );
3451 3426
3452 3427 // Map the time
3453 3428 uInt t = 0;
3454 3429 if ( !where( oTimeGroup[g][r], oTimeUniqueGroup[g], t ) ) {
3455 - *poSuccess = false;
3456 - return( *poSuccess );
3430 + success = false;
3431 + return success;
3457 3432 }
3458 3433
3459 3434 // Map the cubes from the new format calibration tables to the output
3460 3435 // instances for each group
3461 3436 for ( uInt f=0; f<uiNumFeed; f++ ) { // Loop over feeds
3462 3437 for ( uInt c=0; c<uiNumChannelC; c++ ) { // Loop over channnels
3463 3438 IPosition oPosG( 3, f, oChanStart[s]+c, t );
3464 3439 IPosition oPosC( 2, f, oChannelC[c] );
3465 3440 oCParamGroup[g](oPosG) = (DComplex) oCParamCube(oPosC);
3466 3441 oFParamGroup[g](oPosG) = (Double) oFParamCube(oPosC);
3469 3444 }
3470 3445 }
3471 3446
3472 3447 }
3473 3448
3474 3449 }
3475 3450
3476 3451
3477 3452 // Return true
3478 3453
3479 - *poSuccess = true;
3454 + success = true;
3480 3455
3481 - return( *poSuccess );
3456 + return success;
3482 3457
3483 3458 }
3484 3459
3485 3460 // -----------------------------------------------------------------------------
3486 3461 // End of CalAnalysis private member functions
3487 3462 // -----------------------------------------------------------------------------
3488 3463
3489 3464 // -----------------------------------------------------------------------------
3490 3465 // Start of CalAnalysis protected member functions
3491 3466 // -----------------------------------------------------------------------------

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut