Changeset 2369
- Timestamp:
- 12/14/11 18:13:54 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2368 r2369 550 550 else if ( wtype_.compare( "TINT" ) == 0 ) { 551 551 if ( npol_ > 1 ) warn = True ; 552 Bool b0, b1 ; 553 Float *w_p = w.getStorage( b0 ) ; 554 Float *w0_p = w_p ; 555 const Double *ti_p = tint.getStorage( b1 ) ; 556 const Double *w1_p = ti_p ; 552 557 for ( Int irow = 0 ; irow < nrow_ ; irow++ ) { 553 Float val = mean( tint.column( irow ) ) ; 554 w.column( irow ) = val ; 555 } 558 Float val = (Float)(polMean( w1_p )) ; 559 for ( Int ichan = 0 ; ichan < nchan_ ; ichan++ ) { 560 *w0_p = val ; 561 w0_p++ ; 562 } 563 } 564 w.putStorage( w_p, b0 ) ; 565 tint.freeStorage( ti_p, b1 ) ; 556 566 } 557 567 else if ( wtype_.compare( "TSYS" ) == 0 ) { 558 568 if ( npol_ > 1 ) warn = True ; 569 Bool b0, b1 ; 570 Float *w_p = w.getStorage( b0 ) ; 571 Float *w0_p = w_p ; 572 const Float *ts_p = tsys.getStorage( b1 ) ; 573 const Float *w1_p = ts_p ; 559 574 for ( Int irow = 0 ; irow < nrow_ ; irow++ ) { 560 Matrix<Float> arr = tsys.xyPlane( irow ) ;561 575 for ( Int ichan = 0 ; ichan < nchan_ ; ichan++ ) { 562 Float val = mean( arr.column( ichan ) ) ; 563 w(ichan,irow) = 1.0 / ( val * val ) ; 576 Float val = polMean( w1_p ) ; 577 *w0_p = 1.0 / ( val * val ) ; 578 w0_p++ ; 564 579 } 565 580 } 581 w.putStorage( w_p, b0 ) ; 582 tsys.freeStorage( ts_p, b1 ) ; 566 583 } 567 584 else if ( wtype_.compare( "TINTSYS" ) == 0 ) { 568 585 if ( npol_ > 1 ) warn = True ; 586 Bool b0, b1, b2 ; 587 Float *w_p = w.getStorage( b0 ) ; 588 Float *w0_p = w_p ; 589 const Double *ti_p = tint.getStorage( b1 ) ; 590 const Double *w1_p = ti_p ; 591 const Float *ts_p = tsys.getStorage( b2 ) ; 592 const Float *w2_p = ts_p ; 569 593 for ( Int irow = 0 ; irow < nrow_ ; irow++ ) { 570 Float interval = mean( tint.column( irow ) ) ; 571 Matrix<Float> arr = tsys.xyPlane( irow ) ; 594 Float interval = (Float)(polMean( w1_p )) ; 572 595 for ( Int ichan = 0 ; ichan < nchan_ ; ichan++ ) { 573 Float temp = mean( arr.column( ichan ) ) ; 574 w(ichan,irow) = interval / ( temp * temp ) ; 596 Float temp = polMean( w2_p ) ; 597 *w0_p = interval / ( temp * temp ) ; 598 w0_p++ ; 575 599 } 576 600 } 601 w.putStorage( w_p, b0 ) ; 602 tint.freeStorage( ti_p, b1 ) ; 603 tsys.freeStorage( ts_p, b2 ) ; 577 604 } 578 605 else { … … 588 615 t1 = mathutil::gettimeofday_sec() ; 589 616 os << "getWeight: elapsed time is " << t1-t0 << " sec" << LogIO::POST ; 617 } 618 619 Float STGrid::polMean( const Float *p ) 620 { 621 Float v = 0.0 ; 622 for ( Int i = 0 ; i < npol_ ; i++ ) { 623 v += *p ; 624 p++ ; 625 } 626 v /= npol_ ; 627 return v ; 628 } 629 630 Double STGrid::polMean( const Double *p ) 631 { 632 Double v = 0.0 ; 633 for ( Int i = 0 ; i < npol_ ; i++ ) { 634 v += *p ; 635 p++ ; 636 } 637 v /= npol_ ; 638 return v ; 590 639 } 591 640 -
trunk/src/STGrid.h
r2368 r2369 108 108 void selectData( Table &tab ) ; 109 109 110 Float polMean( const Float *p ) ; 111 Double polMean( const Double *p ) ; 112 110 113 String infile_ ; 111 114 Int ifno_ ;
Note:
See TracChangeset
for help on using the changeset viewer.