protected override async Task Context()
        {
            await base.Context();

            _obsData = DomainHelperForSpecs.ObservedData().WithName("subject");
            _project = new PKSimProject();
            _project.AddClassifiable(new ClassifiableObservedData {
                Subject = _obsData
            });
            _project.AddClassification(_modelClassification);
        }
Exemple #2
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_dataColumn);

            _contextDataRepository = DomainHelperForSpecs.ObservedData();
            _dataInfo     = new DataInfo(ColumnOrigins.Observation);
            _quantityInfo = new QuantityInfo(new[] { "path" }, QuantityType.Undefined);

            A.CallTo(() => _dataInfoMapper.MapToModel(_snapshot.DataInfo, A <SnapshotContext> ._)).Returns(_dataInfo);
            A.CallTo(() => _quantityInfoMapper.MapToModel(_snapshot.QuantityInfo, A <SnapshotContext> ._)).Returns(_quantityInfo);
        }
Exemple #3
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_curve);

            _anotherRepository          = DomainHelperForSpecs.ObservedData();
            _y2Column                   = _anotherRepository.AllButBaseGrid().First();
            _y2Column.QuantityInfo.Path = new[] { "D", "E", "F" };
            _context = new SimulationAnalysisContext(new[] { _dataRepository, _anotherRepository, });
            _snapshot.CurveOptions.Color = Color.Aqua;
            _snapshot.X = _y2Column.PathAsString;
        }
Exemple #4
0
        protected override void Context()
        {
            base.Context();
            _parameter = A.Fake <IParameter>().WithName(Constants.Parameters.MOL_WEIGHT);
            A.CallTo(() => _buildingBockRetriever.BuildingBlockContaining(_parameter)).Returns(null);

            _observedData = DomainHelperForSpecs.ObservedData();
            _observedData.ExtendedProperties.Add(new ExtendedProperty <string> {
                Name = Constants.ObservedData.MOLECULE, Value = "C"
            });
            _observedData.AllButBaseGrid().Each(c => c.DataInfo.MolWeight = 100);


            _observedDataList.AddRange(new[] { _observedData });
        }
Exemple #5
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_individualSimulation, _project);

            var individualSimulation = new IndividualSimulation
            {
                Properties         = _simulationProperties,
                SimulationSettings = _settings,
                Model = _model
            };

            individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndTemplateId", PKSimBuildingBlockType.Individual)
            {
                Name          = _individual.Name,
                BuildingBlock = _individual
            });

            _modelProperties = new ModelProperties();
            A.CallTo(() => _modelPropertiesTask.DefaultFor(_individual.OriginData, _snapshot.Model)).Returns(_modelProperties);
            A.CallTo(() => _simulationFactory.CreateFrom(_individual, A <IReadOnlyList <Compound> > ._, _modelProperties, null)).Returns(individualSimulation);

            _outputSelection = new OSPSuite.Core.Domain.OutputSelections();
            _outputSelection.AddOutput(new QuantitySelection("PATH", QuantityType.BaseGrid));
            A.CallTo(() => _outputSelectionMapper.MapToModel(_snapshot.OutputSelections, individualSimulation)).Returns(_outputSelection);

            _solver = new SolverSettings();
            A.CallTo(() => _solverSettingsMapper.MapToModel(_snapshot.Solver)).Returns(_solver);

            _outputSchema = new OutputSchema();
            A.CallTo(() => _outputSchemaMapper.MapToModel(_snapshot.OutputSchema)).Returns(_outputSchema);

            A.CallTo(() => _curveChartMapper.MapToModel(_snapshotSimulationTimeProfile, A <SimulationAnalysisContext> ._))
            .Invokes(x => _context = x.GetArgument <SimulationAnalysisContext>(1))
            .Returns(_simulationTimeProfile);


            //ensure that run will be performed
            _snapshot.HasResults      = true;
            _calculatedDataRepository = DomainHelperForSpecs.ObservedData("Calculated");

            A.CallTo(() => _simulationRunner.RunSimulation(individualSimulation, A <SimulationRunOptions> ._))
            .Invokes(x => { individualSimulation.DataRepository = _calculatedDataRepository; });

            A.CallTo(() => _eventMappingMapper.MapToModel(_eventSelection, _project)).Returns(_eventMapping);
            A.CallTo(() => _observerSetMappingMapper.MapToModel(_observerSetSelection, _project)).Returns(_observerSetMapping);
        }
        protected override Task Context()
        {
            _parameterIdentificationAnalysisChartMapper = A.Fake <ParameterIdentificationAnalysisChartMapper>();
            _dataRepositoryMapper = A.Fake <DataRepositoryMapper>();
            _idGenerator          = A.Fake <IIdGenerator>();
            sut = new ParameterIdentificationAnalysisMapper(_parameterIdentificationAnalysisChartMapper, _dataRepositoryMapper, _idGenerator);

            _parameterIdentificationAnalysis = new T().WithName("Chart");
            _chartSnapshot           = new CurveChart();
            _localRepository         = DomainHelperForSpecs.ObservedData();
            _snapshotLocalRepository = new Snapshots.DataRepository();
            A.CallTo(() => _dataRepositoryMapper.MapToSnapshot(_localRepository)).Returns(_snapshotLocalRepository);

            _parameterIdentification = new ParameterIdentification();
            _project = new PKSimProject();
            _parameterIdentificationContext = new ParameterIdentificationContext(_parameterIdentification, _project);
            return(_completed);
        }
        protected override Task Context()
        {
            _axisMapper  = A.Fake <AxisMapper>();
            _curveMapper = A.Fake <CurveMapper>();
            _chartMapper = A.Fake <ChartMapper>();
            _idGenerator = A.Fake <IIdGenerator>();
            sut          = new SimulationTimeProfileChartMapper(_chartMapper, _axisMapper, _curveMapper, _idGenerator);
            var dimensionFactory = A.Fake <IDimensionFactory>();

            _curveChart = new SimulationTimeProfileChart
            {
                Name              = "Chart",
                Description       = "ChartDescription",
                Title             = "Chart Title",
                OriginText        = "Chart Origin Text",
                IncludeOriginData = true,
                PreviewSettings   = true,
            };

            _axis = new Axis(AxisTypes.X);
            _curveChart.AddAxis(_axis);

            _curve = new Curve();

            var dataRepository = DomainHelperForSpecs.ObservedData();
            var xColumn        = dataRepository.BaseGrid;
            var yColumn        = dataRepository.ObservationColumns().First();

            _curve.SetxData(xColumn, dimensionFactory);
            _curve.SetyData(yColumn, dimensionFactory);


            _curveChart.AddCurve(_curve);

            _snapshotAxis = new Snapshots.Axis();
            A.CallTo(() => _axisMapper.MapToSnapshot(_axis)).Returns(_snapshotAxis);

            _snapshotCurve = new Snapshots.Curve();
            A.CallTo(() => _curveMapper.MapToSnapshot(_curve)).Returns(_snapshotCurve);

            return(_completed);
        }
Exemple #8
0
        protected override Task Context()
        {
            _curveOptionsMapper = A.Fake <CurveOptionsMapper>();
            sut = new ObservedDataCollectionMappper(_curveOptionsMapper);

            _observedDataRepository = DomainHelperForSpecs.ObservedData("ID").WithName("ObsData");
            _observedDataCollection = new Model.PopulationAnalyses.ObservedDataCollection();
            _observedDataCollection.ApplyGroupingToObservedData = true;
            _observedDataCollection.AddObservedData(_observedDataRepository);
            _firstObservedDataColumn  = _observedDataRepository.ObservationColumns().First();
            _observedDataCurveOptions = new ObservedDataCurveOptions
            {
                Caption  = "Obs Data Caption",
                ColumnId = _firstObservedDataColumn.Id
            };

            _observedDataCollection.AddCurveOptions(_observedDataCurveOptions);
            _snapshotCurveOptions = new CurveOptions();
            A.CallTo(() => _curveOptionsMapper.MapToSnapshot(_observedDataCurveOptions.CurveOptions)).Returns(_snapshotCurveOptions);
            return(_completed);
        }
Exemple #9
0
        protected override Task Context()
        {
            sut = new OutputMappingMapper(_logger);

            _simulation            = A.Fake <Simulation>().WithName("S");
            _output                = new Observer().WithName("OBS");
            _simulation.Model.Root = new Container {
                _output
            };
            _logger         = A.Fake <IOSPSuiteLogger>();
            _dataRepository = DomainHelperForSpecs.ObservedData("OBS_DATA");
            _outputMapping  = new OutputMapping
            {
                Scaling              = Scalings.Log,
                Weight               = 5,
                OutputSelection      = new SimulationQuantitySelection(_simulation, new QuantitySelection(_output.Name, QuantityType.Observer)),
                WeightedObservedData = new WeightedObservedData(_dataRepository)
            };

            _outputMapping.WeightedObservedData.Weights[1] = 2f;

            return(_completed);
        }