示例#1
0
 protected override void Context()
 {
     base.Context();
     _individualCharacteristics = new IndividualCharacteristics
     {
         Species    = CoreConstants.Species.HUMAN,
         Population = CoreConstants.Population.ICRP,
         Age        = new Parameter
         {
             Value = 30,
             Unit  = "year(s)",
         },
         Weight = new Parameter
         {
             Value = 75,
             Unit  = "kg",
         },
         Height = new Parameter
         {
             Value = 175,
             Unit  = "cm",
         },
         Gender = CoreConstants.Gender.Male
     };
 }
示例#2
0
 protected override void Context()
 {
     base.Context();
     _individualCharacteristics = new IndividualCharacteristics
     {
         Species    = CoreConstants.Species.HUMAN,
         Population = CoreConstants.Population.ICRP,
         Age        = new Parameter
         {
             Value = 30,
             Unit  = "year(s)",
         },
         Weight = new Parameter
         {
             Value = 75,
             Unit  = "kg",
         },
         Height = new Parameter
         {
             Value = 175,
             Unit  = "cm",
         },
         Gender       = CoreConstants.Gender.MALE,
         DiseaseState = CoreConstants.DiseaseStates.CKD
     };
     _individualCharacteristics.AddDiseaseStateParameter(new Parameter {
         Name = TARGET_GFR, Value = 0.005, Unit = GFR_UNIT
     });
 }
示例#3
0
 protected override void Context()
 {
     base.Context();
     _individualCharacteristics = new IndividualCharacteristics
     {
         Species    = CoreConstants.Species.HUMAN,
         Population = CoreConstants.Population.ICRP,
     };
 }
示例#4
0
        public CreateIndividualResults CreateIndividual(IndividualCharacteristics individualCharacteristics)
        {
            var originData                   = originDataFrom(individualCharacteristics);
            var moleculeOntogenies           = individualCharacteristics.MoleculeOntogenies;
            var individual                   = _individualFactory.CreateAndOptimizeFor(originData, individualCharacteristics.Seed);
            var individualProperties         = _individualValuesMapper.MapFrom(individual);
            var allIndividualParameters      = individualProperties.ParameterValues;
            var ontogenyParameters           = _ontogenyFactorsRetriever.FactorsFor(originData, moleculeOntogenies).Select(x => new ParameterValueWithUnit(x));
            var allDistributedParameterCache = _containerTask.CacheAllChildren <IDistributedParameter>(individual);
            var allIndividualParametersCache = _containerTask.CacheAllChildren <IParameter>(individual);
            var distributedParameters        = new Cache <string, ParameterValueWithUnit>(x => x.ParameterPath);
            var derivedParameters            = new List <ParameterValueWithUnit>();

            //Add Age and Height parameter that is not distributed at the moment
            if (originData.Population.IsAgeDependent)
            {
                distributedParameters.Add(parameterValueFrom(individual.Organism.Parameter(CoreConstants.Parameters.AGE)));
                distributedParameters.Add(parameterValueFrom(individual.Organism.Parameter(Constants.Parameters.GESTATIONAL_AGE)));
            }

            if (originData.Population.IsHeightDependent)
            {
                distributedParameters.Add(parameterValueFrom(individual.Organism.Parameter(CoreConstants.Parameters.HEIGHT)));
            }

            distributedParameters.Add(parameterValueFrom(individual.Organism.Parameter(CoreConstants.Parameters.ONTOGENY_FACTOR_AGP)));
            distributedParameters.Add(parameterValueFrom(individual.Organism.Parameter(CoreConstants.Parameters.ONTOGENY_FACTOR_ALBUMIN)));

            foreach (var individualParameter in allIndividualParameters)
            {
                var parameter = allIndividualParametersCache[individualParameter.ParameterPath];
                if (parameter == null)
                {
                    continue;
                }

                var parameterValue = new ParameterValueWithUnit(individualParameter, parameter?.BaseUnitName());
                if (allDistributedParameterCache.Contains(individualParameter.ParameterPath))
                {
                    distributedParameters.Add(parameterValue);
                }

                //Do not add parameters that were added specifically
                else if (!distributedParameters.Contains(individualParameter.ParameterPath))
                {
                    derivedParameters.Add(parameterValue);
                }
            }


            //add Ontogeny parameters
            distributedParameters.AddRange(ontogenyParameters);

            return(new CreateIndividualResults(distributedParameters.ToArray(), derivedParameters.ToArray(), individual.Seed));
        }
示例#5
0
        public DistributedParameterValueWithUnit[] DistributionsFor(IndividualCharacteristics individualCharacteristics)
        {
            var originData            = originDataFrom(individualCharacteristics);
            var moleculeOntogenies    = individualCharacteristics.MoleculeOntogenies;
            var individual            = _individualFactory.CreateAndOptimizeFor(originData, individualCharacteristics.Seed);
            var distributedParameters = individual.GetAllChildren <IDistributedParameter>().Select(distributedParameterValueFrom).ToList();

            //Ontogeny factors have no units
            distributedParameters.AddRange(_ontogenyFactorsRetriever.DistributionFactorsFor(originData, moleculeOntogenies)
                                           .Select(x => new DistributedParameterValueWithUnit(x, "")));
            return(distributedParameters.ToArray());
        }