Changeset 1693 for branches/alma/src
- Timestamp:
- 02/10/10 19:39:06 (15 years ago)
- Location:
- branches/alma/src
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/src/Makefile
r1608 r1693 134 134 python_STWriter.o \ 135 135 python_LineCatalog.o \ 136 python_SrcType.o \ 136 137 python_asap.o 137 138 -
branches/alma/src/STMath.cpp
r1682 r1693 43 43 #include <scimath/Mathematics/Convolver.h> 44 44 #include <scimath/Functionals/Polynomial.h> 45 46 #include <atnf/PKSIO/SrcType.h> 45 47 46 48 #include <casa/Logging/LogIO.h> … … 819 821 // make this operation non insitu 820 822 const Table& tin = in->table(); 821 Table ons = tin(tin.col("SRCTYPE") == Int( 0));822 Table offs = tin(tin.col("SRCTYPE") == Int( 1));823 Table ons = tin(tin.col("SRCTYPE") == Int(SrcType::PSON)); 824 Table offs = tin(tin.col("SRCTYPE") == Int(SrcType::PSOFF)); 823 825 if ( offs.nrow() == 0 ) 824 826 throw(AipsError("No 'off' scans present.")); … … 1203 1205 setInsitu(false); 1204 1206 STSelector sel; 1205 std::vector<int> scan1, scan2, beams ;1207 std::vector<int> scan1, scan2, beams, types; 1206 1208 std::vector< vector<int> > scanpair; 1207 std::vector<string> calstate; 1209 //std::vector<string> calstate; 1210 std::vector<int> calstate; 1208 1211 String msg; 1209 1212 … … 1252 1255 scanpair.push_back(scan1); 1253 1256 scanpair.push_back(scan2); 1254 calstate.push_back("*calon"); 1255 calstate.push_back("*[^calon]"); 1257 //calstate.push_back("*calon"); 1258 //calstate.push_back("*[^calon]"); 1259 calstate.push_back(SrcType::NODCAL); 1260 calstate.push_back(SrcType::NOD); 1256 1261 CountedPtr< Scantable > ws = getScantable(s, false); 1257 1262 uInt l=0; … … 1262 1267 sel.reset(); 1263 1268 sel.setScans(scanpair[i]); 1264 sel.setName(calstate[k]); 1269 //sel.setName(calstate[k]); 1270 types.clear(); 1271 types.push_back(calstate[k]); 1272 sel.setTypes(types); 1265 1273 beams.clear(); 1266 1274 beams.push_back(j); … … 1377 1385 CountedPtr< Scantable > calsig, calref, out, out1, out2; 1378 1386 Bool nofold=False; 1387 vector<int> types ; 1379 1388 1380 1389 //split the data 1381 sel.setName("*_fs"); 1390 //sel.setName("*_fs"); 1391 types.push_back( SrcType::FSON ) ; 1392 sel.setTypes( types ) ; 1382 1393 ws->setSelection(sel); 1383 1394 sig = getScantable(ws,false); 1384 1395 sel.reset(); 1385 sel.setName("*_fs_calon"); 1396 types.clear() ; 1397 //sel.setName("*_fs_calon"); 1398 types.push_back( SrcType::FONCAL ) ; 1399 sel.setTypes( types ) ; 1386 1400 ws->setSelection(sel); 1387 1401 sigwcal = getScantable(ws,false); 1388 1402 sel.reset(); 1389 sel.setName("*_fsr"); 1403 types.clear() ; 1404 //sel.setName("*_fsr"); 1405 types.push_back( SrcType::FSOFF ) ; 1406 sel.setTypes( types ) ; 1390 1407 ws->setSelection(sel); 1391 1408 ref = getScantable(ws,false); 1392 1409 sel.reset(); 1393 sel.setName("*_fsr_calon"); 1410 types.clear() ; 1411 //sel.setName("*_fsr_calon"); 1412 types.push_back( SrcType::FOFFCAL ) ; 1413 sel.setTypes( types ) ; 1394 1414 ws->setSelection(sel); 1395 1415 refwcal = getScantable(ws,false); 1416 sel.reset() ; 1417 types.clear() ; 1396 1418 1397 1419 calsig = dototalpower(sigwcal, sig, tcal=tcal); … … 3540 3562 } 3541 3563 else { 3542 string skystr = "*_sky" ;3543 string hotstr = "*_hot" ;3544 string coldstr = "*_cold" ;3545 string onstr = "*_" ;3546 string offstr = "*_" ;3547 3548 if ( calmode == "ps" || calmode == "otf" ) {3549 onstr += "pson" ;3550 offstr += "psoff" ;3551 }3552 else if ( calmode == "wob" ) {3553 onstr += "wobon" ;3554 offstr += "woboff" ;3555 }3556 3557 3564 vector<bool> masks = s->getMask( 0 ) ; 3558 3565 vector<int> types ; 3566 3559 3567 // sky scan 3560 3568 STSelector sel = STSelector() ; 3561 sel.setName( skystr ) ; 3569 types.push_back( SrcType::SKY ) ; 3570 sel.setTypes( types ) ; 3562 3571 s->setSelection( sel ) ; 3563 3572 vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ; … … 3565 3574 s->unsetSelection() ; 3566 3575 sel.reset() ; 3576 types.clear() ; 3567 3577 3568 3578 // hot scan 3569 sel.setName( hotstr ) ; 3579 types.push_back( SrcType::HOT ) ; 3580 sel.setTypes( types ) ; 3570 3581 s->setSelection( sel ) ; 3571 tmp[0] = getScantable( s, false ) ; 3582 tmp.clear() ; 3583 tmp.push_back( getScantable( s, false ) ) ; 3572 3584 CountedPtr<Scantable> ahot = average( tmp, masks, "TINT", "SCAN" ) ; 3573 3585 s->unsetSelection() ; 3574 3586 sel.reset() ; 3587 types.clear() ; 3575 3588 3576 3589 // cold scan 3577 sel.setName( coldstr ) ; 3590 CountedPtr<Scantable> acold ; 3591 // types.push_back( SrcType::COLD ) ; 3592 // sel.setTypes( types ) ; 3593 // s->setSelection( sel ) ; 3594 // tmp.clear() ; 3595 // tmp.push_back( getScantable( s, false ) ) ; 3596 // CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCNAN" ) ; 3597 // s->unsetSelection() ; 3598 // sel.reset() ; 3599 // types.clear() ; 3600 3601 // off scan 3602 types.push_back( SrcType::PSOFF ) ; 3603 sel.setTypes( types ) ; 3578 3604 s->setSelection( sel ) ; 3579 tmp[0] = getScantable( s, false ) ; 3580 CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCNAN" ) ; 3581 s->unsetSelection() ; 3582 sel.reset() ; 3583 3584 // off scan 3585 sel.setName( offstr ) ; 3586 s->setSelection( sel ) ; 3587 tmp[0] = getScantable( s, false ) ; 3605 tmp.clear() ; 3606 tmp.push_back( getScantable( s, false ) ) ; 3588 3607 CountedPtr<Scantable> aoff = average( tmp, masks, "TINT", "SCAN" ) ; 3589 3608 s->unsetSelection() ; 3590 3609 sel.reset() ; 3610 types.clear() ; 3591 3611 3592 3612 // on scan … … 3595 3615 CountedPtr<Scantable> out = getScantable( s, true ) ; 3596 3616 insitu_ = insitu ; 3597 sel.setName( onstr ) ; 3617 types.push_back( SrcType::PSON ) ; 3618 sel.setTypes( types ) ; 3598 3619 s->setSelection( sel ) ; 3599 3620 TableCopy::copyRows( out->table(), s->table() ) ; 3600 3621 s->unsetSelection() ; 3601 3622 sel.reset() ; 3623 types.clear() ; 3602 3624 3603 3625 // process each on scan … … 3622 3644 } 3623 3645 3624 // remove additional string from SRCNAME3625 ScalarColumn<String> srcnameCol ;3626 srcnameCol.attach( out->table(), "SRCNAME" ) ;3627 Vector<String> srcnames( srcnameCol.getColumn() ) ;3628 for ( uInt i = 0 ; i < srcnames.nelements() ; i++ ) {3629 srcnames[i] = srcnames[i].substr( 0, srcnames[i].find( onstr.substr(1,onstr.size()-1) ) ) ;3630 }3631 srcnameCol.putColumn( srcnames ) ;3632 3633 3646 // flux unit 3634 3647 out->setFluxUnit( "K" ) ; … … 3650 3663 // off scan 3651 3664 STSelector sel = STSelector() ; 3652 string taql = "SELECT FROM $1 WHERE SRCTYPE == 1" ; 3653 sel.setTaQL( taql ) ; 3665 vector<int> types ; 3666 types.push_back( SrcType::PSOFF ) ; 3667 sel.setTypes( types ) ; 3654 3668 s->setSelection( sel ) ; 3655 3669 // TODO 2010/01/08 TN … … 3692 3706 s->unsetSelection() ; 3693 3707 sel.reset() ; 3708 types.clear() ; 3694 3709 3695 3710 // on scan … … 3698 3713 CountedPtr<Scantable> out = getScantable( s, true ) ; 3699 3714 insitu_ = insitu ; 3700 t aql = "SELECT FROM $1 WHERE SRCTYPE == 0";3701 sel.setT aQL( taql) ;3715 types.push_back( SrcType::PSON ) ; 3716 sel.setTypes( types ) ; 3702 3717 s->setSelection( sel ) ; 3703 3718 TableCopy::copyRows( out->table(), s->table() ) ; 3704 3719 s->unsetSelection() ; 3705 3720 sel.reset() ; 3721 types.clear() ; 3706 3722 3707 3723 // process each on scan … … 3723 3739 const String antname ) 3724 3740 { 3725 string skystr = "*_sky" ; 3726 string skystr1 = "*_fslo_sky" ; 3727 string skystr2 = "*_fshi_sky" ; 3728 string hotstr = "*_hot" ; 3729 string hotstr1 = "*_fslo_hot" ; 3730 string hotstr2 = "*_fshi_hot" ; 3731 string coldstr = "*_cold" ; 3732 string coldstr1 = "*_fslo_cold" ; 3733 string coldstr2 = "*_fshi_cold" ; 3734 string offstr1 = "*_fslo_off" ; 3735 string offstr2 = "*_fshi_off" ; 3736 string sigstr = "*_" ; 3737 string refstr = "*_" ; 3741 vector<int> types ; 3738 3742 3739 3743 // APEX calibration mode … … 3741 3745 3742 3746 if ( antname.find( "APEX" ) != string::npos ) { 3743 sigstr += "fslo" ;3744 refstr += "fshi" ;3745 3746 3747 // check if off scan exists or not 3747 3748 STSelector sel = STSelector() ; 3748 sel.setName( offstr1 ) ; 3749 //sel.setName( offstr1 ) ; 3750 types.push_back( SrcType::FLOOFF ) ; 3751 sel.setTypes( types ) ; 3749 3752 try { 3750 3753 s->setSelection( sel ) ; … … 3753 3756 apexcalmode = 0 ; 3754 3757 } 3755 } 3756 else { 3757 sigstr += "fssig" ; 3758 refstr += "fsref" ; 3759 } 3758 sel.reset() ; 3759 } 3760 s->unsetSelection() ; 3761 types.clear() ; 3760 3762 3761 3763 vector<bool> masks = s->getMask( 0 ) ; … … 3763 3765 CountedPtr<Scantable> out ; 3764 3766 3765 if ( antname.find( "APEX" ) != string::npos && apexcalmode == 0) {3766 // APEX fs data without off scan3767 if ( antname.find( "APEX" ) != string::npos ) { 3768 // APEX calibration 3767 3769 // sky scan 3768 3770 STSelector sel = STSelector() ; 3769 sel.setName( skystr1 ) ; 3771 types.push_back( SrcType::FLOSKY ) ; 3772 sel.setTypes( types ) ; 3770 3773 s->setSelection( sel ) ; 3771 3774 vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ; … … 3773 3776 s->unsetSelection() ; 3774 3777 sel.reset() ; 3775 sel.setName( skystr2 ) ; 3778 types.clear() ; 3779 types.push_back( SrcType::FHISKY ) ; 3780 sel.setTypes( types ) ; 3776 3781 s->setSelection( sel ) ; 3777 tmp[0] = getScantable( s, false ) ; 3782 tmp.clear() ; 3783 tmp.push_back( getScantable( s, false ) ) ; 3778 3784 CountedPtr<Scantable> askyhi = average( tmp, masks, "TINT", "SCAN" ) ; 3779 3785 s->unsetSelection() ; 3780 3786 sel.reset() ; 3787 types.clear() ; 3781 3788 3782 3789 // hot scan 3783 sel.setName( hotstr1 ) ; 3790 types.push_back( SrcType::FLOHOT ) ; 3791 sel.setTypes( types ) ; 3784 3792 s->setSelection( sel ) ; 3785 tmp[0] = getScantable( s, false ) ; 3793 tmp.clear() ; 3794 tmp.push_back( getScantable( s, false ) ) ; 3786 3795 CountedPtr<Scantable> ahotlo = average( tmp, masks, "TINT", "SCAN" ) ; 3787 3796 s->unsetSelection() ; 3788 3797 sel.reset() ; 3789 sel.setName( hotstr2 ) ; 3798 types.clear() ; 3799 types.push_back( SrcType::FHIHOT ) ; 3800 sel.setTypes( types ) ; 3790 3801 s->setSelection( sel ) ; 3791 tmp[0] = getScantable( s, false ) ; 3802 tmp.clear() ; 3803 tmp.push_back( getScantable( s, false ) ) ; 3792 3804 CountedPtr<Scantable> ahothi = average( tmp, masks, "TINT", "SCAN" ) ; 3793 3805 s->unsetSelection() ; 3794 3806 sel.reset() ; 3807 types.clear() ; 3795 3808 3796 3809 // cold scan 3797 sel.setName( coldstr1 ) ; 3798 s->setSelection( sel ) ; 3799 tmp[0] = getScantable( s, false ) ; 3800 CountedPtr<Scantable> acoldlo = average( tmp, masks, "TINT", "SCAN" ) ; 3801 s->unsetSelection() ; 3802 sel.reset() ; 3803 sel.setName( coldstr2 ) ; 3804 s->setSelection( sel ) ; 3805 tmp[0] = getScantable( s, false ) ; 3806 CountedPtr<Scantable> acoldhi = average( tmp, masks, "TINT", "SCAN" ) ; 3807 s->unsetSelection() ; 3808 sel.reset() ; 3809 3810 CountedPtr<Scantable> acoldlo, acoldhi ; 3811 // types.push_back( SrcType::FLOCOLD ) ; 3812 // sel.setTypes( types ) ; 3813 // s->setSelection( sel ) ; 3814 // tmp.clear() ; 3815 // tmp.push_back( getScantable( s, false ) ) ; 3816 // CountedPtr<Scantable> acoldlo = average( tmp, masks, "TINT", "SCAN" ) ; 3817 // s->unsetSelection() ; 3818 // sel.reset() ; 3819 // types.clear() ; 3820 // types.push_back( SrcType::FHICOLD ) ; 3821 // sel.setTypes( types ) ; 3822 // s->setSelection( sel ) ; 3823 // tmp.clear() ; 3824 // tmp.push_back( getScantable( s, false ) ) ; 3825 // CountedPtr<Scantable> acoldhi = average( tmp, masks, "TINT", "SCAN" ) ; 3826 // s->unsetSelection() ; 3827 // sel.reset() ; 3828 // types.clear() ; 3829 3810 3830 // ref scan 3811 3831 bool insitu = insitu_ ; … … 3813 3833 sref = getScantable( s, true ) ; 3814 3834 insitu_ = insitu ; 3815 sel.setName( refstr ) ; 3835 types.push_back( SrcType::FSLO ) ; 3836 sel.setTypes( types ) ; 3816 3837 s->setSelection( sel ) ; 3817 3838 TableCopy::copyRows( sref->table(), s->table() ) ; 3818 3839 s->unsetSelection() ; 3819 3840 sel.reset() ; 3841 types.clear() ; 3820 3842 3821 3843 // sig scan … … 3823 3845 ssig = getScantable( s, true ) ; 3824 3846 insitu_ = insitu ; 3825 sel.setName( sigstr ) ; 3847 types.push_back( SrcType::FSHI ) ; 3848 sel.setTypes( types ) ; 3826 3849 s->setSelection( sel ) ; 3827 3850 TableCopy::copyRows( ssig->table(), s->table() ) ; 3828 3851 s->unsetSelection() ; 3829 3852 sel.reset() ; 3830 3831 // process each sig and ref scan 3832 ArrayColumn<Float> tsysCollo ; 3833 tsysCollo.attach( ssig->table(), "TSYS" ) ; 3834 ArrayColumn<Float> tsysColhi ; 3835 tsysColhi.attach( sref->table(), "TSYS" ) ; 3836 for ( int i = 0 ; i < ssig->nrow() ; i++ ) { 3837 vector< CountedPtr<Scantable> > sky( 2 ) ; 3838 sky[0] = askylo ; 3839 sky[1] = askyhi ; 3840 vector< CountedPtr<Scantable> > hot( 2 ) ; 3841 hot[0] = ahotlo ; 3842 hot[1] = ahothi ; 3843 vector< CountedPtr<Scantable> > cold( 2 ) ; 3844 cold[0] = acoldlo ; 3845 cold[1] = acoldhi ; 3846 vector<float> sp = getFSCalibratedSpectra( ssig, sref, sky, hot, cold, i ) ; 3847 ssig->setSpectrum( sp, i ) ; 3848 string reftime = ssig->getTime( i ) ; 3849 vector<int> ii( 1, ssig->getIF( i ) ) ; 3850 vector<int> ib( 1, ssig->getBeam( i ) ) ; 3851 vector<int> ip( 1, ssig->getPol( i ) ) ; 3852 sel.setIFs( ii ) ; 3853 sel.setBeams( ib ) ; 3854 sel.setPolarizations( ip ) ; 3855 askylo->setSelection( sel ) ; 3856 vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ; 3857 const Vector<Float> Vtsyslo( sptsys ) ; 3858 tsysCollo.put( i, Vtsyslo ) ; 3859 askylo->unsetSelection() ; 3853 types.clear() ; 3854 3855 if ( apexcalmode == 0 ) { 3856 // APEX fs data without off scan 3857 // process each sig and ref scan 3858 ArrayColumn<Float> tsysCollo ; 3859 tsysCollo.attach( ssig->table(), "TSYS" ) ; 3860 ArrayColumn<Float> tsysColhi ; 3861 tsysColhi.attach( sref->table(), "TSYS" ) ; 3862 for ( int i = 0 ; i < ssig->nrow() ; i++ ) { 3863 vector< CountedPtr<Scantable> > sky( 2 ) ; 3864 sky[0] = askylo ; 3865 sky[1] = askyhi ; 3866 vector< CountedPtr<Scantable> > hot( 2 ) ; 3867 hot[0] = ahotlo ; 3868 hot[1] = ahothi ; 3869 vector< CountedPtr<Scantable> > cold( 2 ) ; 3870 //cold[0] = acoldlo ; 3871 //cold[1] = acoldhi ; 3872 vector<float> sp = getFSCalibratedSpectra( ssig, sref, sky, hot, cold, i ) ; 3873 ssig->setSpectrum( sp, i ) ; 3874 string reftime = ssig->getTime( i ) ; 3875 vector<int> ii( 1, ssig->getIF( i ) ) ; 3876 vector<int> ib( 1, ssig->getBeam( i ) ) ; 3877 vector<int> ip( 1, ssig->getPol( i ) ) ; 3878 sel.setIFs( ii ) ; 3879 sel.setBeams( ib ) ; 3880 sel.setPolarizations( ip ) ; 3881 askylo->setSelection( sel ) ; 3882 vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ; 3883 const Vector<Float> Vtsyslo( sptsys ) ; 3884 tsysCollo.put( i, Vtsyslo ) ; 3885 askylo->unsetSelection() ; 3886 sel.reset() ; 3887 sky[0] = askyhi ; 3888 sky[1] = askylo ; 3889 hot[0] = ahothi ; 3890 hot[1] = ahotlo ; 3891 cold[0] = acoldhi ; 3892 cold[1] = acoldlo ; 3893 sp = getFSCalibratedSpectra( sref, ssig, sky, hot, cold, i ) ; 3894 sref->setSpectrum( sp, i ) ; 3895 reftime = sref->getTime( i ) ; 3896 ii[0] = sref->getIF( i ) ; 3897 ib[0] = sref->getBeam( i ) ; 3898 ip[0] = sref->getPol( i ) ; 3899 sel.setIFs( ii ) ; 3900 sel.setBeams( ib ) ; 3901 sel.setPolarizations( ip ) ; 3902 askyhi->setSelection( sel ) ; 3903 sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ; 3904 const Vector<Float> Vtsyshi( sptsys ) ; 3905 tsysColhi.put( i, Vtsyshi ) ; 3906 askyhi->unsetSelection() ; 3907 sel.reset() ; 3908 } 3909 } 3910 else if ( apexcalmode == 1 ) { 3911 // APEX fs data with off scan 3912 // off scan 3913 types.push_back( SrcType::FLOOFF ) ; 3914 sel.setTypes( types ) ; 3915 s->setSelection( sel ) ; 3916 tmp.clear() ; 3917 tmp.push_back( getScantable( s, false ) ) ; 3918 CountedPtr<Scantable> aofflo = average( tmp, masks, "TINT", "SCAN" ) ; 3919 s->unsetSelection() ; 3860 3920 sel.reset() ; 3861 sky[0] = askyhi ; 3862 sky[1] = askylo ; 3863 hot[0] = ahothi ; 3864 hot[1] = ahotlo ; 3865 cold[0] = acoldhi ; 3866 cold[1] = acoldlo ; 3867 sp = getFSCalibratedSpectra( sref, ssig, sky, hot, cold, i ) ; 3868 sref->setSpectrum( sp, i ) ; 3869 reftime = sref->getTime( i ) ; 3870 ii[0] = sref->getIF( i ) ; 3871 ib[0] = sref->getBeam( i ) ; 3872 ip[0] = sref->getPol( i ) ; 3873 sel.setIFs( ii ) ; 3874 sel.setBeams( ib ) ; 3875 sel.setPolarizations( ip ) ; 3876 askyhi->setSelection( sel ) ; 3877 sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ; 3878 const Vector<Float> Vtsyshi( sptsys ) ; 3879 tsysColhi.put( i, Vtsyshi ) ; 3880 askyhi->unsetSelection() ; 3921 types.clear() ; 3922 types.push_back( SrcType::FHIOFF ) ; 3923 sel.setTypes( types ) ; 3924 s->setSelection( sel ) ; 3925 tmp.clear() ; 3926 tmp.push_back( getScantable( s, false ) ) ; 3927 CountedPtr<Scantable> aoffhi = average( tmp, masks, "TINT", "SCAN" ) ; 3928 s->unsetSelection() ; 3881 3929 sel.reset() ; 3882 } 3883 3884 } 3885 else if ( antname.find( "APEX" ) != string::npos && apexcalmode == 1 ) { 3886 // APEX fs data with off scan 3887 // sky scan 3888 STSelector sel = STSelector() ; 3889 sel.setName( skystr1 ) ; 3890 s->setSelection( sel ) ; 3891 vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ; 3892 CountedPtr<Scantable> askylo = average( tmp, masks, "TINT", "SCAN" ) ; 3893 s->unsetSelection() ; 3894 sel.reset() ; 3895 sel.setName( skystr2 ) ; 3896 s->setSelection( sel ) ; 3897 tmp[0] = getScantable( s, false ) ; 3898 CountedPtr<Scantable> askyhi = average( tmp, masks, "TINT", "SCAN" ) ; 3899 s->unsetSelection() ; 3900 sel.reset() ; 3901 3902 // hot scan 3903 sel.setName( hotstr1 ) ; 3904 s->setSelection( sel ) ; 3905 tmp[0] = getScantable( s, false ) ; 3906 CountedPtr<Scantable> ahotlo = average( tmp, masks, "TINT", "SCAN" ) ; 3907 s->unsetSelection() ; 3908 sel.reset() ; 3909 sel.setName( hotstr2 ) ; 3910 s->setSelection( sel ) ; 3911 tmp[0] = getScantable( s, false ) ; 3912 CountedPtr<Scantable> ahothi = average( tmp, masks, "TINT", "SCAN" ) ; 3913 s->unsetSelection() ; 3914 sel.reset() ; 3915 3916 // cold scan 3917 sel.setName( coldstr1 ) ; 3918 s->setSelection( sel ) ; 3919 tmp[0] = getScantable( s, false ) ; 3920 CountedPtr<Scantable> acoldlo = average( tmp, masks, "TINT", "SCAN" ) ; 3921 s->unsetSelection() ; 3922 sel.reset() ; 3923 sel.setName( coldstr2 ) ; 3924 s->setSelection( sel ) ; 3925 tmp[0] = getScantable( s, false ) ; 3926 CountedPtr<Scantable> acoldhi = average( tmp, masks, "TINT", "SCAN" ) ; 3927 s->unsetSelection() ; 3928 sel.reset() ; 3929 3930 // off scan 3931 sel.setName( offstr1 ) ; 3932 s->setSelection( sel ) ; 3933 tmp[0] = getScantable( s, false ) ; 3934 CountedPtr<Scantable> aofflo = average( tmp, masks, "TINT", "SCAN" ) ; 3935 s->unsetSelection() ; 3936 sel.reset() ; 3937 sel.setName( offstr2 ) ; 3938 s->setSelection( sel ) ; 3939 tmp[0] = getScantable( s, false ) ; 3940 CountedPtr<Scantable> aoffhi = average( tmp, masks, "TINT", "SCAN" ) ; 3941 s->unsetSelection() ; 3942 sel.reset() ; 3943 3944 // ref scan 3945 bool insitu = insitu_ ; 3946 insitu_ = false ; 3947 sref = getScantable( s, true ) ; 3948 insitu_ = insitu ; 3949 sel.setName( refstr ) ; 3950 s->setSelection( sel ) ; 3951 TableCopy::copyRows( sref->table(), s->table() ) ; 3952 s->unsetSelection() ; 3953 sel.reset() ; 3954 3955 // sig scan 3956 insitu_ = false ; 3957 ssig = getScantable( s, true ) ; 3958 insitu_ = insitu ; 3959 sel.setName( sigstr ) ; 3960 s->setSelection( sel ) ; 3961 TableCopy::copyRows( ssig->table(), s->table() ) ; 3962 s->unsetSelection() ; 3963 sel.reset() ; 3964 3965 // process each sig and ref scan 3966 ArrayColumn<Float> tsysCollo ; 3967 tsysCollo.attach( ssig->table(), "TSYS" ) ; 3968 ArrayColumn<Float> tsysColhi ; 3969 tsysColhi.attach( sref->table(), "TSYS" ) ; 3970 for ( int i = 0 ; i < ssig->nrow() ; i++ ) { 3971 vector<float> sp = getCalibratedSpectra( ssig, aofflo, askylo, ahotlo, acoldlo, i, antname ) ; 3972 ssig->setSpectrum( sp, i ) ; 3973 sp = getCalibratedSpectra( sref, aoffhi, askyhi, ahothi, acoldhi, i, antname ) ; 3974 string reftime = ssig->getTime( i ) ; 3975 vector<int> ii( 1, ssig->getIF( i ) ) ; 3976 vector<int> ib( 1, ssig->getBeam( i ) ) ; 3977 vector<int> ip( 1, ssig->getPol( i ) ) ; 3978 sel.setIFs( ii ) ; 3979 sel.setBeams( ib ) ; 3980 sel.setPolarizations( ip ) ; 3981 askylo->setSelection( sel ) ; 3982 vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ; 3983 const Vector<Float> Vtsyslo( sptsys ) ; 3984 tsysCollo.put( i, Vtsyslo ) ; 3985 askylo->unsetSelection() ; 3986 sel.reset() ; 3987 sref->setSpectrum( sp, i ) ; 3988 reftime = sref->getTime( i ) ; 3989 ii[0] = sref->getIF( i ) ; 3990 ib[0] = sref->getBeam( i ) ; 3991 ip[0] = sref->getPol( i ) ; 3992 sel.setIFs( ii ) ; 3993 sel.setBeams( ib ) ; 3994 sel.setPolarizations( ip ) ; 3995 askyhi->setSelection( sel ) ; 3996 sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ; 3997 const Vector<Float> Vtsyshi( sptsys ) ; 3998 tsysColhi.put( i, Vtsyshi ) ; 3999 askyhi->unsetSelection() ; 4000 sel.reset() ; 4001 } 4002 } 4003 else if ( antname.find( "APEX" ) == string::npos ) { 3930 types.clear() ; 3931 3932 // process each sig and ref scan 3933 ArrayColumn<Float> tsysCollo ; 3934 tsysCollo.attach( ssig->table(), "TSYS" ) ; 3935 ArrayColumn<Float> tsysColhi ; 3936 tsysColhi.attach( sref->table(), "TSYS" ) ; 3937 for ( int i = 0 ; i < ssig->nrow() ; i++ ) { 3938 vector<float> sp = getCalibratedSpectra( ssig, aofflo, askylo, ahotlo, acoldlo, i, antname ) ; 3939 ssig->setSpectrum( sp, i ) ; 3940 sp = getCalibratedSpectra( sref, aoffhi, askyhi, ahothi, acoldhi, i, antname ) ; 3941 string reftime = ssig->getTime( i ) ; 3942 vector<int> ii( 1, ssig->getIF( i ) ) ; 3943 vector<int> ib( 1, ssig->getBeam( i ) ) ; 3944 vector<int> ip( 1, ssig->getPol( i ) ) ; 3945 sel.setIFs( ii ) ; 3946 sel.setBeams( ib ) ; 3947 sel.setPolarizations( ip ) ; 3948 askylo->setSelection( sel ) ; 3949 vector<float> sptsys = getTsysFromTime( reftime, askylo, "linear" ) ; 3950 const Vector<Float> Vtsyslo( sptsys ) ; 3951 tsysCollo.put( i, Vtsyslo ) ; 3952 askylo->unsetSelection() ; 3953 sel.reset() ; 3954 sref->setSpectrum( sp, i ) ; 3955 reftime = sref->getTime( i ) ; 3956 ii[0] = sref->getIF( i ) ; 3957 ib[0] = sref->getBeam( i ) ; 3958 ip[0] = sref->getPol( i ) ; 3959 sel.setIFs( ii ) ; 3960 sel.setBeams( ib ) ; 3961 sel.setPolarizations( ip ) ; 3962 askyhi->setSelection( sel ) ; 3963 sptsys = getTsysFromTime( reftime, askyhi, "linear" ) ; 3964 const Vector<Float> Vtsyshi( sptsys ) ; 3965 tsysColhi.put( i, Vtsyshi ) ; 3966 askyhi->unsetSelection() ; 3967 sel.reset() ; 3968 } 3969 } 3970 } 3971 else { 4004 3972 // non-APEX fs data 4005 3973 // sky scan 4006 3974 STSelector sel = STSelector() ; 4007 sel.setName( skystr ) ; 3975 types.push_back( SrcType::SKY ) ; 3976 sel.setTypes( types ) ; 4008 3977 s->setSelection( sel ) ; 4009 3978 vector< CountedPtr<Scantable> > tmp( 1, getScantable( s, false ) ) ; … … 4011 3980 s->unsetSelection() ; 4012 3981 sel.reset() ; 3982 types.clear() ; 4013 3983 4014 3984 // hot scan 4015 sel.setName( hotstr ) ; 3985 types.push_back( SrcType::HOT ) ; 3986 sel.setTypes( types ) ; 4016 3987 s->setSelection( sel ) ; 4017 tmp[0] = getScantable( s, false ) ; 3988 tmp.clear() ; 3989 tmp.push_back( getScantable( s, false ) ) ; 4018 3990 CountedPtr<Scantable> ahot = average( tmp, masks, "TINT", "SCAN" ) ; 4019 3991 s->unsetSelection() ; 4020 3992 sel.reset() ; 4021 4022 // cold scan 4023 sel.setName( coldstr ) ; 4024 s->setSelection( sel ) ; 4025 tmp[0] = getScantable( s, false ) ; 4026 CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCAN" ) ; 4027 s->unsetSelection() ; 4028 sel.reset() ; 3993 types.clear() ; 3994 3995 // cold scan 3996 CountedPtr<Scantable> acold ; 3997 // types.push_back( SrcType::COLD ) ; 3998 // sel.setTypes( types ) ; 3999 // s->setSelection( sel ) ; 4000 // tmp.clear() ; 4001 // tmp.push_back( getScantable( s, false ) ) ; 4002 // CountedPtr<Scantable> acold = average( tmp, masks, "TINT", "SCAN" ) ; 4003 // s->unsetSelection() ; 4004 // sel.reset() ; 4005 // types.clear() ; 4029 4006 4030 4007 // ref scan … … 4033 4010 sref = getScantable( s, true ) ; 4034 4011 insitu_ = insitu ; 4035 sel.setName( refstr ) ; 4012 types.push_back( SrcType::FSOFF ) ; 4013 sel.setTypes( types ) ; 4036 4014 s->setSelection( sel ) ; 4037 4015 TableCopy::copyRows( sref->table(), s->table() ) ; 4038 4016 s->unsetSelection() ; 4039 4017 sel.reset() ; 4018 types.clear() ; 4040 4019 4041 4020 // sig scan … … 4043 4022 ssig = getScantable( s, true ) ; 4044 4023 insitu_ = insitu ; 4045 sel.setName( sigstr ) ; 4024 types.push_back( SrcType::FSON ) ; 4025 sel.setTypes( types ) ; 4046 4026 s->setSelection( sel ) ; 4047 4027 TableCopy::copyRows( ssig->table(), s->table() ) ; 4048 4028 s->unsetSelection() ; 4049 4029 sel.reset() ; 4030 types.clear() ; 4050 4031 4051 4032 // process each sig and ref scan … … 4141 4122 tmp[i] = dofold( ssig, sref, doffset ) ; 4142 4123 } 4143 // remove additional string from SRCNAME4144 ScalarColumn<String> srcnameCol ;4145 srcnameCol.attach( tmp[i]->table(), "SRCNAME" ) ;4146 Vector<String> srcnames( srcnameCol.getColumn() ) ;4147 for ( uInt i = 0 ; i < srcnames.nelements() ; i++ ) {4148 srcnames[i] = srcnames[i].substr( 0, srcnames[i].find( sigstr.substr(1,sigstr.size()-1) ) ) ;4149 }4150 srcnameCol.putColumn( srcnames ) ;4151 4124 ssig->unsetSelection() ; 4152 4125 sref->unsetSelection() ; … … 4621 4594 sky->setSelection( sel ) ; 4622 4595 hot->setSelection( sel ) ; 4623 cold->setSelection( sel ) ;4596 //cold->setSelection( sel ) ; 4624 4597 off->setSelection( sel ) ; 4625 4598 vector<float> spsky = getSpectrumFromTime( reftime, sky, "linear" ) ; 4626 4599 vector<float> sphot = getSpectrumFromTime( reftime, hot, "linear" ) ; 4627 vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ;4600 //vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ; 4628 4601 vector<float> spoff = getSpectrumFromTime( reftime, off, "linear" ) ; 4629 4602 vector<float> spec = on->getSpectrum( index ) ; … … 4638 4611 } 4639 4612 } 4640 else if ( antname.find( "ALMA" ) != string::npos ) {4641 // two-load calibration4642 // from equation 5 and 12 of ALMA memo 318 (Mangum 2000)4643 //4644 // 2009/09/09 Takeshi Nakazato4645 for ( unsigned int j = 0 ; j < tcal.size() ; j++ ) {4646 //4647 // in case that Tcal is assumed as signal gain4648 //4649 //float K = ( sphot[j] - spcold[j] ) / ( thot - tcold ) ;4650 //float v = ( spec[j] - spoff[j] ) * exp( tsig ) / ( K * tcal[j] * eta ) ;4651 //4652 // in case that Tcal is defined as4653 //4654 // Tcal = ( K * Gs * eta_l * exp( - tau_s ) )^-14655 //4656 float v = tcal[j] * ( spec[j] - spsky[j] ) ;4657 sp[j] = v ;4658 }4659 }4660 4613 else { 4661 4614 // Chopper-Wheel calibration (Ulich & Haas 1976) … … 4668 4621 sky->unsetSelection() ; 4669 4622 hot->unsetSelection() ; 4670 cold->unsetSelection() ;4623 //cold->unsetSelection() ; 4671 4624 off->unsetSelection() ; 4672 4625 … … 4735 4688 sky->setSelection( sel ) ; 4736 4689 hot->setSelection( sel ) ; 4737 cold->setSelection( sel ) ;4690 //cold->setSelection( sel ) ; 4738 4691 vector<float> spsky = getSpectrumFromTime( reftime, sky, "linear" ) ; 4739 4692 vector<float> sphot = getSpectrumFromTime( reftime, hot, "linear" ) ; 4740 vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ;4693 //vector<float> spcold = getSpectrumFromTime( reftime, cold, "linear" ) ; 4741 4694 vector<float> spref = ref->getSpectrum( index ) ; 4742 4695 vector<float> spsig = sig->getSpectrum( index ) ; … … 4750 4703 sky->unsetSelection() ; 4751 4704 hot->unsetSelection() ; 4752 cold->unsetSelection() ;4705 //cold->unsetSelection() ; 4753 4706 4754 4707 return sp ; … … 4773 4726 sky[0]->setSelection( sel ) ; 4774 4727 hot[0]->setSelection( sel ) ; 4775 cold[0]->setSelection( sel ) ;4728 //cold[0]->setSelection( sel ) ; 4776 4729 vector<float> spskys = getSpectrumFromTime( reftime, sky[0], "linear" ) ; 4777 4730 vector<float> sphots = getSpectrumFromTime( reftime, hot[0], "linear" ) ; 4778 vector<float> spcolds = getSpectrumFromTime( reftime, cold[0], "linear" ) ;4731 //vector<float> spcolds = getSpectrumFromTime( reftime, cold[0], "linear" ) ; 4779 4732 vector<float> tcals = getTcalFromTime( reftime, sky[0], "linear" ) ; 4780 4733 sel.reset() ; … … 4785 4738 sky[1]->setSelection( sel ) ; 4786 4739 hot[1]->setSelection( sel ) ; 4787 cold[1]->setSelection( sel ) ;4740 //cold[1]->setSelection( sel ) ; 4788 4741 vector<float> spskyr = getSpectrumFromTime( reftime, sky[1], "linear" ) ; 4789 4742 vector<float> sphotr = getSpectrumFromTime( reftime, hot[1], "linear" ) ; 4790 vector<float> spcoldr = getSpectrumFromTime( reftime, cold[1], "linear" ) ;4743 //vector<float> spcoldr = getSpectrumFromTime( reftime, cold[1], "linear" ) ; 4791 4744 vector<float> tcalr = getTcalFromTime( reftime, sky[1], "linear" ) ; 4792 4745 vector<float> spref = ref->getSpectrum( index ) ; … … 4800 4753 sky[0]->unsetSelection() ; 4801 4754 hot[0]->unsetSelection() ; 4802 cold[0]->unsetSelection() ;4755 //cold[0]->unsetSelection() ; 4803 4756 sky[1]->unsetSelection() ; 4804 4757 hot[1]->unsetSelection() ; 4805 cold[1]->unsetSelection() ;4758 //cold[1]->unsetSelection() ; 4806 4759 4807 4760 return sp ; -
branches/alma/src/STSelector.cpp
r1639 r1693 85 85 std::string sql = "SELECT FROM $1 WHERE SRCNAME == pattern('"+sname+"')"; 86 86 setTaQL(sql); 87 } 88 89 void STSelector::setTypes( const std::vector< int >& types ) 90 { 91 setint("SRCTYPE", types); 87 92 } 88 93 … … 260 265 } 261 266 267 std::vector< int > asap::STSelector::getTypes( ) const 268 { 269 return getint("SRCTYPE") ; 270 } 271 262 272 std::string asap::STSelector::print( ) 263 273 { -
branches/alma/src/STSelector.h
r1639 r1693 45 45 void setCycles(const std::vector<int>& cycs); 46 46 void setName(const std::string&); 47 void setTypes(const std::vector<int>& types); 47 48 virtual void setTaQL(const std::string& taql); 48 49 … … 55 56 std::vector<int> getPols() const; 56 57 std::vector<int> getCycles() const; 58 std::vector<int> getTypes() const; 57 59 std::vector<std::string> getPolTypes() const; 58 60 std::string getTaQL() const { return taql_; } -
branches/alma/src/python_STSelector.cpp
r1639 r1693 29 29 .def("_getscans", &STSelector::getScans) 30 30 .def("_getcycles", &STSelector::getCycles) 31 .def("_gettypes", &STSelector::getTypes) 31 32 .def("_gettaql", &STSelector::getTaQL) 32 33 .def("_getorder", &STSelector::getSortOrder) … … 42 43 .def("_setorder", &STSelector::setSortOrder) 43 44 .def("_setrows", &STSelector::setRows) 45 .def("_settypes", &STSelector::setTypes) 44 46 .def("_empty", &STSelector::empty) 45 47 ; -
branches/alma/src/python_asap.cpp
r1603 r1693 75 75 asap::python::python_LineCatalog(); 76 76 asap::python::python_Logger(); 77 asap::python::python_SrcType(); 77 78 78 79 #ifndef HAVE_LIBPYRAP -
branches/alma/src/python_asap.h
r1126 r1693 47 47 void python_LineCatalog(); 48 48 void python_Logger(); 49 void python_SrcType(); 49 50 50 51 } // python
Note:
See TracChangeset
for help on using the changeset viewer.