Changeset 2782
- Timestamp:
- 03/07/13 18:45:58 (12 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/ASTEDataset.cc
r2781 r2782 41 41 ASTEDataset::ASTEDataset( string name ) 42 42 : NRODataset( name ) 43 { 44 LogIO os( LogOrigin( "ASTEDataset", "ASTEDataset()", WHERE ) ) ; 45 46 // check endian 47 open() ; 48 fseek( fp_, 144, SEEK_SET ) ; 49 int tmp ; 50 if( fread( &tmp, 1, sizeof(int), fp_ ) != sizeof(int) ) { 51 os << LogIO::SEVERE << "Error while checking endian of the file. " << LogIO::POST ; 52 return ; 53 } 54 if ( ( 0 < tmp ) && ( tmp <= ASTE_ARYMAX ) ) { 55 same_ = true ; 56 os << LogIO::NORMAL << "same endian " << LogIO::POST ; 57 } 58 else { 59 same_ = false ; 60 os << LogIO::NORMAL << "different endian " << LogIO::POST ; 61 } 62 fseek( fp_, 0, SEEK_SET ) ; 63 64 // memory allocation 65 initialize() ; 66 } 43 {} 67 44 68 45 // destructor 69 46 ASTEDataset::~ASTEDataset() 70 { 71 } 47 {} 72 48 73 49 // data initialization 74 50 void ASTEDataset::initialize() 75 51 { 76 RX.resize( ASTE_ARYMAX ) ; 77 HPBW.resize( ASTE_ARYMAX ) ; 78 EFFA.resize( ASTE_ARYMAX ) ; 79 EFFB.resize( ASTE_ARYMAX ) ; 80 EFFL.resize( ASTE_ARYMAX ) ; 81 EFSS.resize( ASTE_ARYMAX ) ; 82 GAIN.resize( ASTE_ARYMAX ) ; 83 HORN.resize( ASTE_ARYMAX ) ; 84 POLTP.resize( ASTE_ARYMAX ) ; 85 POLDR.resize( ASTE_ARYMAX ) ; 86 POLAN.resize( ASTE_ARYMAX ) ; 87 DFRQ.resize( ASTE_ARYMAX ) ; 88 SIDBD.resize( ASTE_ARYMAX ) ; 89 REFN.resize( ASTE_ARYMAX ) ; 90 IPINT.resize( ASTE_ARYMAX ) ; 91 MULTN.resize( ASTE_ARYMAX ) ; 92 MLTSCF.resize( ASTE_ARYMAX ) ; 93 LAGWIND.resize( ASTE_ARYMAX ) ; 94 BEBW.resize( ASTE_ARYMAX ) ; 95 BERES.resize( ASTE_ARYMAX ) ; 96 CHWID.resize( ASTE_ARYMAX ) ; 97 ARRY.resize( ASTE_ARYMAX ) ; 98 NFCAL.resize( ASTE_ARYMAX ) ; 99 F0CAL.resize( ASTE_ARYMAX ) ; 100 FQCAL.resize( ASTE_ARYMAX ) ; 101 CHCAL.resize( ASTE_ARYMAX ) ; 102 CWCAL.resize( ASTE_ARYMAX ) ; 103 DSBFC.resize( ASTE_ARYMAX ) ; 104 105 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) { 106 FQCAL[i].resize( 10 ) ; 107 CHCAL[i].resize( 10 ) ; 108 CWCAL[i].resize( 10 ) ; 109 } 110 111 datasize_ += sizeof( char ) * ASTE_ARYMAX * 16 // RX 112 + sizeof( double ) * ASTE_ARYMAX * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN 113 + sizeof( char ) * ASTE_ARYMAX * 4 // HORN 114 + sizeof( char ) * ASTE_ARYMAX * 4 // POLTP 115 + sizeof( double ) * ASTE_ARYMAX * 3 // POLDR, POLAN, DFRQ 116 + sizeof( char ) * ASTE_ARYMAX * 4 // SIDBID 117 + sizeof( int ) * ASTE_ARYMAX * 3 // REFN, IPINT, MULTN 118 + sizeof( double ) * ASTE_ARYMAX // MLTSCF 119 + sizeof( char ) * ASTE_ARYMAX * 8 // LAGWIND 120 + sizeof( double ) * ASTE_ARYMAX * 3 // BEBW, BERES, CHWID 121 + sizeof( int ) * ASTE_ARYMAX * 2 // ARRY, NFCAL 122 + sizeof( double ) * ASTE_ARYMAX // F0CAL 123 + sizeof( double ) * ASTE_ARYMAX * 10 * 3 // FQCAL, CHCAL, CWCAL 52 int arymax = arrayMax() ; 53 54 // it must be called 55 NRODataset::initialize() ; 56 57 // additional initialization 58 datasize_ += sizeof( char ) * arymax * 16 // RX 59 + sizeof( double ) * arymax * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN 60 + sizeof( char ) * arymax * 4 // HORN 61 + sizeof( char ) * arymax * 4 // POLTP 62 + sizeof( double ) * arymax * 3 // POLDR, POLAN, DFRQ 63 + sizeof( char ) * arymax * 4 // SIDBID 64 + sizeof( int ) * arymax * 3 // REFN, IPINT, MULTN 65 + sizeof( double ) * arymax // MLTSCF 66 + sizeof( char ) * arymax * 8 // LAGWIND 67 + sizeof( double ) * arymax * 3 // BEBW, BERES, CHWID 68 + sizeof( int ) * arymax * 2 // ARRY, NFCAL 69 + sizeof( double ) * arymax // F0CAL 70 + sizeof( double ) * arymax * 10 * 3 // FQCAL, CHCAL, CWCAL 124 71 + sizeof( char ) * 116 // CDMY1 125 + sizeof( double ) * ASTE_ARYMAX ; // DSBFC 126 127 refFreq_.resize( ASTE_ARYMAX, 0.0 ) ; 128 } 129 130 // fill data header 131 int ASTEDataset::fillHeader() 132 { 133 LogIO os( LogOrigin( "ASTEDataset", "fillHeader()", WHERE ) ) ; 134 135 // open file 136 if ( open() ) { 137 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ; 138 return -1 ; 139 } 140 141 // fill 142 int status = fillHeader( same_ ) ; 143 144 return status ; 72 + sizeof( double ) * arymax ; // DSBFC 145 73 } 146 74 … … 148 76 { 149 77 LogIO os( LogOrigin( "ASTEDataset", "fillHeader()", WHERE ) ) ; 78 79 int arymax = arrayMax(); 150 80 151 81 string str4( 4, ' ' ) ; … … 521 451 //cout << "PA = " << PA << endl ; 522 452 // 523 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {453 for ( int i = 0 ; i < arymax ; i++ ) { 524 454 strcpy( c18, str18.c_str() ) ; 525 455 if ( readHeader( c18, 16 ) == -1 ) { … … 531 461 } 532 462 // DEBUG 533 // nro_debug_output( "RX", ASTE_ARYMAX, RX ) ;534 // 535 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {463 // nro_debug_output( "RX", arymax, RX ) ; 464 // 465 for ( int i = 0 ; i < arymax ; i++ ) { 536 466 if ( readHeader( HPBW[i], sameEndian ) == -1 ) { 537 467 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ; … … 540 470 } 541 471 // DEBUG 542 // nro_debug_output( "HPBW", ASTE_ARYMAX, HPBW ) ;543 // 544 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {472 // nro_debug_output( "HPBW", arymax, HPBW ) ; 473 // 474 for ( int i = 0 ; i < arymax ; i++ ) { 545 475 if ( readHeader( EFFA[i], sameEndian ) == -1 ) { 546 476 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ; … … 549 479 } 550 480 // DEBUG 551 // nro_debug_output( "EFFA", ASTE_ARYMAX, EFFA ) ;552 // 553 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {481 // nro_debug_output( "EFFA", arymax, EFFA ) ; 482 // 483 for ( int i = 0 ; i < arymax ; i++ ) { 554 484 if ( readHeader( EFFB[i], sameEndian ) == -1 ) { 555 485 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ; … … 558 488 } 559 489 // DEBUG 560 // nro_debug_output( "EFFB", ASTE_ARYMAX, EFFB ) ;561 // 562 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {490 // nro_debug_output( "EFFB", arymax, EFFB ) ; 491 // 492 for ( int i = 0 ; i < arymax ; i++ ) { 563 493 if ( readHeader( EFFL[i], sameEndian ) == -1 ) { 564 494 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ; … … 567 497 } 568 498 // DEBUG 569 // nro_debug_output( "EFFL", ASTE_ARYMAX, EFFL ) ;570 // 571 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {499 // nro_debug_output( "EFFL", arymax, EFFL ) ; 500 // 501 for ( int i = 0 ; i < arymax ; i++ ) { 572 502 if ( readHeader( EFSS[i], sameEndian ) == -1 ) { 573 503 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ; … … 576 506 } 577 507 // DEBUG 578 // nro_debug_output( "EFSS", ASTE_ARYMAX, EFSS ) ;579 // 580 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {508 // nro_debug_output( "EFSS", arymax, EFSS ) ; 509 // 510 for ( int i= 0 ; i < arymax ; i++) { 581 511 if ( readHeader( GAIN[i], sameEndian ) == -1 ) { 582 512 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ; … … 585 515 } 586 516 // DEBUG 587 // nro_debug_output( "GAIN", ASTE_ARYMAX, GAIN ) ;588 // 589 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {517 // nro_debug_output( "GAIN", arymax, GAIN ) ; 518 // 519 for ( int i= 0 ; i < arymax ; i++) { 590 520 strcpy( c4, str4.c_str() ) ; 591 521 if ( readHeader( c4, 4 ) == -1 ) { … … 596 526 } 597 527 // DEBUG 598 // nro_debug_output( "HORN", ASTE_ARYMAX, HORN ) ;599 // 600 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {528 // nro_debug_output( "HORN", arymax, HORN ) ; 529 // 530 for ( int i= 0 ; i < arymax ; i++) { 601 531 strcpy( c4, str4.c_str() ) ; 602 532 if ( readHeader( c4, 4 ) == -1 ) { … … 607 537 } 608 538 // DEBUG 609 // nro_debug_output( "POLTP", ASTE_ARYMAX, POLTP ) ;610 // 611 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {539 // nro_debug_output( "POLTP", arymax, POLTP ) ; 540 // 541 for ( int i= 0 ; i < arymax ; i++) { 612 542 if ( readHeader( POLDR[i], sameEndian ) == -1 ) { 613 543 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ; … … 616 546 } 617 547 // DEBUG 618 // nro_debug_output( "POLDR", ASTE_ARYMAX, POLDR ) ;619 // 620 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {548 // nro_debug_output( "POLDR", arymax, POLDR ) ; 549 // 550 for ( int i= 0 ; i < arymax ; i++) { 621 551 if ( readHeader( POLAN[i], sameEndian ) == -1 ) { 622 552 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ; … … 625 555 } 626 556 // DEBUG 627 // nro_debug_output( "POLAN", ASTE_ARYMAX, POLAN ) ;628 // 629 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {557 // nro_debug_output( "POLAN", arymax, POLAN ) ; 558 // 559 for ( int i= 0 ; i < arymax ; i++) { 630 560 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) { 631 561 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ; … … 634 564 } 635 565 // DEBUG 636 // nro_debug_output( "DFRQ", ASTE_ARYMAX, DFRQ ) ;637 // 638 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {566 // nro_debug_output( "DFRQ", arymax, DFRQ ) ; 567 // 568 for ( int i= 0 ; i < arymax ; i++) { 639 569 strcpy( c4, str4.c_str() ) ; 640 570 if ( readHeader( c4, 4 ) == -1 ) { … … 645 575 } 646 576 // DEBUG 647 // nro_debug_output( "SIDBD", ASTE_ARYMAX, SIDBD ) ;648 // 649 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {577 // nro_debug_output( "SIDBD", arymax, SIDBD ) ; 578 // 579 for ( int i= 0 ; i < arymax ; i++) { 650 580 if ( readHeader( REFN[i], sameEndian ) == -1 ) { 651 581 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ; … … 654 584 } 655 585 // DEBUG 656 // nro_debug_output( "REFN", ASTE_ARYMAX, REFN ) ;657 // 658 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {586 // nro_debug_output( "REFN", arymax, REFN ) ; 587 // 588 for ( int i= 0 ; i < arymax ; i++) { 659 589 if ( readHeader( IPINT[i], sameEndian ) == -1 ) { 660 590 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ; … … 663 593 } 664 594 // DEBUG 665 // nro_debug_output( "IPINT", ASTE_ARYMAX, IPINT ) ;666 // 667 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {595 // nro_debug_output( "IPINT", arymax, IPINT ) ; 596 // 597 for ( int i= 0 ; i < arymax ; i++) { 668 598 if ( readHeader( MULTN[i], sameEndian ) == -1 ) { 669 599 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ; … … 672 602 } 673 603 // DEBUG 674 // nro_debug_output( "MULTN", ASTE_ARYMAX, MULTN ) ;675 // 676 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {604 // nro_debug_output( "MULTN", arymax, MULTN ) ; 605 // 606 for ( int i= 0 ; i < arymax ; i++) { 677 607 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) { 678 608 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ; … … 681 611 } 682 612 // DEBUG 683 // nro_debug_output( "MLTSCF", ASTE_ARYMAX, MLTSCF ) ;684 // 685 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {613 // nro_debug_output( "MLTSCF", arymax, MLTSCF ) ; 614 // 615 for ( int i= 0 ; i < arymax ; i++) { 686 616 strcpy( c8, str8.c_str() ) ; 687 617 if ( readHeader( c8, 8 ) == -1 ) { … … 692 622 } 693 623 // DEBUG 694 // nro_debug_output( "LAGWIND", ASTE_ARYMAX, LAGWIND ) ;695 // 696 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {624 // nro_debug_output( "LAGWIND", arymax, LAGWIND ) ; 625 // 626 for ( int i= 0 ; i < arymax ; i++) { 697 627 if ( readHeader( BEBW[i], sameEndian ) == -1 ) { 698 628 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ; … … 701 631 } 702 632 // DEBUG 703 // nro_debug_output( "BEBW", ASTE_ARYMAX, BEBW ) ;704 // 705 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {633 // nro_debug_output( "BEBW", arymax, BEBW ) ; 634 // 635 for ( int i= 0 ; i < arymax ; i++) { 706 636 if ( readHeader( BERES[i], sameEndian ) == -1 ) { 707 637 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ; … … 710 640 } 711 641 // DEBUG 712 // nro_debug_output( "BERES", ASTE_ARYMAX, BERES ) ;713 // 714 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {642 // nro_debug_output( "BERES", arymax, BERES ) ; 643 // 644 for ( int i= 0 ; i < arymax ; i++) { 715 645 if ( readHeader( CHWID[i], sameEndian ) == -1 ) { 716 646 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ; … … 719 649 } 720 650 // DEBUG 721 // nro_debug_output( "CHWID", ASTE_ARYMAX, CHWID ) ;722 // 723 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {651 // nro_debug_output( "CHWID", arymax, CHWID ) ; 652 // 653 for ( int i= 0 ; i < arymax ; i++) { 724 654 if ( readHeader( ARRY[i], sameEndian ) == -1 ) { 725 655 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ; … … 728 658 } 729 659 // DEBUG 730 // nro_debug_output( "ARRY", ASTE_ARYMAX, ARRY ) ;731 // 732 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {660 // nro_debug_output( "ARRY", arymax, ARRY ) ; 661 // 662 for ( int i= 0 ; i < arymax ; i++) { 733 663 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) { 734 664 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ; … … 737 667 } 738 668 // DEBUG 739 // nro_debug_output( "NFCAL", ASTE_ARYMAX, NFCAL ) ;740 // 741 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {669 // nro_debug_output( "NFCAL", arymax, NFCAL ) ; 670 // 671 for ( int i= 0 ; i < arymax ; i++) { 742 672 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) { 743 673 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ; … … 746 676 } 747 677 // DEBUG 748 // nro_debug_output( "F0CAL", ASTE_ARYMAX, F0CAL ) ;749 // 750 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {678 // nro_debug_output( "F0CAL", arymax, F0CAL ) ; 679 // 680 for ( int i= 0 ; i < arymax ; i++) { 751 681 for ( int j = 0 ; j < 10 ; j++ ) { 752 682 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) { … … 757 687 } 758 688 // DEBUG 759 // nro_debug_output( "FQCAL", ASTE_ARYMAX, 10, FQCAL ) ;760 // 761 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {689 // nro_debug_output( "FQCAL", arymax, 10, FQCAL ) ; 690 // 691 for ( int i= 0 ; i < arymax ; i++) { 762 692 for ( int j = 0 ; j < 10 ; j++ ) { 763 693 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) { … … 768 698 } 769 699 // DEBUG 770 // nro_debug_output( "CHCAL", ASTE_ARYMAX, 10, CHCAL ) ;771 // 772 for ( int i= 0 ; i < ASTE_ARYMAX; i++) {700 // nro_debug_output( "CHCAL", arymax, 10, CHCAL ) ; 701 // 702 for ( int i= 0 ; i < arymax ; i++) { 773 703 for ( int j = 0 ; j < 10 ; j++ ) { 774 704 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) { … … 779 709 } 780 710 // DEBUG 781 // nro_debug_output( "CWCAL", ASTE_ARYMAX, 10, CWCAL ) ;711 // nro_debug_output( "CWCAL", arymax, 10, CWCAL ) ; 782 712 // 783 713 if ( readHeader( SCNLEN, sameEndian ) == -1 ) { … … 821 751 //cout << "CDMY1 = " << CDMY1 << endl ; 822 752 // 823 for ( int i = 0 ; i < ASTE_ARYMAX; i++ ) {753 for ( int i = 0 ; i < arymax ; i++ ) { 824 754 if ( readHeader( DSBFC[i], sameEndian ) == -1 ) { 825 755 os << LogIO::WARN << "Error while reading data DSBFC[" << i << "]." << LogIO::POST ; … … 828 758 } 829 759 // DEBUG 830 // nro_debug_output( "DSBFC", ASTE_ARYMAX, DSBFC ) ; 831 // 832 833 //scanNum_ = NSCAN + 1 ; // includes ZERO scan 834 scanLen_ = SCNLEN ; 835 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ; 836 scanNum_ = getScanNum(); 837 rowNum_ = scanNum_ * ARYNM ; 838 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ; 839 record_->LDATA = new char[dataLen_] ; 840 841 initArray(); 842 843 show() ; 760 // nro_debug_output( "DSBFC", arymax, DSBFC ) ; 761 // 844 762 845 763 return 0 ; -
trunk/external-alma/atnf/PKSIO/ASTEDataset.h
r2777 r2782 77 77 virtual void initialize() ; 78 78 79 // fill header from file80 virtual int fillHeader() ;81 82 79 protected: 83 80 // fill header information -
trunk/external-alma/atnf/PKSIO/ASTEFXDataset.cc
r2781 r2782 40 40 // constructor 41 41 ASTEFXDataset::ASTEFXDataset( string name ) 42 : NRODataset( name ) 43 { 44 LogIO os( LogOrigin( "ASTEFXDataset", "ASTEFXDataset()", WHERE ) ) ; 45 46 // check endian 47 open() ; 48 fseek( fp_, 144, SEEK_SET ) ; 49 int tmp ; 50 if( fread( &tmp, 1, sizeof(int), fp_ ) != sizeof(int) ) { 51 os << LogIO::SEVERE << "Error while checking endian of the file. " << LogIO::EXCEPTION ; 52 return ; 53 } 54 if ( ( 0 < tmp ) && ( tmp <= ASTE_ARYMAX_FX ) ) { 55 same_ = true ; 56 os << LogIO::NORMAL << "same endian " << LogIO::POST ; 57 } 58 else { 59 same_ = false ; 60 os << LogIO::NORMAL << "different endian " << LogIO::POST ; 61 } 62 fseek( fp_, 0, SEEK_SET ) ; 63 64 // memory allocation 65 initialize() ; 66 } 42 : ASTEDataset( name ) 43 {} 67 44 68 45 // destructor 69 46 ASTEFXDataset::~ASTEFXDataset() 70 { 71 } 47 {} 72 48 73 // data initialization74 void ASTEFXDataset::initialize()75 {76 RX.resize( ASTE_ARYMAX_FX ) ;77 HPBW.resize( ASTE_ARYMAX_FX ) ;78 EFFA.resize( ASTE_ARYMAX_FX ) ;79 EFFB.resize( ASTE_ARYMAX_FX ) ;80 EFFL.resize( ASTE_ARYMAX_FX ) ;81 EFSS.resize( ASTE_ARYMAX_FX ) ;82 GAIN.resize( ASTE_ARYMAX_FX ) ;83 HORN.resize( ASTE_ARYMAX_FX ) ;84 POLTP.resize( ASTE_ARYMAX_FX ) ;85 POLDR.resize( ASTE_ARYMAX_FX ) ;86 POLAN.resize( ASTE_ARYMAX_FX ) ;87 DFRQ.resize( ASTE_ARYMAX_FX ) ;88 SIDBD.resize( ASTE_ARYMAX_FX ) ;89 REFN.resize( ASTE_ARYMAX_FX ) ;90 IPINT.resize( ASTE_ARYMAX_FX ) ;91 MULTN.resize( ASTE_ARYMAX_FX ) ;92 MLTSCF.resize( ASTE_ARYMAX_FX ) ;93 LAGWIND.resize( ASTE_ARYMAX_FX ) ;94 BEBW.resize( ASTE_ARYMAX_FX ) ;95 BERES.resize( ASTE_ARYMAX_FX ) ;96 CHWID.resize( ASTE_ARYMAX_FX ) ;97 ARRY.resize( ASTE_ARYMAX_FX ) ;98 NFCAL.resize( ASTE_ARYMAX_FX ) ;99 F0CAL.resize( ASTE_ARYMAX_FX ) ;100 FQCAL.resize( ASTE_ARYMAX_FX ) ;101 CHCAL.resize( ASTE_ARYMAX_FX ) ;102 CWCAL.resize( ASTE_ARYMAX_FX ) ;103 DSBFC.resize( ASTE_ARYMAX_FX ) ;104 105 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {106 FQCAL[i].resize( 10 ) ;107 CHCAL[i].resize( 10 ) ;108 CWCAL[i].resize( 10 ) ;109 }110 111 datasize_ += sizeof( char ) * ASTE_ARYMAX_FX * 16 // RX112 + sizeof( double ) * ASTE_ARYMAX_FX * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN113 + sizeof( char ) * ASTE_ARYMAX_FX * 4 // HORN114 + sizeof( char ) * ASTE_ARYMAX_FX * 4 // POLTP115 + sizeof( double ) * ASTE_ARYMAX_FX * 3 // POLDR, POLAN, DFRQ116 + sizeof( char ) * ASTE_ARYMAX_FX * 4 // SIDBID117 + sizeof( int ) * ASTE_ARYMAX_FX * 3 // REFN, IPINT, MULTN118 + sizeof( double ) * ASTE_ARYMAX_FX // MLTSCF119 + sizeof( char ) * ASTE_ARYMAX_FX * 8 // LAGWIND120 + sizeof( double ) * ASTE_ARYMAX_FX * 3 // BEBW, BERES, CHWID121 + sizeof( int ) * ASTE_ARYMAX_FX * 2 // ARRY, NFCAL122 + sizeof( double ) * ASTE_ARYMAX_FX // F0CAL123 + sizeof( double ) * ASTE_ARYMAX_FX * 10 * 3 // FQCAL, CHCAL, CWCAL124 + sizeof( char ) * 116 // CDMY1125 + sizeof( double ) * ASTE_ARYMAX_FX ; // DSBFC126 127 refFreq_.resize( ASTE_ARYMAX_FX, 0.0 ) ;128 }129 130 // fill data header131 int ASTEFXDataset::fillHeader()132 {133 LogIO os( LogOrigin( "ASTEFXDataset", "fillHeader()", WHERE ) ) ;134 135 // open file136 if ( open() ) {137 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ;138 return -1 ;139 }140 141 // fill142 int status = fillHeader( same_ ) ;143 144 return status ;145 }146 147 int ASTEFXDataset::fillHeader( int sameEndian )148 {149 LogIO os( LogOrigin( "ASTEFXDataset", "fillHeader()", WHERE ) ) ;150 151 string str4( 4, ' ' ) ;152 string str8( 8, ' ' ) ;153 string str16( 16, ' ' ) ;154 string str18( 18, ' ' ) ;155 string str24( 24, ' ' ) ;156 string str40( 40, ' ' ) ;157 string str120( 120, ' ' ) ;158 char c4[4] ;159 char c8[8] ;160 char c16[16] ;161 char c18[18] ;162 char c24[24] ;163 char c40[40] ;164 char c120[120] ;165 // make sure file pointer points a beginning of the file166 fseek( fp_, 0, SEEK_SET ) ;167 168 // read data header169 strcpy( c8, str8.c_str() ) ;170 if ( readHeader( c8, 8 ) == -1 ) {171 os << LogIO::WARN << "Error while reading data LOFIL." << endl ;172 return -1 ;173 }174 LOFIL = string( c8 ) ;175 // DEBUG176 //cout << "LOFIL = " << LOFIL << endl ;177 //178 strcpy( c8, str8.c_str() ) ;179 if ( readHeader( c8, 8 ) == -1 ) {180 os << LogIO::WARN << "Error while reading data VER." << endl ;181 return -1 ;182 }183 VER = string( c8 ) ;184 // DEBUG185 //cout << "VER = " << VER << endl ;186 //187 strcpy( c16, str16.c_str() ) ;188 if ( readHeader( c16, 16 ) == -1 ) {189 os << LogIO::WARN << "Error while reading data GROUP." << endl ;190 return -1 ;191 }192 GROUP = string( c16 ) ;193 // DEBUG194 //cout << "GROUP = " << GROUP << endl ;195 //196 strcpy( c16, str16.c_str() ) ;197 if ( readHeader( c16, 16 ) == -1 ) {198 os << LogIO::WARN << "Error while reading data PROJ." << endl ;199 return -1 ;200 }201 PROJ = string( c16 ) ;202 // DEBUG203 //cout << "PROJ = " << PROJ << endl ;204 //205 strcpy( c24, str24.c_str() ) ;206 if ( readHeader( c24, 24 ) == -1 ) {207 os << LogIO::WARN << "Error while reading data SCHED." << endl ;208 return -1 ;209 }210 SCHED = string( c24 ) ;211 // DEBUG212 //cout << "SCHED = " << SCHED << endl ;213 //214 strcpy( c40, str40.c_str() ) ;215 if ( readHeader( c40, 40 ) == -1 ) {216 os << LogIO::WARN << "Error while reading data OBSVR." << endl ;217 return -1 ;218 }219 OBSVR = string( c40 ) ;220 // DEBUG221 //cout << "OBSVR = " << OBSVR << endl ;222 //223 strcpy( c16, str16.c_str() ) ;224 if ( readHeader( c16, 16 ) == -1 ) {225 os << LogIO::WARN << "Error while reading data LOSTM." << endl ;226 return -1 ;227 }228 LOSTM = string( c16 ) ;229 // DEBUG230 //cout << "LOSTM = " << LOSTM << endl ;231 //232 strcpy( c16, str16.c_str() ) ;233 if ( readHeader( c16, 16 ) == -1 ) {234 os << LogIO::WARN << "Error while reading data LOETM." << endl ;235 return -1 ;236 }237 LOETM = string( c16 ) ;238 // DEBUG239 //cout << "LOETM = " << LOETM << endl ;240 //241 if ( readHeader( ARYNM, sameEndian ) == -1 ) {242 os << LogIO::WARN << "Error while reading data ARYNM." << endl ;243 return -1 ;244 }245 // DEBUG246 //cout << "ARYNM = " << ARYNM << endl ;247 //248 if ( readHeader( NSCAN, sameEndian ) == -1 ) {249 os << LogIO::WARN << "Error while reading data NSCAN." << endl ;250 return -1 ;251 }252 // DEBUG253 //cout << "NSCAN = " << NSCAN << endl ;254 //255 strcpy( c120, str120.c_str() ) ;256 if ( readHeader( c120, 120 ) == -1 ) {257 os << LogIO::WARN << "Error while reading data TITLE." << endl ;258 return -1 ;259 }260 TITLE = string( c120 ) ;261 // DEBUG262 //cout << "TITLE = " << TITLE << endl ;263 //264 strcpy( c16, str16.c_str() ) ;265 if ( readHeader( c16, 16 ) == -1 ) {266 os << LogIO::WARN << "Error while reading data OBJ." << endl ;267 return -1 ;268 }269 OBJ = string( c16 ) ;270 // DEBUG271 //cout << "OBJ = " << OBJ << endl ;272 //273 strcpy( c8, str8.c_str() ) ;274 if ( readHeader( c8, 8 ) == -1 ) {275 os << LogIO::WARN << "Error while reading data EPOCH." << endl ;276 return -1 ;277 }278 EPOCH = string( c8 ) ;279 // DEBUG280 //cout << "EPOCH = " << EPOCH << endl ;281 //282 if ( readHeader( RA0, sameEndian ) == -1 ) {283 os << LogIO::WARN << "Error while reading data RA0." << endl ;284 return -1 ;285 }286 // DEBUG287 //cout << "RA0 = " << RA0 << endl ;288 //289 if ( readHeader( DEC0, sameEndian ) == -1 ) {290 os << LogIO::WARN << "Error while reading data DEC0." << endl ;291 return -1 ;292 }293 // DEBUG294 //cout << "DEC0 = " << DEC0 << endl ;295 //296 if ( readHeader( GLNG0, sameEndian ) == -1 ) {297 os << LogIO::WARN << "Error while reading data GLNG0." << endl ;298 return -1 ;299 }300 // DEBUG301 //cout << "GLNG0 = " << GLNG0 << endl ;302 //303 if ( readHeader( GLAT0, sameEndian ) == -1 ) {304 os << LogIO::WARN << "Error while reading data GLAT0." << endl ;305 return -1 ;306 }307 // DEBUG308 //cout << "GLAT0 = " << GLAT0 << endl ;309 //310 if ( readHeader( NCALB, sameEndian ) == -1 ) {311 os << LogIO::WARN << "Error while reading data NCALB." << endl ;312 return -1 ;313 }314 // DEBUG315 //cout << "NCALB = " << NCALB << endl ;316 //317 if ( readHeader( SCNCD, sameEndian ) == -1 ) {318 os << LogIO::WARN << "Error while reading data SCNCD." << endl ;319 return -1 ;320 }321 // DEBUG322 //cout << "SCNCD = " << SCNCD << endl ;323 //324 strcpy( c120, str120.c_str() ) ;325 if ( readHeader( c120, 120 ) == -1 ) {326 os << LogIO::WARN << "Error while reading data SCMOD." << endl ;327 return -1 ;328 }329 SCMOD = string( c120 ) ;330 // DEBUG331 //cout << "SCMOD = " << SCMOD << endl ;332 //333 if ( readHeader( URVEL, sameEndian ) == -1 ) {334 os << LogIO::WARN << "Error while reading data URVEL." << endl ;335 return -1 ;336 }337 // DEBUG338 //cout << "URVEL = " << URVEL << endl ;339 //340 strcpy( c4, str4.c_str() ) ;341 if ( readHeader( c4, 4 ) == -1 ) {342 os << LogIO::WARN << "Error while reading data VREF." << endl ;343 return -1 ;344 }345 VREF = string( c4 ) ;346 // DEBUG347 //cout << "VREF = " << VREF << endl ;348 //349 strcpy( c4, str4.c_str() ) ;350 if ( readHeader( c4, 4 ) == -1 ) {351 os << LogIO::WARN << "Error while reading data VDEF." << endl ;352 return -1 ;353 }354 VDEF = string( c4 ) ;355 // DEBUG356 //cout << "VDEF = " << VDEF << endl ;357 //358 strcpy( c8, str8.c_str() ) ;359 if ( readHeader( c8, 8 ) == -1 ) {360 os << LogIO::WARN << "Error while reading data SWMOD." << endl ;361 return -1 ;362 }363 SWMOD = string( c8 ) + "::OTF" ;364 // DEBUG365 //cout << "SWMOD = " << SWMOD << endl ;366 //367 if ( readHeader( FRQSW, sameEndian ) == -1 ) {368 os << LogIO::WARN << "Error while reading data FRQSW." << endl ;369 return -1 ;370 }371 // DEBUG372 //cout << "FRQSW = " << FRQSW << endl ;373 //374 if ( readHeader( DBEAM, sameEndian ) == -1 ) {375 os << LogIO::WARN << "Error while reading data DBEAM." << endl ;376 return -1 ;377 }378 // DEBUG379 //cout << "DBEAM = " << DBEAM << endl ;380 //381 if ( readHeader( MLTOF, sameEndian ) == -1 ) {382 os << LogIO::WARN << "Error while reading data MLTOF." << endl ;383 return -1 ;384 }385 // DEBUG386 //cout << "MLTOF = " << MLTOF << endl ;387 //388 if ( readHeader( CMTQ, sameEndian ) == -1 ) {389 os << LogIO::WARN << "Error while reading data CMTQ." << endl ;390 return -1 ;391 }392 // DEBUG393 //cout << "CMTQ = " << CMTQ << endl ;394 //395 if ( readHeader( CMTE, sameEndian ) == -1 ) {396 os << LogIO::WARN << "Error while reading data CMTE." << endl ;397 return -1 ;398 }399 // DEBUG400 //cout << "CMTE = " << CMTE << endl ;401 //402 if ( readHeader( CMTSOM, sameEndian ) == -1 ) {403 os << LogIO::WARN << "Error while reading data CMTSOM." << endl ;404 return -1 ;405 }406 // DEBUG407 //cout << "CMTSOM = " << CMTSOM << endl ;408 //409 if ( readHeader( CMTNODE, sameEndian ) == -1 ) {410 os << LogIO::WARN << "Error while reading data CMTNODE." << endl ;411 return -1 ;412 }413 // DEBUG414 //cout << "CMTNODE = " << CMTNODE << endl ;415 //416 if ( readHeader( CMTI, sameEndian ) == -1 ) {417 os << LogIO::WARN << "Error while reading data CMTI." << endl ;418 return -1 ;419 }420 // DEBUG421 //cout << "CMTI = " << CMTI << endl ;422 //423 strcpy( c24, str24.c_str() ) ;424 if ( readHeader( c24, 24 ) == -1 ) {425 os << LogIO::WARN << "Error while reading data CMTTM." << endl ;426 return -1 ;427 }428 CMTTM = string( c24 ) ;429 // DEBUG430 //cout << "CMTTM = " << CMTTM << endl ;431 //432 if ( readHeader( SBDX, sameEndian ) == -1 ) {433 os << LogIO::WARN << "Error while reading data SBDX." << endl ;434 return -1 ;435 }436 // DEBUG437 //cout << "SBDX = " << SBDX << endl ;438 //439 if ( readHeader( SBDY, sameEndian ) == -1 ) {440 os << LogIO::WARN << "Error while reading data SBDY." << endl ;441 return -1 ;442 }443 // DEBUG444 //cout << "SBDY = " << SBDY << endl ;445 //446 if ( readHeader( SBDZ1, sameEndian ) == -1 ) {447 os << LogIO::WARN << "Error while reading data SBDZ1." << endl ;448 return -1 ;449 }450 // DEBUG451 //cout << "SBDZ1 = " << SBDZ1 << endl ;452 //453 if ( readHeader( SBDZ2, sameEndian ) == -1 ) {454 os << LogIO::WARN << "Error while reading data SBDZ2." << endl ;455 return -1 ;456 }457 // DEBUG458 //cout << "SBDZ2 = " << SBDZ2 << endl ;459 //460 if ( readHeader( DAZP, sameEndian ) == -1 ) {461 os << LogIO::WARN << "Error while reading data DAZP." << endl ;462 return -1 ;463 }464 // DEBUG465 //cout << "DAZP = " << DAZP << endl ;466 //467 if ( readHeader( DELP, sameEndian ) == -1 ) {468 os << LogIO::WARN << "Error while reading data DELP." << endl ;469 return -1 ;470 }471 // DEBUG472 //cout << "DELP = " << DELP << endl ;473 //474 if ( readHeader( CHBIND, sameEndian ) == -1 ) {475 os << LogIO::WARN << "Error while reading data CHBIND." << endl ;476 return -1 ;477 }478 // DEBUG479 //cout << "CHBIND = " << CHBIND << endl ;480 //481 if ( readHeader( NUMCH, sameEndian ) == -1 ) {482 os << LogIO::WARN << "Error while reading data NUMCH." << endl ;483 return -1 ;484 }485 // DEBUG486 //cout << "NUMCH = " << NUMCH << endl ;487 //488 if ( readHeader( CHMIN, sameEndian ) == -1 ) {489 os << LogIO::WARN << "Error while reading data CHMIN." << endl ;490 return -1 ;491 }492 // DEBUG493 //cout << "CHMIN = " << CHMIN << endl ;494 //495 if ( readHeader( CHMAX, sameEndian ) == -1 ) {496 os << LogIO::WARN << "Error while reading data CHMAX." << endl ;497 return -1 ;498 }499 // DEBUG500 //cout << "CHMAX = " << CHMAX << endl ;501 //502 if ( readHeader( ALCTM, sameEndian ) == -1 ) {503 os << LogIO::WARN << "Error while reading data ALCTM." << endl ;504 return -1 ;505 }506 // DEBUG507 //cout << "ALCTM = " << ALCTM << endl ;508 //509 if ( readHeader( IPTIM, sameEndian ) == -1 ) {510 os << LogIO::WARN << "Error while reading data IPTIM." << endl ;511 return -1 ;512 }513 // DEBUG514 //cout << "IPTIM = " << IPTIM << endl ;515 //516 if ( readHeader( PA, sameEndian ) == -1 ) {517 os << LogIO::WARN << "Error while reading data PA." << endl ;518 return -1 ;519 }520 // DEBUG521 //cout << "PA = " << PA << endl ;522 //523 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {524 strcpy( c18, str18.c_str() ) ;525 if ( readHeader( c18, 16 ) == -1 ) {526 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << endl ;527 return -1 ;528 }529 c18[16] = '\0' ;530 RX[i] = string( c18 ) ;531 }532 // DEBUG533 // nro_debug_output( "RX", ASTE_ARYMAX_FX, RX ) ;534 //535 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {536 if ( readHeader( HPBW[i], sameEndian ) == -1 ) {537 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << endl ;538 return -1 ;539 }540 }541 // DEBUG542 // nro_debug_output( "HPBW", ASTE_ARYMAX_FX, HPBW ) ;543 //544 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {545 if ( readHeader( EFFA[i], sameEndian ) == -1 ) {546 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << endl ;547 return -1 ;548 }549 }550 // DEBUG551 // nro_debug_output( "EFFA", ASTE_ARYMAX_FX, EFFA ) ;552 //553 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {554 if ( readHeader( EFFB[i], sameEndian ) == -1 ) {555 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << endl ;556 return -1 ;557 }558 }559 // DEBUG560 // nro_debug_output( "EFFB", ASTE_ARYMAX_FX, EFFB ) ;561 //562 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {563 if ( readHeader( EFFL[i], sameEndian ) == -1 ) {564 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << endl ;565 return -1 ;566 }567 }568 // DEBUG569 // nro_debug_output( "EFFL", ASTE_ARYMAX_FX, EFFL ) ;570 //571 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {572 if ( readHeader( EFSS[i], sameEndian ) == -1 ) {573 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << endl ;574 return -1 ;575 }576 }577 // DEBUG578 // nro_debug_output( "EFSS", ASTE_ARYMAX_FX, EFSS ) ;579 //580 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {581 if ( readHeader( GAIN[i], sameEndian ) == -1 ) {582 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << endl ;583 return -1 ;584 }585 }586 // DEBUG587 // nro_debug_output( "GAIN", ASTE_ARYMAX_FX, GAIN ) ;588 //589 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {590 strcpy( c4, str4.c_str() ) ;591 if ( readHeader( c4, 4 ) == -1 ) {592 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << endl ;593 return -1 ;594 }595 HORN[i] = string( c4 ) ;596 }597 // DEBUG598 // nro_debug_output( "HORN", ASTE_ARYMAX_FX, HORN ) ;599 //600 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {601 strcpy( c4, str4.c_str() ) ;602 if ( readHeader( c4, 4 ) == -1 ) {603 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << endl ;604 return -1 ;605 }606 POLTP[i] = string( c4 ) ;607 }608 // DEBUG609 // nro_debug_output( "POLTP", ASTE_ARYMAX_FX, POLTP ) ;610 //611 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {612 if ( readHeader( POLDR[i], sameEndian ) == -1 ) {613 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << endl ;614 return -1 ;615 }616 }617 // DEBUG618 // nro_debug_output( "POLDR", ASTE_ARYMAX_FX, POLDR ) ;619 //620 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {621 if ( readHeader( POLAN[i], sameEndian ) == -1 ) {622 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << endl ;623 return -1 ;624 }625 }626 // DEBUG627 // nro_debug_output( "POLAN", ASTE_ARYMAX_FX, POLAN ) ;628 //629 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {630 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) {631 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << endl ;632 return -1 ;633 }634 }635 // DEBUG636 // nro_debug_output( "DFRQ", ASTE_ARYMAX_FX, DFRQ ) ;637 //638 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {639 strcpy( c4, str4.c_str() ) ;640 if ( readHeader( c4, 4 ) == -1 ) {641 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << endl ;642 return -1 ;643 }644 SIDBD[i] = string( c4 ) ;645 }646 // DEBUG647 // nro_debug_output( "SIDBD", ASTE_ARYMAX_FX, SIDBD ) ;648 //649 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {650 if ( readHeader( REFN[i], sameEndian ) == -1 ) {651 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << endl ;652 return -1 ;653 }654 }655 // DEBUG656 // nro_debug_output( "REFN", ASTE_ARYMAX_FX, REFN ) ;657 //658 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {659 if ( readHeader( IPINT[i], sameEndian ) == -1 ) {660 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << endl ;661 return -1 ;662 }663 }664 // DEBUG665 // nro_debug_output( "IPINT", ASTE_ARYMAX_FX, IPINT ) ;666 //667 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {668 if ( readHeader( MULTN[i], sameEndian ) == -1 ) {669 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << endl ;670 return -1 ;671 }672 }673 // DEBUG674 // nro_debug_output( "MULTN", ASTE_ARYMAX_FX, MULTN ) ;675 //676 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {677 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) {678 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << endl ;679 return -1 ;680 }681 }682 // DEBUG683 // nro_debug_output( "MLTSCF", ASTE_ARYMAX_FX, MLTSCF ) ;684 //685 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {686 strcpy( c8, str8.c_str() ) ;687 if ( readHeader( c8, 8 ) == -1 ) {688 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << endl ;689 return -1 ;690 }691 LAGWIND[i] = string( c8 ) ;692 }693 // DEBUG694 // nro_debug_output( "LAGWIND", ASTE_ARYMAX_FX, LAGWIND ) ;695 //696 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {697 if ( readHeader( BEBW[i], sameEndian ) == -1 ) {698 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << endl ;699 return -1 ;700 }701 }702 // DEBUG703 // nro_debug_output( "BEBW", ASTE_ARYMAX_FX, BEBW ) ;704 //705 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {706 if ( readHeader( BERES[i], sameEndian ) == -1 ) {707 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << endl ;708 return -1 ;709 }710 }711 // DEBUG712 // nro_debug_output( "BERES", ASTE_ARYMAX_FX, BERES ) ;713 //714 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {715 if ( readHeader( CHWID[i], sameEndian ) == -1 ) {716 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << endl ;717 return -1 ;718 }719 }720 // DEBUG721 // nro_debug_output( "CHWID", ASTE_ARYMAX_FX, CHWID ) ;722 //723 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {724 if ( readHeader( ARRY[i], sameEndian ) == -1 ) {725 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << endl ;726 return -1 ;727 }728 }729 // DEBUG730 // nro_debug_output( "ARRY", ASTE_ARYMAX_FX, ARRY ) ;731 //732 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {733 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) {734 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << endl ;735 return -1 ;736 }737 }738 // DEBUG739 // nro_debug_output( "NFCAL", ASTE_ARYMAX_FX, NFCAL ) ;740 //741 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {742 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) {743 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << endl ;744 return -1 ;745 }746 }747 // DEBUG748 // nro_debug_output( "F0CAL", ASTE_ARYMAX_FX, F0CAL ) ;749 //750 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {751 for ( int j = 0 ; j < 10 ; j++ ) {752 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) {753 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << endl ;754 return -1 ;755 }756 }757 }758 // DEBUG759 // nro_debug_output( "FQCAL", ASTE_ARYMAX_FX, 10, FQCAL ) ;760 //761 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {762 for ( int j = 0 ; j < 10 ; j++ ) {763 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) {764 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << endl ;765 return -1 ;766 }767 }768 }769 // DEBUG770 // nro_debug_output( "CHCAL", ASTE_ARYMAX_FX, 10, CHCAL ) ;771 //772 for ( int i= 0 ; i < ASTE_ARYMAX_FX ; i++) {773 for ( int j = 0 ; j < 10 ; j++ ) {774 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) {775 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << endl ;776 return -1 ;777 }778 }779 }780 // DEBUG781 // nro_debug_output( "CWCAL", ASTE_ARYMAX_FX, 10, CWCAL ) ;782 //783 if ( readHeader( SCNLEN, sameEndian ) == -1 ) {784 os << LogIO::WARN << "Error while reading data SCNLEN." << endl ;785 return -1 ;786 }787 // DEBUG788 //cout << "SCNLEN = " << SCNLEN << endl ;789 //790 if ( readHeader( SBIND, sameEndian ) == -1 ) {791 os << LogIO::WARN << "Error while reading data SBIND." << endl ;792 return -1 ;793 }794 // DEBUG795 //cout << "SBIND = " << SBIND << endl ;796 //797 if ( readHeader( IBIT, sameEndian ) == -1 ) {798 os << LogIO::WARN << "Error while reading data IBIT." << endl ;799 return -1 ;800 }801 // DEBUG802 //cout << "IBIT = " << IBIT << endl ;803 //804 strcpy( c8, str8.c_str() ) ;805 if ( readHeader( c8, 8 ) == -1 ) {806 os << LogIO::WARN << "Error while reading data SITE." << endl ;807 return -1 ;808 }809 SITE = string( c8 ) ;810 // DEBUG811 //cout << "SITE = " << SITE << endl ;812 //813 strcpy( c120, str120.c_str() ) ;814 if ( readHeader( c120, 116 ) == -1 ) {815 os << LogIO::WARN << "Error while reading data CDMY1." << endl ;816 return -1 ;817 }818 c120[116] = '\0' ;819 CDMY1 = string( c120 ) ;820 // DEBUG821 //cout << "CDMY1 = " << CDMY1 << endl ;822 //823 for ( int i = 0 ; i < ASTE_ARYMAX_FX ; i++ ) {824 if ( readHeader( DSBFC[i], sameEndian ) == -1 ) {825 os << LogIO::WARN << "Error while reading data DSBFC[" << i << "]." << endl ;826 return -1 ;827 }828 }829 // DEBUG830 // nro_debug_output( "DSBFC", ASTE_ARYMAX_FX, DSBFC ) ;831 //832 833 //scanNum_ = NSCAN + 1 ; // includes ZERO scan834 scanLen_ = SCNLEN ;835 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;836 scanNum_ = getScanNum();837 rowNum_ = scanNum_ * ARYNM ;838 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;839 record_->LDATA = new char[dataLen_] ;840 841 initArray();842 843 show() ;844 845 return 0 ;846 } -
trunk/external-alma/atnf/PKSIO/ASTEFXDataset.h
r2777 r2782 36 36 #define ASTE_ARYMAX_FX 12 37 37 38 #include <atnf/PKSIO/ NRODataset.h>38 #include <atnf/PKSIO/ASTEDataset.h> 39 39 40 40 #include <string> … … 48 48 // <prerequisite> 49 49 // <li> <linkto class=ASTEFXReader>ASTEFXReader</linkto> 50 // <li> <linkto class=ASTEDataset>ASTEDataset</linkto> 50 51 // <li> <linkto class=NRODataset>NRODataset</linkto> 51 52 // </prerequisite> … … 65 66 // 66 67 67 class ASTEFXDataset : public NRODataset68 class ASTEFXDataset : public ASTEDataset 68 69 { 69 70 public: … … 74 75 virtual ~ASTEFXDataset() ; 75 76 76 // data initialization77 virtual void initialize() ;78 79 // fill header from file80 virtual int fillHeader() ;81 82 77 protected: 83 // fill header information84 virtual int fillHeader( int sameEndian ) ;85 86 78 // return ARRAYMAX 87 79 virtual int arrayMax() { return ASTE_ARYMAX_FX; } ; -
trunk/external-alma/atnf/PKSIO/ASTEFXReader.cc
r2780 r2782 56 56 { 57 57 dataset_ = new ASTEFXDataset( filename_ ) ; 58 dataset_->initialize() ; 58 59 } -
trunk/external-alma/atnf/PKSIO/ASTEReader.cc
r2780 r2782 56 56 { 57 57 dataset_ = new ASTEDataset( filename_ ) ; 58 dataset_->initialize() ; 58 59 } 59 60 -
trunk/external-alma/atnf/PKSIO/NRO45Reader.cc
r2780 r2782 56 56 { 57 57 dataset_ = new NROOTFDataset( filename_ ) ; 58 dataset_->initialize() ; 58 59 } 59 60 -
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2781 r2782 57 57 58 58 // constructor 59 NRODataset::NRODataset( string name ) 60 { 61 // memory allocation 62 initialize() ; 63 64 filename_ = name ; 65 fp_ = NULL ; 66 scanNum_ = 0 ; 67 rowNum_ = 0 ; 68 scanLen_ = 0 ; 69 dataLen_ = 0 ; 70 dataid_ = -1 ; 71 72 // endian matches 73 same_ = -1 ; 74 75 // Record for frequency setting 76 frec_ = Record() ; 77 } 59 NRODataset::NRODataset( string name ) 60 : scanNum_(0), 61 rowNum_(0), 62 scanLen_(0), 63 dataLen_(0), 64 dataid_(-1), 65 filename_(name), 66 fp_(NULL), 67 same_(-1), 68 frec_() 69 {} 78 70 79 71 // destructor … … 90 82 void NRODataset::initialize() 91 83 { 84 LogIO os( LogOrigin( "NRODataset", "initialize()", WHERE ) ) ; 85 86 int arymax = arrayMax() ; 87 88 // check endian 89 open() ; 90 fseek( fp_, 144, SEEK_SET ) ; 91 int tmp ; 92 if( fread( &tmp, 1, sizeof(int), fp_ ) != sizeof(int) ) { 93 os << LogIO::SEVERE << "Error while checking endian of the file. " << LogIO::EXCEPTION ; 94 return ; 95 } 96 if ( ( 0 < tmp ) && ( tmp <= arymax ) ) { 97 same_ = 1 ; 98 os << LogIO::NORMAL << "same endian " << LogIO::POST ; 99 } 100 else { 101 same_ = 0 ; 102 os << LogIO::NORMAL << "different endian " << LogIO::POST ; 103 } 104 fseek( fp_, 0, SEEK_SET ) ; 105 106 // common part of calculation of data size and memory allocation 107 RX.resize( arymax ) ; 108 HPBW.resize( arymax ) ; 109 EFFA.resize( arymax ) ; 110 EFFB.resize( arymax ) ; 111 EFFL.resize( arymax ) ; 112 EFSS.resize( arymax ) ; 113 GAIN.resize( arymax ) ; 114 HORN.resize( arymax ) ; 115 POLTP.resize( arymax ) ; 116 POLDR.resize( arymax ) ; 117 POLAN.resize( arymax ) ; 118 DFRQ.resize( arymax ) ; 119 SIDBD.resize( arymax ) ; 120 REFN.resize( arymax ) ; 121 IPINT.resize( arymax ) ; 122 MULTN.resize( arymax ) ; 123 MLTSCF.resize( arymax ) ; 124 LAGWIND.resize( arymax ) ; 125 BEBW.resize( arymax ) ; 126 BERES.resize( arymax ) ; 127 CHWID.resize( arymax ) ; 128 ARRY.resize( arymax ) ; 129 NFCAL.resize( arymax ) ; 130 F0CAL.resize( arymax ) ; 131 FQCAL.resize( arymax ) ; 132 CHCAL.resize( arymax ) ; 133 CWCAL.resize( arymax ) ; 134 DSBFC.resize( arymax ) ; 135 136 for ( int i = 0 ; i < arymax ; i++ ) { 137 FQCAL[i].resize( 10 ) ; 138 CHCAL[i].resize( 10 ) ; 139 CWCAL[i].resize( 10 ) ; 140 } 141 92 142 datasize_ = sizeof( char ) * 8 // LOFIL 93 143 + sizeof( char ) * 8 // VER … … 120 170 record_ = new NRODataRecord() ; 121 171 record_->LDATA = NULL ; 172 173 // reference frequency 174 refFreq_.resize( arymax, 0.0 ) ; 175 } 176 177 // fill data header 178 int NRODataset::fillHeader() 179 { 180 LogIO os( LogOrigin( "NRODataset", "fillHeader()", WHERE ) ) ; 181 182 // open file 183 if ( open() ) { 184 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ; 185 return -1 ; 186 } 187 188 // fill 189 int status = fillHeader( same_ ) ; 190 191 if ( status != 0 ) { 192 os << LogIO::SEVERE << "Error while reading header " << filename_ << "." << LogIO::EXCEPTION ; 193 return status ; 194 } 195 196 //scanNum_ = NSCAN + 1 ; // includes ZERO scan 197 scanLen_ = SCNLEN ; 198 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ; 199 scanNum_ = getScanNum(); 200 rowNum_ = scanNum_ * ARYNM ; 201 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ; 202 record_->LDATA = new char[dataLen_] ; 203 204 initArray(); 205 206 show() ; 207 208 return status ; 122 209 } 123 210 -
trunk/external-alma/atnf/PKSIO/NRODataset.h
r2781 r2782 98 98 99 99 // Fill data header from file 100 virtual int fillHeader() = 0;100 virtual int fillHeader() ; 101 101 102 102 // Fill data record -
trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc
r2781 r2782 41 41 NROOTFDataset::NROOTFDataset( string name ) 42 42 : NRODataset( name ) 43 { 44 LogIO os( LogOrigin( "NROOTFDataset", "NROOTFDataset()", WHERE ) ) ; 45 46 // check endian 47 open() ; 48 fseek( fp_, 144, SEEK_SET ) ; 49 int tmp ; 50 if( fread( &tmp, 1, sizeof(int), fp_ ) != sizeof(int) ) { 51 os << LogIO::SEVERE << "Error while checking endian of the file. " << LogIO::EXCEPTION ; 52 return ; 53 } 54 if ( ( 0 < tmp ) && ( tmp <= NRO_ARYMAX ) ) { 55 same_ = 1 ; 56 os << LogIO::NORMAL << "same endian " << LogIO::POST ; 57 } 58 else { 59 same_ = 0 ; 60 os << LogIO::NORMAL << "different endian " << LogIO::POST ; 61 } 62 fseek( fp_, 0, SEEK_SET ) ; 63 64 // memory allocation 65 initialize() ; 66 67 // data initialization 68 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) { 69 DSBFC[i] = 1.0 ; 70 } 71 } 43 {} 72 44 73 45 // destructor 74 46 NROOTFDataset::~NROOTFDataset() 75 { 76 } 47 {} 77 48 78 49 // data initialization 79 50 void NROOTFDataset::initialize() 80 51 { 81 RX.resize( NRO_ARYMAX ) ; 82 HPBW.resize( NRO_ARYMAX ) ; 83 EFFA.resize( NRO_ARYMAX ) ; 84 EFFB.resize( NRO_ARYMAX ) ; 85 EFFL.resize( NRO_ARYMAX ) ; 86 EFSS.resize( NRO_ARYMAX ) ; 87 GAIN.resize( NRO_ARYMAX ) ; 88 HORN.resize( NRO_ARYMAX ) ; 89 POLTP.resize( NRO_ARYMAX ) ; 90 POLDR.resize( NRO_ARYMAX ) ; 91 POLAN.resize( NRO_ARYMAX ) ; 92 DFRQ.resize( NRO_ARYMAX ) ; 93 SIDBD.resize( NRO_ARYMAX ) ; 94 REFN.resize( NRO_ARYMAX ) ; 95 IPINT.resize( NRO_ARYMAX ) ; 96 MULTN.resize( NRO_ARYMAX ) ; 97 MLTSCF.resize( NRO_ARYMAX ) ; 98 LAGWIND.resize( NRO_ARYMAX ) ; 99 BEBW.resize( NRO_ARYMAX ) ; 100 BERES.resize( NRO_ARYMAX ) ; 101 CHWID.resize( NRO_ARYMAX ) ; 102 ARRY.resize( NRO_ARYMAX ) ; 103 NFCAL.resize( NRO_ARYMAX ) ; 104 F0CAL.resize( NRO_ARYMAX ) ; 105 FQCAL.resize( NRO_ARYMAX ) ; 106 CHCAL.resize( NRO_ARYMAX ) ; 107 CWCAL.resize( NRO_ARYMAX ) ; 108 DSBFC.resize( NRO_ARYMAX ) ; 52 int arymax = arrayMax() ; 53 54 // it must be called 55 NRODataset::initialize() ; 56 57 // additional initialization 58 datasize_ += sizeof( char ) * arymax * 16 // RX 59 + sizeof( double ) * arymax * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN 60 + sizeof( char ) * arymax * 4 // HORN 61 + sizeof( char ) * arymax * 4 // POLTP 62 + sizeof( double ) * arymax * 3 // POLDR, POLAN, DFRQ 63 + sizeof( char ) * arymax * 4 // SIDBID 64 + sizeof( int ) * arymax * 3 // REFN, IPINT, MULTN 65 + sizeof( double ) * arymax // MLTSCF 66 + sizeof( char ) * arymax * 8 // LAGWIND 67 + sizeof( double ) * arymax * 3 // BEBW, BERES, CHWID 68 + sizeof( int ) * arymax * 2 // ARRY, NFCAL 69 + sizeof( double ) * arymax // F0CAL 70 + sizeof( double ) * arymax * 10 * 3 // FQCAL, CHCAL, CWCAL 71 + sizeof( char ) * 180 ; // CDMY1 109 72 110 73 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) { 111 FQCAL[i].resize( 10 ) ; 112 CHCAL[i].resize( 10 ) ; 113 CWCAL[i].resize( 10 ) ; 114 } 115 116 datasize_ += sizeof( char ) * NRO_ARYMAX * 16 // RX 117 + sizeof( double ) * NRO_ARYMAX * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN 118 + sizeof( char ) * NRO_ARYMAX * 4 // HORN 119 + sizeof( char ) * NRO_ARYMAX * 4 // POLTP 120 + sizeof( double ) * NRO_ARYMAX * 3 // POLDR, POLAN, DFRQ 121 + sizeof( char ) * NRO_ARYMAX * 4 // SIDBID 122 + sizeof( int ) * NRO_ARYMAX * 3 // REFN, IPINT, MULTN 123 + sizeof( double ) * NRO_ARYMAX // MLTSCF 124 + sizeof( char ) * NRO_ARYMAX * 8 // LAGWIND 125 + sizeof( double ) * NRO_ARYMAX * 3 // BEBW, BERES, CHWID 126 + sizeof( int ) * NRO_ARYMAX * 2 // ARRY, NFCAL 127 + sizeof( double ) * NRO_ARYMAX // F0CAL 128 + sizeof( double ) * NRO_ARYMAX * 10 * 3 // FQCAL, CHCAL, CWCAL 129 + sizeof( char ) * 180 ; // CDMY1 130 131 refFreq_.resize( NRO_ARYMAX, 0.0 ) ; 132 } 133 134 // fill data header 135 int NROOTFDataset::fillHeader() 136 { 137 LogIO os( LogOrigin( "NROOTFDataset", "fillHeader()", WHERE ) ) ; 138 139 // open file 140 if ( open() ) { 141 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ; 142 return -1 ; 143 } 144 145 // fill 146 int status = fillHeader( same_ ) ; 147 148 return status ; 74 DSBFC[i] = 1.0 ; 75 } 149 76 } 150 77 … … 152 79 { 153 80 LogIO os( LogOrigin( "NROOTFDataset", "fillHeader()", WHERE ) ) ; 81 82 int arymax = arrayMax() ; 154 83 155 84 string str4( 4, ' ' ) ; … … 527 456 //cout << "PA = " << PA << endl ; 528 457 // 529 for ( int i = 0 ; i < NRO_ARYMAX; i++ ) {458 for ( int i = 0 ; i < arymax ; i++ ) { 530 459 strcpy( c18, str18.c_str() ) ; 531 460 if ( readHeader( c18, 16 ) == -1 ) { … … 537 466 } 538 467 // DEBUG 539 // nro_debug_output( "RX", NRO_ARYMAX, RX ) ;540 // 541 for ( int i = 0 ; i < NRO_ARYMAX; i++ ) {468 // nro_debug_output( "RX", arymax, RX ) ; 469 // 470 for ( int i = 0 ; i < arymax ; i++ ) { 542 471 if ( readHeader( HPBW[i], sameEndian ) == -1 ) { 543 472 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ; … … 546 475 } 547 476 // DEBUG 548 // nro_debug_output( "HPBW", NRO_ARYMAX, HPBW ) ;549 // 550 for ( int i = 0 ; i < NRO_ARYMAX; i++ ) {477 // nro_debug_output( "HPBW", arymax, HPBW ) ; 478 // 479 for ( int i = 0 ; i < arymax ; i++ ) { 551 480 if ( readHeader( EFFA[i], sameEndian ) == -1 ) { 552 481 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ; … … 555 484 } 556 485 // DEBUG 557 // nro_debug_output( "EFFA", NRO_ARYMAX, EFFA ) ;558 // 559 for ( int i = 0 ; i < NRO_ARYMAX; i++ ) {486 // nro_debug_output( "EFFA", arymax, EFFA ) ; 487 // 488 for ( int i = 0 ; i < arymax ; i++ ) { 560 489 if ( readHeader( EFFB[i], sameEndian ) == -1 ) { 561 490 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ; … … 564 493 } 565 494 // DEBUG 566 // nro_debug_output( "EFFB", NRO_ARYMAX, EFFB ) ;567 // 568 for ( int i = 0 ; i < NRO_ARYMAX; i++ ) {495 // nro_debug_output( "EFFB", arymax, EFFB ) ; 496 // 497 for ( int i = 0 ; i < arymax ; i++ ) { 569 498 if ( readHeader( EFFL[i], sameEndian ) == -1 ) { 570 499 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ; … … 573 502 } 574 503 // DEBUG 575 // nro_debug_output( "EFFL", NRO_ARYMAX, EFFL ) ;576 // 577 for ( int i = 0 ; i < NRO_ARYMAX; i++ ) {504 // nro_debug_output( "EFFL", arymax, EFFL ) ; 505 // 506 for ( int i = 0 ; i < arymax ; i++ ) { 578 507 if ( readHeader( EFSS[i], sameEndian ) == -1 ) { 579 508 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ; … … 582 511 } 583 512 // DEBUG 584 // nro_debug_output( "EFSS", NRO_ARYMAX, EFSS ) ;585 // 586 for ( int i = 0 ; i < NRO_ARYMAX; i++) {513 // nro_debug_output( "EFSS", arymax, EFSS ) ; 514 // 515 for ( int i = 0 ; i < arymax ; i++) { 587 516 if ( readHeader( GAIN[i], sameEndian ) == -1 ) { 588 517 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ; … … 591 520 } 592 521 // DEBUG 593 // nro_debug_output( "GAIN", NRO_ARYMAX, GAIN ) ;594 // 595 for ( int i = 0 ; i < NRO_ARYMAX; i++) {522 // nro_debug_output( "GAIN", arymax, GAIN ) ; 523 // 524 for ( int i = 0 ; i < arymax ; i++) { 596 525 strcpy( c4, str4.c_str() ) ; 597 526 if ( readHeader( c4, 4 ) == -1 ) { … … 602 531 } 603 532 // DEBUG 604 // nro_debug_output( "HORN", NRO_ARYMAX, HORN ) ;605 // 606 for ( int i = 0 ; i < NRO_ARYMAX; i++) {533 // nro_debug_output( "HORN", arymax, HORN ) ; 534 // 535 for ( int i = 0 ; i < arymax ; i++) { 607 536 strcpy( c4, str4.c_str() ) ; 608 537 if ( readHeader( c4, 4 ) == -1 ) { … … 613 542 } 614 543 // DEBUG 615 // nro_debug_output( "POLTP", NRO_ARYMAX, POLTP ) ;616 // 617 for ( int i = 0 ; i < NRO_ARYMAX; i++) {544 // nro_debug_output( "POLTP", arymax, POLTP ) ; 545 // 546 for ( int i = 0 ; i < arymax ; i++) { 618 547 if ( readHeader( POLDR[i], sameEndian ) == -1 ) { 619 548 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ; … … 622 551 } 623 552 // DEBUG 624 // nro_debug_output( "POLDR", NRO_ARYMAX, POLDR ) ;625 // 626 for ( int i = 0 ; i < NRO_ARYMAX; i++) {553 // nro_debug_output( "POLDR", arymax, POLDR ) ; 554 // 555 for ( int i = 0 ; i < arymax ; i++) { 627 556 if ( readHeader( POLAN[i], sameEndian ) == -1 ) { 628 557 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ; … … 631 560 } 632 561 // DEBUG 633 // nro_debug_output( "POLAN", NRO_ARYMAX, POLAN ) ;634 // 635 for ( int i = 0 ; i < NRO_ARYMAX; i++) {562 // nro_debug_output( "POLAN", arymax, POLAN ) ; 563 // 564 for ( int i = 0 ; i < arymax ; i++) { 636 565 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) { 637 566 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ; … … 640 569 } 641 570 // DEBUG 642 // nro_debug_output( "DFRQ", NRO_ARYMAX, DFRQ ) ;643 // 644 for ( int i = 0 ; i < NRO_ARYMAX; i++) {571 // nro_debug_output( "DFRQ", arymax, DFRQ ) ; 572 // 573 for ( int i = 0 ; i < arymax ; i++) { 645 574 strcpy( c4, str4.c_str() ) ; 646 575 if ( readHeader( c4, 4 ) == -1 ) { … … 651 580 } 652 581 // DEBUG 653 // nro_debug_output( "SIDBD", NRO_ARYMAX, SIDBD ) ;654 // 655 for ( int i = 0 ; i < NRO_ARYMAX; i++) {582 // nro_debug_output( "SIDBD", arymax, SIDBD ) ; 583 // 584 for ( int i = 0 ; i < arymax ; i++) { 656 585 if ( readHeader( REFN[i], sameEndian ) == -1 ) { 657 586 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ; … … 660 589 } 661 590 // DEBUG 662 // nro_debug_output( "REFN", NRO_ARYMAX, REFN ) ;663 // 664 for ( int i = 0 ; i < NRO_ARYMAX; i++) {591 // nro_debug_output( "REFN", arymax, REFN ) ; 592 // 593 for ( int i = 0 ; i < arymax ; i++) { 665 594 if ( readHeader( IPINT[i], sameEndian ) == -1 ) { 666 595 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ; … … 669 598 } 670 599 // DEBUG 671 // nro_debug_output( "IPINT", NRO_ARYMAX, IPINT ) ;672 // 673 for ( int i = 0 ; i < NRO_ARYMAX; i++) {600 // nro_debug_output( "IPINT", arymax, IPINT ) ; 601 // 602 for ( int i = 0 ; i < arymax ; i++) { 674 603 if ( readHeader( MULTN[i], sameEndian ) == -1 ) { 675 604 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ; … … 678 607 } 679 608 // DEBUG 680 // nro_debug_output( "MULTN", NRO_ARYMAX, MULTN ) ;681 // 682 for ( int i = 0 ; i < NRO_ARYMAX; i++) {609 // nro_debug_output( "MULTN", arymax, MULTN ) ; 610 // 611 for ( int i = 0 ; i < arymax ; i++) { 683 612 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) { 684 613 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ; … … 687 616 } 688 617 // DEBUG 689 // nro_debug_output( "MLTSCF", NRO_ARYMAX, MLTSCF ) ;690 // 691 for ( int i = 0 ; i < NRO_ARYMAX; i++) {618 // nro_debug_output( "MLTSCF", arymax, MLTSCF ) ; 619 // 620 for ( int i = 0 ; i < arymax ; i++) { 692 621 strcpy( c8, str8.c_str() ) ; 693 622 if ( readHeader( c8, 8 ) == -1 ) { … … 698 627 } 699 628 // DEBUG 700 // nro_debug_output( "LAGWIND", NRO_ARYMAX, LAGWIND ) ;701 // 702 for ( int i = 0 ; i < NRO_ARYMAX; i++) {629 // nro_debug_output( "LAGWIND", arymax, LAGWIND ) ; 630 // 631 for ( int i = 0 ; i < arymax ; i++) { 703 632 if ( readHeader( BEBW[i], sameEndian ) == -1 ) { 704 633 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ; … … 707 636 } 708 637 // DEBUG 709 // nro_debug_output( "BEBW", NRO_ARYMAX, BEBW ) ;710 // 711 for ( int i = 0 ; i < NRO_ARYMAX; i++) {638 // nro_debug_output( "BEBW", arymax, BEBW ) ; 639 // 640 for ( int i = 0 ; i < arymax ; i++) { 712 641 if ( readHeader( BERES[i], sameEndian ) == -1 ) { 713 642 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ; … … 716 645 } 717 646 // DEBUG 718 // nro_debug_output( "BERES", NRO_ARYMAX, BERES ) ;719 // 720 for ( int i = 0 ; i < NRO_ARYMAX; i++) {647 // nro_debug_output( "BERES", arymax, BERES ) ; 648 // 649 for ( int i = 0 ; i < arymax ; i++) { 721 650 if ( readHeader( CHWID[i], sameEndian ) == -1 ) { 722 651 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ; … … 725 654 } 726 655 // DEBUG 727 // nro_debug_output( "CHWID", NRO_ARYMAX, CHWID ) ;728 // 729 for ( int i = 0 ; i < NRO_ARYMAX; i++) {656 // nro_debug_output( "CHWID", arymax, CHWID ) ; 657 // 658 for ( int i = 0 ; i < arymax ; i++) { 730 659 if ( readHeader( ARRY[i], sameEndian ) == -1 ) { 731 660 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ; … … 734 663 } 735 664 // DEBUG 736 // nro_debug_output( "ARRY", NRO_ARYMAX, ARRY ) ;737 // 738 for ( int i = 0 ; i < NRO_ARYMAX; i++) {665 // nro_debug_output( "ARRY", arymax, ARRY ) ; 666 // 667 for ( int i = 0 ; i < arymax ; i++) { 739 668 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) { 740 669 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ; … … 743 672 } 744 673 // DEBUG 745 // nro_debug_output( "NFCAL", NRO_ARYMAX, NFCAL ) ;746 // 747 for ( int i = 0 ; i < NRO_ARYMAX; i++) {674 // nro_debug_output( "NFCAL", arymax, NFCAL ) ; 675 // 676 for ( int i = 0 ; i < arymax ; i++) { 748 677 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) { 749 678 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ; … … 752 681 } 753 682 // DEBUG 754 // nro_debug_output( "F0CAL", NRO_ARYMAX, F0CAL ) ;755 // 756 for ( int i = 0 ; i < NRO_ARYMAX; i++) {683 // nro_debug_output( "F0CAL", arymax, F0CAL ) ; 684 // 685 for ( int i = 0 ; i < arymax ; i++) { 757 686 for ( int j = 0 ; j < 10 ; j++ ) { 758 687 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) { … … 763 692 } 764 693 // DEBUG 765 // nro_debug_output( "FQCAL", NRO_ARYMAX, 10, FQCAL ) ;694 // nro_debug_output( "FQCAL", arymax, 10, FQCAL ) ; 766 695 // 767 for ( int i = 0 ; i < NRO_ARYMAX; i++) {696 for ( int i = 0 ; i < arymax ; i++) { 768 697 for ( int j = 0 ; j < 10 ; j++ ) { 769 698 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) { … … 774 703 } 775 704 // DEBUG 776 // nro_debug_output( "CHCAL", NRO_ARYMAX, 10, CHCAL ) ;705 // nro_debug_output( "CHCAL", arymax, 10, CHCAL ) ; 777 706 // 778 for ( int i = 0 ; i < NRO_ARYMAX; i++) {707 for ( int i = 0 ; i < arymax ; i++) { 779 708 for ( int j = 0 ; j < 10 ; j++ ) { 780 709 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) { … … 785 714 } 786 715 // DEBUG 787 // nro_debug_output( "CWCAL", NRO_ARYMAX, 10, CWCAL ) ;716 // nro_debug_output( "CWCAL", arymax, 10, CWCAL ) ; 788 717 // 789 718 if ( readHeader( SCNLEN, sameEndian ) == -1 ) { … … 828 757 // 829 758 830 //scanNum_ = NSCAN + 1 ; // includes ZERO scan831 scanLen_ = SCNLEN ;832 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;833 scanNum_ = getScanNum();834 rowNum_ = scanNum_ * ARYNM ;835 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;836 record_->LDATA = new char[dataLen_] ;837 838 initArray();839 840 show() ;841 842 759 return 0 ; 843 760 } -
trunk/external-alma/atnf/PKSIO/NROOTFDataset.h
r2777 r2782 77 77 virtual void initialize() ; 78 78 79 // fill header from file80 virtual int fillHeader() ;81 82 79 protected: 83 80 // fill header information -
trunk/external-alma/atnf/PKSIO/NROReader.cc
r2780 r2782 103 103 // otherwise, read SITE0 104 104 NRODataset *d = new NROOTFDataset( filename ) ; 105 d->initialize() ; 105 106 int size = d->getDataSize() - 188 ; 106 107 delete d ; … … 118 119 else { 119 120 d = new ASTEDataset( filename ) ; 121 d->initialize() ; 120 122 size = d->getDataSize() - 188 ; 121 123 delete d ;
Note:
See TracChangeset
for help on using the changeset viewer.