Changeset 2923
- Timestamp:
- 04/08/14 11:28:23 (11 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/CalibrationManager.cpp
r2922 r2923 37 37 calmode_(""), 38 38 spwlist_(0), 39 spwlist_withrange_() 39 spwlist_withrange_(), 40 do_average_(false) 40 41 { 41 42 applicator_ = new STApplyCal(); … … 155 156 os_ << LogIO::DEBUGGING << ((average) ? "with averaging" : "without averaging") << LogIO::POST; 156 157 spwlist_withrange_ = spwlist; 158 do_average_ = average; 157 159 } 158 160 … … 165 167 spwlist_.clear(); 166 168 spwlist_withrange_ = Record(); 169 do_average_ = false; 167 170 } 168 171 … … 175 178 spwlist_.clear(); 176 179 spwlist_withrange_ = Record(); 180 do_average_ = false; 177 181 } 178 182 … … 192 196 } 193 197 else { 194 uInt nfield = spwlist_withrange_.nfields(); 195 vector<int> spwlist(nfield); 196 for (uInt i = 0; i < nfield; ++i) { 197 spwlist[i] = std::atoi(spwlist_withrange_.name(i).c_str()); 198 } 199 STCalTsys cal(target_, spwlist); 198 STCalTsys cal(target_, spwlist_withrange_, do_average_); 200 199 cal.calibrate(); 201 200 tsystables_.push_back(cal.applytable()); -
trunk/src/CalibrationManager.h
r2922 r2923 76 76 std::vector<int> spwlist_; 77 77 casa::Record spwlist_withrange_; 78 bool do_average_; 78 79 79 80 casa::LogIO os_; -
trunk/src/STCalTsys.cpp
r2915 r2923 25 25 26 26 namespace asap { 27 STCalTsys::STCalTsys(CountedPtr<Scantable> &s, vector<int> &iflist) 28 : STCalibration(s, "TSYS"), 29 iflist_(iflist) 27 STCalTsys::STCalTsys(CountedPtr<Scantable> &s, vector<int> &iflist) 28 : STCalibration(s, "TSYS"), 29 iflist_(iflist), 30 tsysspw_(), 31 do_average_(false) 30 32 { 33 applytable_ = new STCalTsysTable(*s); 34 } 35 36 STCalTsys::STCalTsys(CountedPtr<Scantable> &s, Record &iflist, bool average) 37 : STCalibration(s, "TSYS"), 38 iflist_(), 39 tsysspw_(iflist), 40 do_average_(average) 41 { 42 iflist_.resize(tsysspw_.nfields()); 43 for (uInt i = 0; i < tsysspw_.nfields(); ++i) { 44 iflist_[i] = std::atoi(tsysspw_.name(i).c_str()); 45 } 31 46 applytable_ = new STCalTsysTable(*s); 32 47 } … … 63 78 { 64 79 STCalTsysTable *p = dynamic_cast<STCalTsysTable *>(&(*applytable_)); 65 p->appenddata(scanno, cycleno, beamno, ifno, polno, 66 freqid, time, elevation, any_data); 80 if (do_average_ && tsysspw_.isDefined(String::toString(ifno))) { 81 LogIO os(LogOrigin("STCalTsys", "appenddata", WHERE)); 82 Vector<Float> averaged_data(any_data.size()); 83 Float averaged_value = 0.0; 84 uInt num_value = 0; 85 Vector<Double> channel_range = tsysspw_.asArrayDouble(String::toString(ifno)); 86 os << LogIO::DEBUGGING << "do averaging: channel range for IFNO " << ifno << " is " << channel_range << LogIO::POST; 87 for (uInt i = 1; i < channel_range.size(); i += 2) { 88 uInt start = (uInt)channel_range[i-1]; 89 uInt end = std::min((uInt)channel_range[i] + 1, (uInt)averaged_data.size()); 90 os << LogIO::DEBUGGING << "start=" << start << ", end=" << end << LogIO::POST; 91 for (uInt j = start; j < end; ++j) { 92 averaged_value += any_data[j]; 93 num_value++; 94 } 95 } 96 averaged_value /= (Float)num_value; 97 averaged_data = averaged_value; 98 os << LogIO::DEBUGGING << "averaged_data = " << averaged_data << LogIO::POST; 99 os << LogIO::DEBUGGING << "any_data = " << any_data << LogIO::POST; 100 p->appenddata(scanno, cycleno, beamno, ifno, polno, 101 freqid, time, elevation, averaged_data); 102 } 103 else { 104 p->appenddata(scanno, cycleno, beamno, ifno, polno, 105 freqid, time, elevation, any_data); 106 } 67 107 } 68 108 -
trunk/src/STCalTsys.h
r2915 r2923 20 20 #include <casa/BasicSL/String.h> 21 21 #include <casa/Utilities/CountedPtr.h> 22 #include <casa/Containers/Record.h> 22 23 23 24 #include <scimath/Mathematics/InterpolateArray1D.h> … … 39 40 public: 40 41 STCalTsys(casa::CountedPtr<Scantable> &s, vector<int> &iflist); 42 STCalTsys(casa::CountedPtr<Scantable> &s, casa::Record &iflist, bool average=false); 41 43 42 44 ~STCalTsys() {;} … … 50 52 51 53 vector<int> iflist_; 54 casa::Record tsysspw_; 55 bool do_average_; 52 56 }; 53 57
Note:
See TracChangeset
for help on using the changeset viewer.