- Timestamp:
- 04/08/14 16:41:32 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STCalTsys.cpp
r2923 r2924 82 82 Vector<Float> averaged_data(any_data.size()); 83 83 Float averaged_value = 0.0; 84 uInt num_value = 0;84 size_t num_value = 0; 85 85 Vector<Double> channel_range = tsysspw_.asArrayDouble(String::toString(ifno)); 86 86 os << LogIO::DEBUGGING << "do averaging: channel range for IFNO " << ifno << " is " << channel_range << LogIO::POST; 87 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());88 size_t start = (size_t)channel_range[i-1]; 89 size_t end = std::min((size_t)channel_range[i] + 1, averaged_data.size()); 90 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++; 91 //Vector<Float> segment = any_data(Slice(start, end - 1, 1, False)); 92 //averaged_value += sum(segment); 93 //num_value += segment.size(); 94 float sum_per_segment = 0.0; 95 for (size_t j = start; j < end; ++j) { 96 sum_per_segment += any_data[j]; 94 97 } 98 averaged_value += sum_per_segment; 99 num_value += end - start; 95 100 } 96 101 averaged_value /= (Float)num_value;
Note:
See TracChangeset
for help on using the changeset viewer.