Commits

Revert "Merge pull request #1016 in CASA/casa from CAS-12527 to master"

This is causing trouble in the pipeline for some datasets, CAS-12542 This reverts commit aa6c71af4df8b325644ee0010bbedc0def505e5e, reversing changes made to e2433b6da484c8f0ccdd876198f1392e2bc85a6f.

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

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

Add shortcut