Ejemplo n.º 1
0
        public static CurveData <BoxWhiskerXValue, BoxWhiskerYValue> CreateBoxWhiskerCurveData(PaneData <BoxWhiskerXValue, BoxWhiskerYValue> paneData, string name, IList <BoxWhiskerXYValue> bwValues)
        {
            var curveData = new CurveData <BoxWhiskerXValue, BoxWhiskerYValue>(new Dictionary <string, string> {
                { name, name }
            })
            {
                Id      = name,
                Caption = name
            };

            foreach (var v in bwValues)
            {
                var X = new BoxWhiskerXValue(new List <string>()
                {
                    v.X1, v.X2
                });
                var Y = new BoxWhiskerYValue
                {
                    LowerWhisker = new ValueWithIndvividualId(v.LW),
                    LowerBox     = new ValueWithIndvividualId(v.LW),
                    Median       = new ValueWithIndvividualId(v.M),
                    UpperBox     = new ValueWithIndvividualId(v.LW),
                    UpperWhisker = new ValueWithIndvividualId(v.LW),
                };
                curveData.Add(X, Y);
            }

            return(curveData);
        }
Ejemplo n.º 2
0
        private static Aggregate <BoxWhiskerYValue> boxWhiskerAggregation(double percentile)
        {
            const float outlierRange = 1.5F;

            return(new Aggregate <double, BoxWhiskerYValue>
            {
                Aggregation = doubles =>
                {
                    var ordereredValues = doubles.ToFloatArray().OrderedAndPurified();

                    var boxWhiskerYValue = new BoxWhiskerYValue
                    {
                        LowerWhisker = valueWithIndex(ordereredValues, percentile),
                        LowerBox = valueWithIndex(ordereredValues, 25),
                        Median = valueWithIndex(ordereredValues, 50),
                        UpperBox = valueWithIndex(ordereredValues, 75),
                        UpperWhisker = valueWithIndex(ordereredValues, 100 - percentile),
                    };

                    var range = outlierRange * (boxWhiskerYValue.UpperBox - boxWhiskerYValue.LowerBox);

                    var lowerLimit = boxWhiskerYValue.LowerWhisker - range;
                    var upperLimit = boxWhiskerYValue.UpperWhisker + range;

                    var outliers = ordereredValues.Where(f => f <lowerLimit || f> upperLimit)
                                   .Select(f => new ValueWithIndvividualId(f))
                                   .ToArray();

                    boxWhiskerYValue.Outliers = outliers;
                    return boxWhiskerYValue;
                },
                Name = "BoxWhisker"
            });
        }
Ejemplo n.º 3
0
 protected override void Because()
 {
     _xValue = new BoxWhiskerXValue(new string[] { "Normal", "Young" });
     _yValue = new BoxWhiskerYValue()
     {
         LowerWhisker = 1.1F, LowerBox = 1.2F, Median = 1.3F, UpperBox = 1.4F, UpperWhisker = 1.5F
     };
     sut.Add(_xValue, _yValue);
 }
Ejemplo n.º 4
0
 protected override void Because()
 {
     _xValue = new BoxWhiskerXValue(new string[] { "Normal", "Young" });
     _yValue = new BoxWhiskerYValue
     {
         LowerWhisker = new ValueWithIndvividualId(1.1F),
         LowerBox     = new ValueWithIndvividualId(1.2F),
         Median       = new ValueWithIndvividualId(1.3F),
         UpperBox     = new ValueWithIndvividualId(1.4F),
         UpperWhisker = new ValueWithIndvividualId(1.5F)
     };
     sut.Add(_xValue, _yValue);
 }
Ejemplo n.º 5
0
        public static CurveData <BoxWhiskerXValue, BoxWhiskerYValue> CreateBoxWhiskerCurveData(PaneData <BoxWhiskerXValue, BoxWhiskerYValue> paneData, string name, IList <BoxWhiskerXYValue> bwValues)
        {
            var curveData = new CurveData <BoxWhiskerXValue, BoxWhiskerYValue>(new Dictionary <string, string> {
                { name, name }
            });

            curveData.Id      = name;
            curveData.Caption = name;
            foreach (var v in bwValues)
            {
                var X = new BoxWhiskerXValue(new List <string>()
                {
                    v.X1, v.X2
                });
                var Y = new BoxWhiskerYValue()
                {
                    LowerWhisker = v.LW, LowerBox = v.LW, Median = v.M, UpperBox = v.LW, UpperWhisker = v.LW
                };
                curveData.Add(X, Y);
            }

            return(curveData);
        }
Ejemplo n.º 6
0
        protected override void Context()
        {
            base.Context();
            _boxWiskerYValue = new BoxWhiskerYValue
            {
                UpperWhisker = new ValueWithIndvividualId(12)
                {
                    IndividualId = 8
                },
                UpperBox = new ValueWithIndvividualId(10)
                {
                    IndividualId = 2
                },
                Median = new ValueWithIndvividualId(8)
                {
                    IndividualId = 14
                },
                LowerBox = new ValueWithIndvividualId(7)
                {
                    IndividualId = 22
                },
                LowerWhisker = new ValueWithIndvividualId(2)
                {
                    IndividualId = 44
                }
            };

            _population = new ImportPopulation();
            var populationSimulation = A.Fake <PopulationSimulation>();

            A.CallTo(() => populationSimulation.Population).Returns(_population);
            _boxWiskerAnalysisChart.Analysable = populationSimulation;

            A.CallTo(() => _individualExtractor.ExtractIndividualsFrom(_population, A <IEnumerable <int> > ._))
            .Invokes(x => _allIndividualIds = x.GetArgument <IEnumerable <int> >(1).ToList());
        }
Ejemplo n.º 7
0
 protected override void Context()
 {
     base.Context();
     _boxWiskerYValue = new BoxWhiskerYValue();
     _boxWiskerAnalysisChart.Analysable = A.Fake <IAnalysable>();
 }