Changeset 2924 for trunk


Ignore:
Timestamp:
04/08/14 16:41:32 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-6382

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_tsdcal2

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Minor refactoring.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STCalTsys.cpp

    r2923 r2924  
    8282    Vector<Float> averaged_data(any_data.size());
    8383    Float averaged_value = 0.0;
    84     uInt num_value = 0;
     84    size_t num_value = 0;
    8585    Vector<Double> channel_range = tsysspw_.asArrayDouble(String::toString(ifno));
    8686    os << LogIO::DEBUGGING << "do averaging: channel range for IFNO " << ifno << " is " << channel_range << LogIO::POST;
    8787    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());
    9090      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];
    9497      }
     98      averaged_value += sum_per_segment;
     99      num_value += end - start;
    95100    }
    96101    averaged_value /= (Float)num_value;
Note: See TracChangeset for help on using the changeset viewer.