private void addPKParametersForOutput(ISimulation simulation, int numberOfIndividuals, SimulationResults runResults, Action <int> performIndividualScalingAction, QuantitySelection selectedQuantity, PopulationSimulationPKAnalyses popAnalyses, string moleculeName, PKCalculationOptions pkCalculationOptions, IReadOnlyList <PKCalculationOptionsFactory.ApplicationParameters> allApplicationParameters) { var availablePKParameters = _pkParameterRepository.All().Where(p => PKParameterCanBeUsed(p, pkCalculationOptions)).ToList(); //create pk parameter for each quantities foreach (var pkParameter in availablePKParameters) { var quantityPKParameter = new QuantityPKParameter { Name = pkParameter.Name, QuantityPath = selectedQuantity.Path, Dimension = pkParameter.Dimension }; quantityPKParameter.SetNumberOfIndividuals(numberOfIndividuals); popAnalyses.AddPKAnalysis(quantityPKParameter); } //add the values for each individual foreach (var individualResult in runResults.AllIndividualResults) { performIndividualScalingAction(individualResult.IndividualId); _pkCalculationOptionsFactory.UpdateAppliedDose(simulation, moleculeName, pkCalculationOptions, allApplicationParameters); var values = individualResult.ValuesFor(selectedQuantity.Path); var pkValues = _pkValuesCalculator.CalculatePK(individualResult.Time.Values, values.Values, pkCalculationOptions); foreach (var pkParameter in availablePKParameters) { var quantityPKParameter = popAnalyses.PKParameterFor(selectedQuantity.Path, pkParameter.Name); quantityPKParameter.SetValue(individualResult.IndividualId, pkValues.ValueOrDefaultFor(pkParameter.Name)); } } }
public void should_be_able_to_calculate_the_pk_parameters_for_the_successful_simulations() { _pkAnalysis.ShouldNotBeNull(); var values = _pkAnalysis.PKParameterFor(_outputPath, "C_max"); values.Count.ShouldBeEqualTo(4); }
public void should_not_create_more_entries_in_the_returns_value_that_expected() { _pkAnalysis.ShouldNotBeNull(); var values = _pkAnalysis.PKParameterFor(_outputPath, "C_max"); values.Count.ShouldBeEqualTo(5); float.IsNaN(values.ValueFor(3)).ShouldBeTrue(); }
public void should_exclude_the_norm_parameters() { _popAnalaysis.All().Count().ShouldBeEqualTo(1); _popAnalaysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).Values[0].ShouldBeEqualTo(10f); _popAnalaysis.HasPKParameterFor("Liver|Cell|Drug|Concentration", _p2.Name).ShouldBeFalse(); }
public void should_have_converted_display_dimension_into_core_dimension() { var c_max = _result.PKParameterFor(_outputPath, "C_max"); c_max.Dimension.Name.ShouldBeEqualTo(Constants.Dimension.MOLAR_CONCENTRATION); }
public void should_be_able_to_calculate_the_normalized_values() { var pkParameter = _pkAnalysis.PKParameterFor("Organism|PeripheralVenousBlood|C1|Plasma (Peripheral Venous Blood)", "C_max_tD1_tD2_norm"); pkParameter.ValueFor(0).ShouldBeGreaterThan(0); }
public void should_also_return_value_for_the_dynamic_parameters() { _popAnalysis.All().Count().ShouldBeEqualTo(2); _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).ValueFor(0).ShouldBeEqualTo(10f); _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _userDefinedParameter1.Name).ValueFor(0).ShouldBeEqualTo(30f); }