Changeset 2198 for trunk/external-alma/atnf/PKSIO
- Timestamp:
- 06/23/11 17:29:35 (14 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2156 r2198 83 83 } 84 84 same_ = -1 ; 85 86 // Record for frequency setting 87 frec_ = Record() ; 85 88 } 86 89 … … 664 667 NRODataRecord *record = getRecord( i ) ; 665 668 string arryt = string( record->ARRYT ) ; 666 //string sbeamno = arryt.substr( 1, arryt.size()-1 ) ;667 //uInt ib = atoi( sbeamno.c_str() ) - 1 ;668 669 uInt ib = getArrayId( arryt ) ; 669 670 670 int ia = -1 ; 671 if ( frec_.isDefined( arryt ) ) { 672 // frequency for the array is already calculated 673 Vector<Double> f = frec_.asArrayDouble( arryt ) ; 674 Double *f_p = f.data() ; 675 for ( int i = 0 ; i < 3 ; i++ ) 676 v[i] = (double)(f_p[i]) ; 677 return v ; 678 } 679 680 //int ia = -1 ; 671 681 bool isAOS = false ; 672 682 //cout << "NRODataset::getFrequencies() record->ARRYT=" << record->ARRYT << endl ; 673 683 //cout << "NRODataset::getFrequencies() ib = " << ib << endl ; 674 684 675 if ( strncmp( record->ARRYT, "X", 1 ) == 0 ) { 676 // FX 677 if ( strncmp( (record->ARRYT)+1, "1", 1 ) == 0 678 || strncmp( (record->ARRYT)+1, "3", 1 ) ) { 679 // FX1, 3 680 ia = 2 ; 681 } 682 else { 683 // FX2, 4 684 ia = 1 ; 685 } 686 } 687 else if ( strncmp( record->ARRYT, "A", 1 ) == 0 ) 688 ia = 2 ; // AC 689 else if ( strncmp( record->ARRYT, "W", 1 ) == 0 ) { 690 // AOS-W 691 ia = 2 ; 685 // if ( strncmp( record->ARRYT, "X", 1 ) == 0 ) { 686 // // FX 687 // if ( strncmp( (record->ARRYT)+1, "1", 1 ) == 0 688 // || strncmp( (record->ARRYT)+1, "3", 1 ) ) { 689 // // FX1, 3 690 // ia = 2 ; 691 // } 692 // else { 693 // // FX2, 4 694 // ia = 1 ; 695 // } 696 // } 697 // else if ( strncmp( record->ARRYT, "A", 1 ) == 0 ) 698 // ia = 2 ; // AC 699 // else if ( strncmp( record->ARRYT, "W", 1 ) == 0 ) { 700 // // AOS-W 701 // ia = 2 ; 702 // isAOS = true ; 703 // } 704 // else if ( strncmp( record->ARRYT, "U", 1 ) == 0 ) { 705 // // AOS-U 706 // ia = 2 ; 707 // isAOS = true ; 708 // } 709 // else if ( strncmp( record->ARRYT, "H", 1 ) == 0 ) { 710 // // AOS-H 711 // isAOS = true ; 712 // //cout << record->ARRYT << " " << strlen(record->ARRYT) << endl ; 713 // //cout << (record->ARRYT)+1 << endl ; 714 // if ( strncmp( (record->ARRYT)+2, " ", 1 ) == 0 ) { 715 // // H1-9 716 // if ( strncmp( (record->ARRYT)+1, "9", 1 ) == 0 ) { 717 // // H9 718 // ia = 2 ; 719 // } 720 // else { 721 // // H1-8 722 // ia = 1 ; 723 // } 724 // } 725 // else { 726 // // H10-16 727 // ia = 2 ; 728 // } 729 // } 730 if ( arryt[0] == 'A' || arryt[0] == 'W' || arryt[0] == 'U' || arryt[0] == 'H' ) 692 731 isAOS = true ; 693 } 694 else if ( strncmp( record->ARRYT, "U", 1 ) == 0 ) { 695 // AOS-U 696 ia = 2 ; 697 isAOS = true ; 698 } 699 else if ( strncmp( record->ARRYT, "H", 1 ) == 0 ) { 700 // AOS-H 701 isAOS = true ; 702 //cout << record->ARRYT << " " << strlen(record->ARRYT) << endl ; 703 //cout << (record->ARRYT)+1 << endl ; 704 if ( strncmp( (record->ARRYT)+2, " ", 1 ) == 0 ) { 705 // H1-9 706 if ( strncmp( (record->ARRYT)+1, "9", 1 ) == 0 ) { 707 // H9 708 ia = 2 ; 709 } 710 else { 711 // H1-8 712 ia = 1 ; 713 } 714 } 715 else { 716 // H10-16 717 ia = 2 ; 718 } 719 } 720 721 int iu ; 732 733 Bool isUSB ; 722 734 if ( record->FQIF1 > 0 ) 723 i u = 1; // USB735 isUSB = True ; // USB 724 736 else 725 i u = 2; // LSB737 isUSB = False ; // LSB 726 738 727 739 int ivdef = -1 ; 728 //if ( strncmp( (dataset_->getVDEF()).c_str(), "RAD", 3 ) == 0 )729 740 if ( (getVDEF()).compare( 0, 3, "RAD" ) == 0 ) 730 741 ivdef = 0 ; 731 //else if ( strncmp( dataset_->getVDEF(), "OPT", 3 ) == 0 )732 742 else if ( (getVDEF()).compare( 0, 3, "OPT" ) == 0 ) 733 743 ivdef = 1 ; … … 741 751 742 752 int ncal = getNFCAL()[ib] ; 743 vector<double> freqs( ncal ) ;744 753 double cw = 0.0 ; 745 754 vector<double> fqcal = getFQCAL()[ib] ; 746 755 vector<double> chcal = getCHCAL()[ib] ; 747 756 double f0cal = getF0CAL()[ib] ; 757 Vector<Double> freqs( ncal, fq0-f0cal ) ; 758 759 double factor = vel / cvel ; 760 if ( ivdef == 0 ) 761 factor = 1.0 / ( 1.0 - factor ) ; 748 762 for ( int ii = 0 ; ii < ncal ; ii++ ) { 749 freqs[ii] = fqcal[ii] ; 750 freqs[ii] -= getF0CAL()[ib] ; 751 if ( ia == 1 ) { 752 if ( iu == 1 ) { 753 freqs[ii] = fq0 + freqs[ii] ; 754 } 755 else if ( iu == 2 ) { 756 freqs[ii] = fq0 - freqs[ii] ; 757 } 758 } 759 else if ( ia == 2 ) { 760 if ( iu == 1 ) { 761 freqs[ii] = fq0 - freqs[ii] ; 762 } 763 else if ( iu == 2 ) { 764 freqs[ii] = fq0 + freqs[ii] ; 765 } 766 } 767 // if ( ivdef == 0 ) { 768 // double factor = 1.0 / ( 1.0 - vel / cvel ) ; 769 // freqs[ii] = freqs[ii] * factor - record->FQTRK * ( factor - 1.0 ) ; 770 // } 771 // else if ( ivdef == 1 ) { 772 // double factor = vel / cvel ; 773 // freqs[ii] = freqs[ii] * ( 1.0 + factor ) - record->FQTRK * factor ; 774 // } 763 freqs[ii] += fqcal[ii] ; 764 if ( ivdef == 0 ) { 765 freqs[ii] = freqs[ii] * factor + record->FQTRK * ( 1.0 - factor ) ; 766 } 767 else if ( ivdef == 1 ) { 768 freqs[ii] = freqs[ii] * ( 1.0 + factor ) - record->FQTRK * factor ; 769 } 770 771 //ofstream ofs("freqs.txt",ios::out|ios::app) ; 772 //ofs << setprecision(16) ; 773 //ofs << i << " " << record->ARRYT << " " << chcal[ii] << " " << freqs[ii] << " " << record->ISCAN << " " << fqcal[ii] << " " << f0cal << " " << record->FQTRK << " " << vel << endl ; 774 //ofs.close() ; 775 775 776 } 776 777 … … 798 799 else { 799 800 cw = getBERES()[ib] ; 801 802 if ( !isUSB ) 803 cw *= -1.0 ; 800 804 801 if ( iu == 2 )802 cw *= -1.0 ;803 804 805 if ( cw == 0.0 ) { 805 806 cw = ( freqs[1] - freqs[0] ) 806 807 / ( chcal[1] - chcal[0] ) ; 807 // if ( cw < 0.0 ) 808 // cw = - cw ; 809 } 808 } 809 810 810 v[0] = chcal[0] - 1 ; // 0-base 811 811 v[1] = freqs[0] ; … … 813 813 } 814 814 815 // conversion from TOPO to LSRK 816 v[1] = toLSR( v[1], getStartIntTime( i ), record_->SCX, record_->SCY ) ; 817 818 if ( refFreq_[ib] != 0.0 ) { 819 v[1] = refFreq_[ib] ; 820 } 821 else { 815 if ( refFreq_[ib] == 0.0 ) 822 816 refFreq_[ib] = v[1] ; 823 } 817 818 // register frequency setting to Record 819 Vector<Double> f( v ) ; 820 frec_.define( arryt, f ) ; 824 821 825 822 return v ; -
trunk/external-alma/atnf/PKSIO/NRODataset.h
r2156 r2198 41 41 //#include <casa/aips.h> 42 42 #include <casa/Logging/LogIO.h> 43 #include <casa/Containers/Record.h> 43 44 #include <atnf/PKSIO/NRODataRecord.h> 44 45 #include <casa/namespace.h> … … 513 514 // reference frequency for each array 514 515 vector<double> refFreq_ ; 516 517 // record to store REFPIX, REFVAL, INCREMENT pair for each array 518 Record frec_ ; 515 519 } ; 516 520 -
trunk/external-alma/atnf/PKSIO/NROReader.cc
r2158 r2198 456 456 } 457 457 //freqref = vref ; 458 freqref = "LSRK" ;459 //freqref = "REST" ;458 //freqref = "LSRK" ; 459 freqref = "REST" ; 460 460 //cout << "freqref = " << freqref << endl ; 461 461 NRODataRecord *record = dataset_->getRecord( 0 ) ;
Note:
See TracChangeset
for help on using the changeset viewer.