Changeset 2475
- Timestamp:
- 04/23/12 16:43:34 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r2474 r2475 269 269 */ 270 270 specCol.get(k, spec); 271 tsysCol.get(k, tsys); 271 //tsysCol.get(k, tsys); 272 tsys.assign( tsysCol(k) ); 272 273 intCol.get(k, inter); 273 274 mjdCol.get(k, time); … … 3605 3606 } 3606 3607 // combine spectra 3607 ArrayColumn<Float> specColOut ; 3608 specColOut.attach( out->table(), "SPECTRA" ) ; 3609 ArrayColumn<uChar> flagColOut ; 3610 flagColOut.attach( out->table(), "FLAGTRA" ) ; 3611 ScalarColumn<uInt> ifnoColOut ; 3612 ifnoColOut.attach( out->table(), "IFNO" ) ; 3613 ScalarColumn<uInt> polnoColOut ; 3614 polnoColOut.attach( out->table(), "POLNO" ) ; 3615 ScalarColumn<uInt> freqidColOut ; 3616 freqidColOut.attach( out->table(), "FREQ_ID" ) ; 3608 ArrayColumn<Float> specColOut( out->table(), "SPECTRA" ) ; 3609 ArrayColumn<uChar> flagColOut( out->table(), "FLAGTRA" ) ; 3610 ArrayColumn<Float> tsysColOut( out->table(), "TSYS" ) ; 3611 ScalarColumn<uInt> ifnoColOut( out->table(), "IFNO" ) ; 3612 ScalarColumn<uInt> polnoColOut( out->table(), "POLNO" ) ; 3613 ScalarColumn<uInt> freqidColOut( out->table(), "FREQ_ID" ) ; 3617 3614 // MDirection::ScalarColumn dirColOut ; 3618 3615 // dirColOut.attach( out->table(), "DIRECTION" ) ; … … 3622 3619 TableIterator iter( tab, cols ) ; 3623 3620 vector< vector<uInt> > sizes( freqgrp.size() ) ; 3621 vector<uInt> totalsizes( freqgrp.size(), 0 ) ; 3622 ArrayColumn<Float> specCols ; 3623 ArrayColumn<uChar> flagCols ; 3624 ArrayColumn<Float> tsysCols ; 3625 ScalarColumn<uInt> polnos ; 3626 vector< Vector<Float> > specout( freqgrp.size() ) ; 3627 vector< Vector<uChar> > flagout( freqgrp.size() ) ; 3628 vector< Vector<Float> > tsysout( freqgrp.size() ) ; 3624 3629 while( !iter.pastEnd() ) { 3625 vector< vector<Float> > specout( freqgrp.size() ) ;3626 vector< vector<uChar> > flagout( freqgrp.size() ) ;3627 ArrayColumn<Float> specCols ;3628 3630 specCols.attach( iter.table(), "SPECTRA" ) ; 3629 ArrayColumn<uChar> flagCols ;3630 3631 flagCols.attach( iter.table(), "FLAGTRA" ) ; 3632 tsysCols.attach( iter.table(), "TSYS" ) ; 3631 3633 ifnoCol.attach( iter.table(), "IFNO" ) ; 3632 ScalarColumn<uInt> polnos ;3633 3634 polnos.attach( iter.table(), "POLNO" ) ; 3634 3635 // MDirection::ScalarColumn dircol ; … … 3671 3672 // } 3672 3673 // get a list of number of channels for each frequency group member 3673 for ( uInt igrp = 0 ; igrp < freqgrp.size() ; igrp++ ) { 3674 sizes[igrp].resize( freqgrp[igrp].size() ) ; 3675 for ( uInt imem = 0 ; imem < freqgrp[igrp].size() ; imem++ ) { 3676 for ( uInt irow = 0 ; irow < iter.table().nrow() ; irow++ ) { 3677 uInt ifno = ifnoCol( irow ) ; 3678 if ( ifno == freqgrp[igrp][imem] ) { 3679 Vector<Float> spec = specCols( irow ) ; 3680 sizes[igrp][imem] = spec.nelements() ; 3681 break ; 3682 } 3683 } 3684 } 3685 } 3674 if ( totalsizes[0] == 0 ) { 3675 for ( uInt igrp = 0 ; igrp < freqgrp.size() ; igrp++ ) { 3676 sizes[igrp].resize( freqgrp[igrp].size() ) ; 3677 for ( uInt imem = 0 ; imem < freqgrp[igrp].size() ; imem++ ) { 3678 for ( uInt irow = 0 ; irow < iter.table().nrow() ; irow++ ) { 3679 uInt ifno = ifnoCol( irow ) ; 3680 if ( ifno == freqgrp[igrp][imem] ) { 3681 Vector<Float> spec = specCols( irow ) ; 3682 sizes[igrp][imem] = spec.nelements() ; 3683 totalsizes[igrp] += sizes[igrp][imem] ; 3684 break ; 3685 } 3686 } 3687 } 3688 specout[igrp].resize( totalsizes[igrp] ) ; 3689 flagout[igrp].resize( totalsizes[igrp] ) ; 3690 tsysout[igrp].resize( totalsizes[igrp] ) ; 3691 } 3692 } 3693 3686 3694 // combine spectra 3687 3695 for ( uInt irow = 0 ; irow < out->table().nrow() ; irow++ ) { … … 3697 3705 } 3698 3706 } 3707 IPosition startpos( 1, 0 ) ; 3708 IPosition endpos( 1, 0 ) ; 3699 3709 for ( uInt imem = 0 ; imem < freqgrp[igrp].size() ; imem++ ) { 3700 3710 for ( uInt jrow = 0 ; jrow < iter.table().nrow() ; jrow++ ) { … … 3711 3721 // if ( ifno == freqgrp[igrp][imem] && dd <= tol ) { 3712 3722 if ( ifno == freqgrp[igrp][imem] ) { 3723 endpos[0] = startpos[0] + sizes[igrp][imem] - 1 ; 3713 3724 Vector<Float> spec = specCols( jrow ) ; 3714 3725 Vector<uChar> flag = flagCols( jrow ) ; 3715 vector<Float> svec ; 3716 spec.tovector( svec ) ; 3717 vector<uChar> fvec ; 3718 flag.tovector( fvec ) ; 3726 Vector<Float> tsys = tsysCols( jrow ) ; 3719 3727 //os << "spec.size() = " << svec.size() << " fvec.size() = " << fvec.size() << LogIO::POST ; 3720 specout[igrp].insert( specout[igrp].end(), svec.begin(), svec.end() ) ; 3721 flagout[igrp].insert( flagout[igrp].end(), fvec.begin(), fvec.end() ) ; 3728 specout[igrp]( startpos, endpos ) = spec ; 3729 flagout[igrp]( startpos, endpos ) = flag ; 3730 if ( spec.size() == tsys.size() ) { 3731 tsysout[igrp]( startpos, endpos ) = tsys ; 3732 } 3733 else { 3734 tsysout[igrp]( startpos, endpos ) = tsys[0] ; 3735 } 3722 3736 //os << "specout[" << igrp << "].size() = " << specout[igrp].size() << LogIO::POST ; 3737 startpos[0] += sizes[igrp][imem] ; 3723 3738 } 3724 3739 } 3725 3740 } 3726 3741 // set SPECTRA and FRAGTRA 3727 Vector<Float> newspec( specout[igrp] ) ; 3728 Vector<uChar> newflag( flagout[igrp] ) ; 3729 specColOut.put( irow, newspec ) ; 3730 flagColOut.put( irow, newflag ) ; 3742 specColOut.put( irow, specout[igrp] ) ; 3743 flagColOut.put( irow, flagout[igrp] ) ; 3744 tsysColOut.put( irow, tsysout[igrp] ) ; 3731 3745 // IFNO renumbering (renumbered as frequency group ID) 3732 3746 ifnoColOut.put( irow, igrp ) ; -
trunk/src/Scantable.cpp
r2463 r2475 1880 1880 Vector<Float> oldspec = specCol_( irow ) ; 1881 1881 Vector<uChar> oldflag = flagsCol_( irow ) ; 1882 Vector<Float> oldtsys = tsysCol_( irow ) ; 1882 1883 uInt newsize = nmax - nmin + 1 ; 1883 specCol_.put( irow, oldspec( Slice( nmin, newsize, 1 ) ) ) ; 1884 flagsCol_.put( irow, oldflag( Slice( nmin, newsize, 1 ) ) ) ; 1884 Slice slice( nmin, newsize, 1 ) ; 1885 specCol_.put( irow, oldspec( slice ) ) ; 1886 flagsCol_.put( irow, oldflag( slice ) ) ; 1887 if ( oldspec.size() == oldtsys.size() ) 1888 tsysCol_.put( irow, oldtsys( slice ) ) ; 1885 1889 1886 1890 return ;
Note:
See TracChangeset
for help on using the changeset viewer.