protected override void Context() { base.Context(); _distributionMetaData = new DistributionMetaData { Deviation = 2, Distribution = DistributionTypes.Normal, Mean = 5 }; _result = DistributionMetaData.From(_distributionMetaData); }
public static DistributionMetaData From(IDistributionMetaData distributionMetaData) { return(new DistributionMetaData { Mean = distributionMetaData.Mean, Deviation = distributionMetaData.Deviation, Distribution = distributionMetaData.Distribution }); }
public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter) { foreach (var factory in _allDistributionFactory) { if (factory.IsSatisfiedBy(distribution)) { return(factory.CreateFor(distribution, parameter)); } } throw new DistributionNotFoundException(distribution); }
public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter) { var minParameter = parameter.Parameter(Constants.Distribution.MINIMUM); var maxParameter = parameter.Parameter(Constants.Distribution.MAXIMUM); var distributionMetaData = distribution as ParameterDistributionMetaData; if (distributionMetaData != null) { minParameter.Value = distributionMetaData.MinValue.Value; maxParameter.Value = distributionMetaData.MaxValue.Value; } return(_distributionFormulaFactory.CreateUniformDistributionFormulaFor(parameter, minParameter, maxParameter)); }
public IDistribution MapFrom(IDistributionMetaData distributionMetaData) { if (distributionMetaData.Distribution == DistributionTypes.Normal) { return(new NormalDistribution(distributionMetaData.Mean, distributionMetaData.Deviation)); } if (distributionMetaData.Distribution == DistributionTypes.LogNormal) { return(new LogNormalDistribution(Math.Log(distributionMetaData.Mean), distributionMetaData.Deviation)); } if (distributionMetaData.Distribution == DistributionTypes.Discrete) { return(new NormalDistribution(distributionMetaData.Mean, 0)); } throw new ArgumentException(string.Format("Cannot create distribution for meta data '{0}'", distributionMetaData.Distribution), "distributionMetaData"); }
public bool IsSatisfiedBy(IDistributionMetaData distribution) { return(distribution.Distribution == DistributionTypes.Uniform); }
public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter) { return(_objectBaseFactory.Create <UnknownDistributionFormula>()); }
public DistributionNotFoundException(IDistributionMetaData distributionMetaData) : base(PKSimConstants.Error.DistributionUnknown(distributionMetaData.Distribution.Id)) { }
public bool IsSatisfiedBy(IDistributionMetaData distribution) => distribution.Distribution == DistributionTypes.LogNormal;
public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter) { parameter.MeanParameter.Value = distribution.Mean; parameter.DeviationParameter.Value = distribution.Deviation; return(_distributionFormulaFactory.CreateLogNormalDistributionFormulaFor(parameter, parameter.MeanParameter, parameter.DeviationParameter)); }
public bool IsSatisfiedBy(IDistributionMetaData distribution) => distribution.Distribution == DistributionTypes.Discrete;
protected override void Context() { sut = new DistributionMetaDataToDistributionMapper(); _distributionMetaData = new DistributionMetaData(); }
public void UpdateFrom(IDistributionMetaData distributionMetaData) { Mean = distributionMetaData.Mean; Deviation = distributionMetaData.Deviation; Distribution = distributionMetaData.Distribution; }