- Timestamp:
- 03/30/06 15:34:32 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r934 r940 77 77 String epoch = scantbls[0]->getTime(0); 78 78 for (int i=0; i< scantbls.size(); ++i ) { 79 79 80 inaligned.push_back(frequencyAlign(scantbls[i], epoch)); 80 81 } … … 978 979 979 980 CountedPtr< Scantable > 981 STMath::averagePolarisations( const CountedPtr< Scantable > & in, 982 const std::vector<bool>& mask, 983 const std::string& weight ) 984 { 985 if (in->getPolType() != "linear" || in->npol() != 2 ) 986 throw(AipsError("averagePolarisations can only be applied to two linear polarisations.")); 987 CountedPtr<Scantable> pol0( new Scantable(*in), false); 988 CountedPtr<Scantable> pol1( new Scantable(*in), false); 989 Table& tpol0 = pol0->table(); 990 Table& tpol1 = pol1->table(); 991 Vector<uInt> pol0rows = tpol0(tpol0.col("POLNO") == 0).rowNumbers(); 992 Vector<uInt> pol1rows = tpol1(tpol1.col("POLNO") == 1).rowNumbers(); 993 tpol0.removeRow(pol1rows); 994 tpol1.removeRow(pol0rows); 995 // give both tables the same POLNO 996 TableVector<uInt> vec(tpol1,"POLNO"); 997 vec = 0; 998 std::vector<CountedPtr<Scantable> > pols; 999 pols.push_back(pol0); 1000 pols.push_back(pol1); 1001 CountedPtr< Scantable > out = average(pols, mask, weight, "NONE", false); 1002 out->table_.rwKeywordSet().define("nPol",Int(1)); 1003 return out; 1004 } 1005 1006 1007 CountedPtr< Scantable > 980 1008 asap::STMath::frequencyAlign( const CountedPtr< Scantable > & in, 981 1009 const std::string & refTime, 982 1010 const std::string & method) 983 1011 { 1012 // clone as this is not working insitu 1013 bool insitu = insitu_; 1014 setInsitu(false); 984 1015 CountedPtr< Scantable > out = getScantable(in, false); 1016 setInsitu(insitu); 985 1017 Table& tout = out->table(); 986 1018 // clear ouput frequency table 987 Table ftable = out->frequencies().table();988 ftable.removeRow(ftable.rowNumbers());1019 //Table ftable = out->frequencies().table(); 1020 //ftable.removeRow(ftable.rowNumbers()); 989 1021 // Get reference Epoch to time of first row or given String 990 1022 Unit DAY(String("d")); … … 1003 1035 } 1004 1036 MPosition refPos = in->getAntennaPosition(); 1005 /* ostringstream oss; 1006 oss << "Aligned at reference Epoch " << formatEpoch(refEpoch) 1007 << " in frame " << MFrequency::showType(freqSystem); 1008 pushLog(String(oss)); 1009 */ 1037 1010 1038 InterpolateArray1D<Double,Float>::InterpolationMethod interp; 1011 1039 Int interpMethod(stringToIMethod(method)); … … 1016 1044 } 1017 1045 MFrequency::Types system = in->frequencies().getFrame(); 1018 out->frequencies().setFrame(system, true); 1046 MVTime mvt(refEpoch.getValue()); 1047 String epochout = mvt.string(MVTime::YMD) + String(" (") + refEpoch.getRefString() + String(")"); 1048 ostringstream oss; 1049 oss << "Aligned at reference Epoch " << epochout 1050 << " in frame " << MFrequency::showType(system); 1051 pushLog(String(oss)); 1019 1052 // set up the iterator 1020 1053 Block<String> cols(4); … … 1041 1074 ScalarColumn<uInt> freqidCol(ftab, "FREQ_ID"); 1042 1075 // get the SpectralCoordinate for the freqid, which we are iterating over 1043 cout << freqidCol.getColumn() << endl;1044 1076 SpectralCoordinate sC = in->frequencies().getSpectralCoordinate(freqidCol(0)); 1045 1077 FrequencyAligner<Float> fa( sC, nchan, refEpoch, … … 1086 1118 interp, False); 1087 1119 // back into scantable 1088 cout << spec[spec.nelements()/2] << " --- " << specOut[specOut.nelements()/2] << endl;1089 1120 flagOut.resize(maskOut.nelements()); 1090 1121 convertArray(flagOut, maskOut); … … 1097 1128 ++timeiter; 1098 1129 } 1099 // ne ct FREQ_ID1130 // next FREQ_ID 1100 1131 ++fiter; 1101 1132 } … … 1103 1134 ++iter; 1104 1135 } 1105 return out; 1106 } 1136 // set this afterwards to ensure we are doing insitu correctly. 1137 out->frequencies().setFrame(system, true); 1138 return out; 1139 } -
trunk/src/STMath.h
r927 r940 59 59 const std::string& avmode = "SCAN", 60 60 bool alignfreq = false ); 61 casa::CountedPtr< Scantable > 62 averagePolarisations( const casa::CountedPtr< Scantable > & in, 63 const std::vector<bool>& mask, 64 const std::string& weight ); 61 65 62 66 casa::CountedPtr<Scantable> -
trunk/src/STMathWrapper.h
r927 r940 47 47 return ScantableWrapper(STMath::average(sts, mask, weight, avmode, alignfreq)); 48 48 } 49 ScantableWrapper 50 averagePolarisations( const ScantableWrapper& in, 51 const std::vector<bool>& mask, 52 const std::string& weight) 53 { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));} 49 54 50 55 ScantableWrapper -
trunk/src/python_STMath.cpp
r927 r940 45 45 .def("_setinsitu", &STMathWrapper::setInsitu) 46 46 .def("_average", &STMathWrapper::average) 47 .def("_averagepol", &STMathWrapper::averagePolarisations) 47 48 .def("_unaryop", &STMathWrapper::unaryOperate) 48 49 .def("_quotient", &STMathWrapper::quotient)
Note:
See TracChangeset
for help on using the changeset viewer.