Changeset 17169 for trunk


Ignore:
Timestamp:
09/16/13 18:41:44 (11 years ago)
Author:
tbretz
Message:
Improved the median calculation; added a sanity check for the rms calculation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/smartfact.cc

    r17123 r17169  
    685685
    686686            const size_t p = t.size()/2;
    687 
    688             med = copy[p];
     687            med = p%2 ? copy[p] : (copy[p-1]+copy[p])/2.;
    689688        }
    690689    };
     
    16971696
    16981697        avg /= num;
    1699         rms = sqrt(rms/num-avg*avg);
     1698        rms /= num;
     1699        rms += avg*avg;
     1700        rms = rms<0 ? 0 : sqrt(rms);
    17001701
    17011702        if (!fMagicWeatherHist[kTemp].empty())
Note: See TracChangeset for help on using the changeset viewer.