protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(_xAxis, null, null, null);
            var pane1 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Liver"
            };

            curve1.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve1.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                LowerValue = 20, UpperValue = 30
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new TimeProfileXValue(3), new TimeProfileYValue {
                Y = 40
            });
            pane2.AddCurve(curve2);

            _observedData = DomainHelperForSpecs.ObservedData();
            var displayPathMapper   = A.Fake <IQuantityPathToQuantityDisplayPathMapper>();
            var dimensionRepository = A.Fake <IDimensionRepository>();
            var observedDataMapper  = new DataRepositoryToObservedCurveDataMapper(displayPathMapper, dimensionRepository);
            var obserevdDataCurves  = observedDataMapper.MapFrom(_observedData, new ObservedDataCollection(), concDimension);

            obserevdDataCurves.Each(pane1.AddObservedCurve);
            observedDataMapper.MapFrom(_observedData, new ObservedDataCollection(), concDimension).Each(curve =>
            {
                curve.Visible = false;
                pane1.AddObservedCurve(curve);
            });
        }
        protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <RangeXValue, RangeYValue>(_xAxis, null);
            var pane1 = new PaneData <RangeXValue, RangeYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <RangeXValue, RangeYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <RangeXValue, RangeYValue> {
                Caption = "Liver"
            };

            curve1.Add(new RangeXValue(1)
            {
                Minimum = 0, Maximum = 1.5f, NumberOfItems = 5
            }, new RangeYValue {
                LowerPercentile = 10, Median = 20, UpperPercentile = 30
            });
            curve1.Add(new RangeXValue(2)
            {
                Minimum = 1.8f, Maximum = 2.5f, NumberOfItems = 10
            }, new RangeYValue {
                LowerPercentile = 20, Median = 30, UpperPercentile = 40
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <RangeXValue, RangeYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new RangeXValue(3)
            {
                Minimum = 2f, Maximum = 4f, NumberOfItems = 15
            }, new RangeYValue {
                LowerPercentile = 30, Median = 40, UpperPercentile = 50
            });
            pane2.AddCurve(curve2);
        }
Exemplo n.º 3
0
        private void setCurveDataValues(CurveData <RangeXValue, RangeYValue> series, DataRow xFieldRow, string yFieldName)
        {
            // find row with yField / data for y-Values
            var pkValues = xFieldRow.GetPrimaryKeyValues();

            pkValues[0] = yFieldName; // DATA_FIELD-column first, see CreatePrimaryKey
            DataRow yFieldRow = _data.Rows.Find(pkValues);

            var xValues = xFieldRow[_aggreationName] as float[];
            var yValues = yFieldRow[_aggreationName] as float[];

            //possible if no values are defined for the row filter
            if (xValues == null || yValues == null)
            {
                return;
            }

            if (xValues.Length != yValues.Length)
            {
                throw new InvalidDataException(PKSimConstants.Error.DifferentVectorLengths);
            }

            // create range curve on grid. Do not allow uniform interval distribution as data might be misleading
            var xValueIntervals = _binIntervalsCreator.CreateIntervalsFor(xValues.ToDoubleArray());

            foreach (var xValueInterval in xValueIntervals)
            {
                var yValuesForXInterval = yValues.Where((y, i) => xValueInterval.Contains(xValues[i])).ToList();
                var rangeYValue         = createRangeYValue(yValuesForXInterval);
                if (rangeYValue.IsValid)
                {
                    series.Add(createRangeXValue(xValueInterval, yValuesForXInterval.Count), rangeYValue);
                }
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        private void setSeriesValues(CurveData <ScatterXValue, ScatterYValue> series, DataRow row, string yFieldName)
        {
            // find row with yField / data for y-Values
            var pkValues = row.GetPrimaryKeyValues();

            pkValues[0] = yFieldName;
            DataRow yFieldRow = _data.Rows.Find(pkValues);

            var xValues = (float[])row[_aggregationName];
            var yValues = (float[])yFieldRow[_aggregationName];

            if (xValues.Length != yValues.Length)
            {
                throw new InvalidDataException(PKSimConstants.Error.DifferentVectorLengths);
            }

            for (int i = 0; i < xValues.Length; i++)
            {
                var scatterValue = new ScatterYValue(yValues[i]);
                if (scatterValue.IsValid)
                {
                    series.Add(new ScatterXValue(xValues[i]), scatterValue);
                }
            }
        }
        protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(_xAxis, null, null, null);
            var pane1 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Liver"
            };

            curve1.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve1.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                LowerValue = 20, UpperValue = 30
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new TimeProfileXValue(3), new TimeProfileYValue {
                Y = 40
            });
            pane2.AddCurve(curve2);
        }
Exemplo n.º 7
0
        protected override void Context()
        {
            base.Context();
            var dim = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _populationDataCollector = A.Fake <IPopulationDataCollector>();
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(new AxisData(dim, dim.DefaultUnit, Scalings.Linear), null);
            var pane = new PaneData <TimeProfileXValue, TimeProfileYValue>(new AxisData(dim, dim.DefaultUnit, Scalings.Linear));

            _chartData.AddPane(pane);
            var curve = new CurveData <TimeProfileXValue, TimeProfileYValue>()
            {
                Pane         = pane,
                QuantityPath = "PATH",
            };

            curve.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                Y = 20
            });
            pane.AddCurve(curve);

            var rangeCurve = new CurveData <TimeProfileXValue, TimeProfileYValue>()
            {
                Pane         = pane,
                QuantityPath = "RANGE_PATH",
            };

            rangeCurve.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10, LowerValue = 1, UpperValue = 2
            });
            pane.AddCurve(rangeCurve);

            A.CallTo(() => _populationDataCollector.MolWeightFor("PATH")).Returns(100);

            A.CallTo(() => _pkMapper.MapFrom(A <DataColumn> ._, A <PKValues> ._, A <PKParameterMode> ._, A <string> ._))
            .Invokes(x => _dataColumn = x.GetArgument <DataColumn>(0));
        }
Exemplo n.º 8
0
        private void setSeriesValues(CurveData <BoxWhiskerXValue, BoxWhiskerYValue> series, DataRow row, IEnumerable <string> xFieldNames, PopulationBoxWhiskerAnalysis boxWhiskerAnalysis)
        {
            var xValue = new BoxWhiskerXValue(GetFieldValues(xFieldNames, row).Values);
            var yValue = row[_aggregationName].DowncastTo <BoxWhiskerYValue>();

            if (!yValue.IsValid)
            {
                return;
            }

            if (!boxWhiskerAnalysis.ShowOutliers)
            {
                yValue.ClearOutliers();
            }

            series.Add(xValue, yValue);
        }
        private void setSeriesValues(CurveData <TimeProfileXValue, TimeProfileYValue> series, DataRow row)
        {
            var statisticalAggregation = row[STATISTICAL_AGGREGATION].DowncastTo <StatisticalAggregation>();

            var timeAndAllValues = (Tuple <QuantityValues, FloatMatrix>)row[TIME_AND_VALUES];

            QuantityValues time      = timeAndAllValues.Item1;
            FloatMatrix    allValues = timeAndAllValues.Item2;

            var results = getResultsFor(statisticalAggregation, allValues);

            for (int i = 0; i < time.Length; i++)
            {
                var yValue = results[i];
                if (yValue.IsValid)
                {
                    series.Add(new TimeProfileXValue(time[i]), yValue);
                }
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
 public CinemaMultiActorCurveClip()
 {
     CurveData.Add(new MemberClipCurveData());
 }