Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12117 for trunk/sources


Ignore:
Timestamp:
03/04/15 10:17:08 (10 years ago)
Author:
ascheibe
Message:

#2348 fixed a bug in the chart analysis view that occurs if a data table has less then 4 values in a data row

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs

    r12112 r12117  
    291291        double percentile25 = values.Percentile(0.25);
    292292        double percentile75 = values.Percentile(0.75);
    293         double lowerAvg = values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average();
    294         double upperAvg = values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average();
    295         double firstAvg = values.Take((int)(values.Count() * 0.25)).Average();
    296         double lastAvg = values.Skip((int)(values.Count() * 0.75)).Average();
     293        double lowerAvg = values.Count() > 4 ? values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average() : double.NaN;
     294        double upperAvg = values.Count() > 4 ? values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average() : double.NaN;
     295        double firstAvg = values.Count() > 4 ? values.Take((int)(values.Count() * 0.25)).Average() : double.NaN;
     296        double lastAvg = values.Count() > 4 ? values.Skip((int)(values.Count() * 0.75)).Average() : double.NaN;
    297297        double slope, intercept, r;
    298298        llsFitting.Calculate(values, out slope, out intercept);
Note: See TracChangeset for help on using the changeset viewer.