Пример #1
0
        public RandomPopulationSettings MapFrom(PopulationSettings batchPopulationSettings)
        {
            var originData = originDataFrom(batchPopulationSettings);

            var individual         = _individualFactory.CreateStandardFor(originData);
            var populationSettings = _individualToPopulationSettingsMapper.MapFrom(individual);

            populationSettings.NumberOfIndividuals = batchPopulationSettings.NumberOfIndividuals;

            setRange(populationSettings, CoreConstants.Parameter.AGE, batchPopulationSettings.MinAge, batchPopulationSettings.MaxAge);
            setRange(populationSettings, CoreConstants.Parameter.MEAN_HEIGHT, batchPopulationSettings.MinHeight, batchPopulationSettings.MaxHeight);
            setRange(populationSettings, CoreConstants.Parameter.MEAN_WEIGHT, batchPopulationSettings.MinWeight, batchPopulationSettings.MaxWeight);
            setRange(populationSettings, CoreConstants.Parameter.BMI, batchPopulationSettings.MinBMI, batchPopulationSettings.MaxBMI);

            if (populationSettings.ContainsParameterRangeFor(CoreConstants.Parameter.GESTATIONAL_AGE))
            {
                setRange(populationSettings, CoreConstants.Parameter.GESTATIONAL_AGE, batchPopulationSettings.MinGestationalAge, batchPopulationSettings.MaxGestationalAge);
            }

            //in case of multiple gender, adjust the ration according to the feamales proportion
            if (individual.AvailableGenders().Count() > 1)
            {
                populationSettings.GenderRatio(_genderRepository.Female).Ratio = batchPopulationSettings.ProportionOfFemales;
                populationSettings.GenderRatio(_genderRepository.Male).Ratio   = 100 - batchPopulationSettings.ProportionOfFemales;
            }

            return(populationSettings);
        }
Пример #2
0
        public override async Task <RandomPopulationSettings> MapToModel(PopulationSettings snapshot)
        {
            var individual = await _individualMapper.MapToModel(snapshot.Individual);

            var settings = _populationSettingsMapper.MapFrom(individual);

            settings.NumberOfIndividuals = snapshot.NumberOfIndividuals;
            updateGenderRatios(settings, snapshot);
            await updateModelRange(settings, CoreConstants.Parameters.AGE, snapshot.Age);
            await updateModelRange(settings, CoreConstants.Parameters.MEAN_WEIGHT, snapshot.Weight);
            await updateModelRange(settings, CoreConstants.Parameters.MEAN_HEIGHT, snapshot.Height);
            await updateModelRange(settings, CoreConstants.Parameters.GESTATIONAL_AGE, snapshot.GestationalAge);
            await updateModelRange(settings, CoreConstants.Parameters.BMI, snapshot.BMI);

            return(settings);
        }
Пример #3
0
 public PopulationSettingsDTO MapFrom(PKSim.Core.Model.Individual individual)
 {
     return(MapFrom(_individualToPopulationSettingsMapper.MapFrom(individual)));
 }
Пример #4
0
 public PopulationSettingsDTO MapFrom(Individual individual)
 {
     return(MapFrom(_individualToPopulationSettingsMapper.MapFrom(individual)));
 }