Esempio n. 1
0
        private void addAdvancedParameterIfRequired(IParameter parameter, PopulationSimulation populationSimulation)
        {
            if (!parameter.CanBeDefinedAsAdvanced())
            {
                return;
            }

            var advancedParameter = _advancedParameterFactory.Create(parameter, DistributionTypes.Unknown);

            //do not generate random values as these were loaded from files
            populationSimulation.AddAdvancedParameter(advancedParameter, generateRandomValues: false);
        }
      private ICommand addParameterVariability(IndividualMolecule individualMolecule, IParameter parameter, Population population, bool usePredefinedMeanVariability)
      {
         var predefinedVariability = _moleculeParameterRepository.ParameterFor(individualMolecule.Name, parameter.Name);
         if (predefinedVariability == null)
            return new PKSimEmptyCommand();

         var advancedParameter = _advancedParameterFactory.Create(parameter, predefinedVariability.Formula.DistributionType());
         advancedParameter.DistributedParameter.MeanParameter.Value = usePredefinedMeanVariability ? predefinedVariability.MeanParameter.Value : parameter.Value;
         advancedParameter.DistributedParameter.DeviationParameter.Value = predefinedVariability.DeviationParameter.Value;

         return _advancedParametersTask.AddAdvancedParameter(advancedParameter, population);
      }
Esempio n. 3
0
        private void createAdvancedParametersFor(ImportPopulation importPopulation)
        {
            foreach (var parameterPath in importPopulation.IndividualPropertiesCache.AllParameterPaths())
            {
                if (_allCreateIndividualParameters.Contains(parameterPath))
                {
                    continue;
                }

                var advancedParameter = _advancedParameterFactory.Create(_allParameters[parameterPath], DistributionTypes.Unknown);

                //do not generate random values as these were loaded from files
                importPopulation.AddAdvancedParameter(advancedParameter, generateRandomValues: false);
            }
        }
        public override async Task <ModelAdvancedParameter> MapToModel(SnapshotAdvancedParameter snapshot, PathCache <IParameter> allParameters)
        {
            var parameter = allParameters[snapshot.Name];

            if (parameter == null)
            {
                _logger.AddWarning(PKSimConstants.Error.SnapshotParameterNotFound(snapshot.Name));
                return(null);
            }

            var advancedParameter = _advancedParameterFactory.Create(parameter, DistributionTypes.ById(snapshot.DistributionType));

            advancedParameter.Seed = snapshot.Seed;

            await UpdateParametersFromSnapshot(snapshot, advancedParameter.DistributedParameter);

            return(advancedParameter);
        }