private void addOutput(QuantitySelectionDTO output)
        {
            //Do not add simulation name as the output are already constructed as the intersection of all outputs available for all simulations
            var displayPathAsString = _quantityDisplayPathMapper.DisplayPathAsStringFor(output.Quantity, addSimulationName: false);

            _selectedOutputsPresenter.AddOutput(output.Quantity, displayPathAsString);
        }
예제 #2
0
        protected override string CurveNameDefinition(DataColumn column)
        {
            var simulationForDataColumn = _dataRepositoryCache[column.Repository];

            //Always use repository name for curve name when comparing results
            return(_quantityDisplayPathMapper.DisplayPathAsStringFor(simulationForDataColumn, column, column.Repository.Name));
        }
예제 #3
0
        private IReadOnlyCollection <QuantityPKParameterDTO> availablePKParametersFor(IQuantity quantity)
        {
            var quantityDTO         = _quantitySelectionDTOMapper.MapFrom(quantity);
            var quantityDisplayPath = _quantityDisplayPathMapper.DisplayPathAsStringFor(quantity, addSimulationName: false);

            return(_populationDataCollector.AllPKParametersFor(quantityDTO.QuantityPath)
                   .Select(x => mapFrom(x, quantityDisplayPath)).ToList());
        }
예제 #4
0
        public Task ExportResultsToExcelAsync(IndividualSimulation individualSimulation, string fileName, bool launchExcel = true)
        {
            var exportOption = new DataColumnExportOptions
            {
                ColumnNameRetriever = x => _quantityDisplayPathMapper.DisplayPathAsStringFor(individualSimulation, x)
            };

            return(_dataRepositoryTask.ExportToExcelAsync(individualSimulation.DataRepository, fileName, launchExcel, exportOption));
        }
예제 #5
0
        private void initializeFromTemplate(ICurveChart originalChart, ICurveChart clonedChart, IndividualSimulation simulation)
        {
            var allAvailableColumns = new List <DataColumn>();

            addSimulationResults(simulation, allAvailableColumns);
            addObservedDataColumns(simulation, allAvailableColumns);
            _chartFromTemplateService.CurveNameDefinition = c => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulation, c);
            _chartFromTemplateService.InitializeChartFromTemplate(clonedChart, allAvailableColumns, _chartTemplateMapper.MapFrom(originalChart));
        }
        private string parameterDisplayPathFor(SensitivityParameter sensitivityParameter)
        {
            if (sensitivityParameter?.Parameter == null)
            {
                return(string.Empty);
            }

            return(_quantityDisplayPathMapper.DisplayPathAsStringFor(sensitivityParameter.Parameter, addSimulationName: true));
        }
예제 #7
0
        public Task ExportToCsvAsync(ISimulation simulation, DataRepository results, string fileName)
        {
            var options = new DataColumnExportOptions
            {
                ColumnNameRetriever = x => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulation, x),
                UseDisplayUnit      = false
            };

            return(_dataRepositoryTask.ExportToCsvAsync(results, fileName, options));
        }
        public SimulationParameterSelectionDTO MapFrom(ISimulation simulation, IParameter parameter)
        {
            var quantitySelectionDTO = _quantitySelectionDTOMapper.MapFrom(parameter);
            var displayString        = _quantityDisplayPathMapper.DisplayPathAsStringFor(parameter, addSimulationName: true);

            UpdateContainerDisplayNameAndIconsIfEmpty(quantitySelectionDTO, parameter);
            return(new SimulationParameterSelectionDTO(simulation, quantitySelectionDTO, displayString)
            {
                IsFavorite = _favoriteRepository.All().Contains(quantitySelectionDTO.QuantityPath),
                ValueParameter = _parameterDTOMapper.MapFrom(parameter)
            });
        }
예제 #9
0
        public virtual string FullPathFor(IObjectBase objectBase, bool addSimulationName = false)
        {
            switch (objectBase)
            {
            case IQuantity quantity:
                return(_quantityDisplayPathMapper.DisplayPathAsStringFor(quantity, addSimulationName));

            case IEntity entity:
                return(entity.EntityPath());
            }

            return(DisplayFor(objectBase));
        }
예제 #10
0
        public SimulationQuantitySelectionDTO MapFrom(ISimulation simulation, IQuantity quantity)
        {
            var quantitySelectionDTO = _quantitySelectionDTOMapper.MapFrom(quantity);

            if (quantitySelectionDTO == null)
            {
                return(null);
            }

            var displayString = _quantityDisplayPathMapper.DisplayPathAsStringFor(quantity, addSimulationName: true);

            UpdateContainerDisplayNameAndIconsIfEmpty(quantitySelectionDTO, quantity);
            return(new SimulationQuantitySelectionDTO(simulation, quantitySelectionDTO, displayString));
        }
예제 #11
0
        public string FullPathFor(IObjectBase objectBase, bool addSimulationName = false)
        {
            switch (objectBase)
            {
            case IQuantity quantity:
                return(_quantityDisplayPathMapper.DisplayPathAsStringFor(quantity, addSimulationName));

            case ParameterAlternativeGroup parameterAlternativeGroup:
                return(displayFor(parameterAlternativeGroup));

            case IEntity entity:
                return(entity.EntityPath());
            }

            return(displayFor(objectBase));
        }
예제 #12
0
        public IEnumerable <DataTable> ExportToDataTable(IEnumerable <DataColumn> dataColumns, GlobalPKAnalysis globalPKAnalysis, DataTable dataTable, IEnumerable <Simulation> simulations)
        {
            var allDataTables  = new List <DataTable>();
            var allSimulations = simulations.ToList();

            if (allSimulations.Any())
            {
                string ColumnNameRetriever(DataColumn dataColumn) => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulationForColumn(dataColumn, allSimulations), dataColumn);

                allDataTables.AddRange(_dataRepositoryTask.ToDataTable(dataColumns, ColumnNameRetriever, _dimensionFactory.MergedDimensionFor));
            }

            allDataTables.Add(_globalPKAnalysisToDataTableMapper.MapFrom(globalPKAnalysis));
            allDataTables.Add(dataTable);

            return(allDataTables);
        }
        private ObservedCurveData createCurveData(DataColumn observedDataColumn, ObservedDataCurveOptions observedDataCurveOptions)
        {
            if (string.IsNullOrEmpty(observedDataCurveOptions.Caption))
            {
                //use null here as observed data do not belong to any simulation
                observedDataCurveOptions.Caption = _displayPathMapper.DisplayPathAsStringFor(null, observedDataColumn);
            }

            var observedCurve = new ObservedCurveData(errorTypeFrom(observedDataColumn))
            {
                Id      = observedDataColumn.Id,
                Caption = observedDataCurveOptions.Caption,
            };

            updateCurveOptions(observedDataCurveOptions.CurveOptions, observedCurve);

            return(observedCurve);
        }
예제 #14
0
        public string FullPathFor(IObjectBase objectBase, bool addSimulationName = false)
        {
            var quantity = objectBase as IQuantity;

            if (quantity != null)
            {
                return(_quantityDisplayPathMapper.DisplayPathAsStringFor(quantity, addSimulationName));
            }

            var entity = objectBase as IEntity;

            if (entity != null)
            {
                return(entity.EntityPath());
            }

            return(_representationInfoRepository.DisplayNameFor(objectBase));
        }
예제 #15
0
        protected override void Context()
        {
            _quantityPathToQuantityDisplayPathMapper = A.Fake <IQuantityPathToQuantityDisplayPathMapper>();
            sut             = new CurveNamer(_quantityPathToQuantityDisplayPathMapper);
            _simulation     = A.Fake <ISimulation>().WithName("simulationName");
            _dataRepository = DomainHelperForSpecs.SimulationDataRepositoryFor(_simulation.Name);
            _dataColumn     = _dataRepository.AllButBaseGrid().First();

            A.CallTo(() => _quantityPathToQuantityDisplayPathMapper.DisplayPathAsStringFor(_simulation, _dataColumn, true)).ReturnsLazily(() => $"{_simulation.Name}:{_dataColumn.Name}");

            _curveChart       = new CurveChart();
            _dimensionFactory = A.Fake <IDimensionFactory>();
            _curve            = _curveChart.CreateCurve(_dataRepository.BaseGrid, _dataColumn, $"{_simulation.Name}:{_dataColumn.Name}", _dimensionFactory);
            _anotherCurve     = _curveChart.CreateCurve(_dataRepository.BaseGrid, _dataColumn, "AnotherColumnName", _dimensionFactory);
            _curveChart.AddCurve(_curve);
            _curveChart.AddCurve(_anotherCurve);
            _charts = new List <CurveChart> {
                _curveChart
            };
        }
예제 #16
0
 public string CurveNameForColumn(ISimulation simulation, DataColumn dataColumn, bool addSimulationName)
 {
     return(_quantityPathToQuantityDisplayPathMapper.DisplayPathAsStringFor(simulation, dataColumn, addSimulationName));
 }
        public SensitivityParameterDTO MapFrom(SensitivityParameter sensitivityParameter)
        {
            var sensitivityParameterDTO = new SensitivityParameterDTO(sensitivityParameter);

            sensitivityParameterDTO.NumberOfStepsParameter  = _parameterMapper.MapFrom(sensitivityParameter.NumberOfStepsParameter, sensitivityParameterDTO, x => x.NumberOfSteps, x => x.NumberOfStepsParameter);
            sensitivityParameterDTO.VariationRangeParameter = _parameterMapper.MapFrom(sensitivityParameter.VariationRangeParameter, sensitivityParameterDTO, x => x.VariationRange, x => x.VariationRangeParameter);

            sensitivityParameterDTO.DisplayPath = sensitivityParameter.Parameter != null?_quantityDisplayPathMapper.DisplayPathAsStringFor(sensitivityParameter.Parameter, addSimulationName : true) : sensitivityParameter.ParameterSelection.Path;

            return(sensitivityParameterDTO);
        }
예제 #18
0
        public IEnumerable <DataTable> ExportToDataTable(IEnumerable <DataColumn> dataColumns, GlobalPKAnalysis globalPKAnalysis, DataTable dataTable, IEnumerable <Simulation> simulations)
        {
            var allDataTables  = new List <DataTable>();
            var allSimulations = simulations.ToList();

            if (allSimulations.Any())
            {
                allDataTables.AddRange(_dataRepositoryTask.ToDataTable(dataColumns, x => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulationForColumn(x, allSimulations), x)));
            }

            allDataTables.Add(_globalPKAnalysisToDataTableMapper.MapFrom(globalPKAnalysis));
            allDataTables.Add(dataTable);

            return(allDataTables);
        }
        public Task ExportToCsvAsync(ISimulation simulation, DataRepository results, string fileName)
        {
            var dataTable = _dataRepositoryTask.ToDataTable(results, x => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulation, x), x => x.Dimension, useDisplayUnit: false).First();

            return(Task.Run(() => dataTable.ExportToCSV(fileName)));
        }
예제 #20
0
        public Task ExportResultsToExcel(IndividualSimulation individualSimulation)
        {
            _buildingBlockTask.LoadResults(individualSimulation);
            if (!individualSimulation.HasResults)
            {
                throw new PKSimException(PKSimConstants.Error.CannotExportResultsPleaseRunSimulation(individualSimulation.Name));
            }

            return(exportToFileAsync(PKSimConstants.UI.ExportSimulationResultsToExcel, Constants.Filter.EXCEL_SAVE_FILE_FILTER, PKSimConstants.UI.DefaultResultsExportNameFor(individualSimulation.Name), async fileName =>
            {
                var dataTables = _dataRepositoryTask.ToDataTable(individualSimulation.DataRepository, x => _quantityDisplayPathMapper.DisplayPathAsStringFor(individualSimulation, x), x => x.Dimension);
                await Task.Run(() => _dataRepositoryTask.ExportToExcel(dataTables, fileName, launchExcel: true));
            }, Constants.DirectoryKey.REPORT));
        }