Ejemplo n.º 1
0
    tensorIn = [0.4]
    tensorRef = tensorResult.getMetaModel()(tensorIn)

    # Distribution parameters

    # ArcsineMuSigma parameter ave
    ams_parameters = ot.ArcsineMuSigma(8.4, 2.25)
    myStudy.add('ams_parameters', ams_parameters)
    # BetaMuSigma parameter save
    bms_parameters = ot.BetaMuSigma(0.2, 0.6, -1, 2)
    myStudy.add('bms_parameters', bms_parameters)
    # GammaMuSigma parameter save
    gmms_parameters = ot.GammaMuSigma(1.5, 2.5, -0.5)
    myStudy.add('gmms_parameters', gmms_parameters)
    # GumbelMuSigma parameter save
    gms_parameters = ot.GumbelMuSigma(1.5, 1.3)
    myStudy.add('gms_parameters', gms_parameters)
    # LogNormalMuSigma parameter save
    lnms_parameters = ot.LogNormalMuSigma(30000.0, 9000.0, 15000)
    myStudy.add('lnms_parameters', lnms_parameters)
    # LogNormalMuSigmaOverMu parameter save
    lnmsm_parameters = ot.LogNormalMuSigmaOverMu(0.63, 5.24, -0.5)
    myStudy.add('lnmsm_parameters', lnmsm_parameters)
    # WeibullMinMuSigma parameter save
    wms_parameters = ot.WeibullMinMuSigma(1.3, 1.23, -0.5)
    myStudy.add('wms_parameters', wms_parameters)

    # MemoizeFunction
    f = ot.SymbolicFunction(['x1', 'x2'], ['x1*x2'])
    memoize = ot.MemoizeFunction(f)
    memoize([5, 6])
    def __init__(
        self,
        threshold=0.0,
        a=70.0,
        b=80.0,
        mu2=39.0,
        sigma2=0.1,
        mu3=1500.0,
        sigma3=350.0,
        mu4=400.0,
        sigma4=0.1,
        mu5=250000.0,
        sigma5=35000.0,
    ):
        """
        Creates a reliability problem RP14.

        The event is {g(X) < threshold} where

        X = (x1, x2, x3, x4, x5)

        g(X) = x1 - 32 / (pi_ * x2^3) * sqrt(x3^2 * x4^2 / 16 + x5^2)

        We have :
            x1 ~ Uniform(a, b)

            x2 ~ Normal(mu2, sigma2)

            x3 ~ Gumbel-max(mu3, sigma3)

            x4 ~ Normal(mu4, sigma4)

            x5 ~ Normal(mu5, sigma5)

        Parameters
        ----------
        threshold : float
            The threshold.
        a : float
            Lower bound of the Uniform distribution X1.
        b : float
            Upper bound of the Uniform distribution X1.
        mu2 : float
            The mean of the X2 Normal distribution.
        sigma2 : float
            The standard deviation of the X2 Normal distribution.
        mu3 : float
            The mean of the X3 Gumbel distribution.
        sigma3 : float
            The standard deviation of the X3 Gumbel distribution.
        mu4 : float
            The mean of the X4 Normal distribution.
        sigma4 : float
            The standard deviation of the X4 Normal distribution.
        mu5 : float
            The mean of the X5 Normal distribution.
        sigma5 : float
            The standard deviation of the X5 Normal distribution.
        """

        formula = "x1 - 32 / (pi_ * x2^3) * sqrt(x3^2 * x4^2 / 16 + x5^2)"

        limitStateFunction = ot.SymbolicFunction(
            ["x1", "x2", "x3", "x4", "x5"], [formula])
        X1 = ot.Uniform(a, b)
        X1.setDescription(["X1"])
        X2 = ot.Normal(mu2, sigma2)
        X2.setDescription(["X2"])
        X3 = ot.ParametrizedDistribution(ot.GumbelMuSigma(mu3, sigma3))
        X3.setDescription(["X3"])
        X4 = ot.Normal(mu4, sigma4)
        X4.setDescription(["X4"])
        X5 = ot.Normal(mu5, sigma5)
        X5.setDescription(["X5"])

        myDistribution = ot.ComposedDistribution([X1, X2, X3, X4, X5])
        inputRandomVector = ot.RandomVector(myDistribution)
        outputRandomVector = ot.CompositeRandomVector(limitStateFunction,
                                                      inputRandomVector)
        thresholdEvent = ot.ThresholdEvent(outputRandomVector, ot.Less(),
                                           threshold)

        name = "RP14"
        probability = 0.00752
        super(ReliabilityProblem14, self).__init__(name, thresholdEvent,
                                                   probability)
        return None
Ejemplo n.º 3
0
#! /usr/bin/env python

import openturns as ot

distParams = []
distParams.append(ot.ArcsineMuSigma(8.4, 2.25))
distParams.append(ot.BetaMuSigma(0.2, 0.6, -1, 2))
distParams.append(ot.GammaMuSigma(1.5, 2.5, -0.5))
distParams.append(ot.GumbelLambdaGamma(0.6, 6.0))
distParams.append(ot.GumbelMuSigma(1.5, 1.3))
distParams.append(ot.LogNormalMuErrorFactor(0.63, 1.5, -0.5))
distParams.append(ot.LogNormalMuSigma(0.63, 3.3, -0.5))
distParams.append(ot.LogNormalMuSigmaOverMu(0.63, 5.24, -0.5))
distParams.append(ot.WeibullMaxMuSigma(1.3, 1.23, 3.1))
distParams.append(ot.WeibullMinMuSigma(1.3, 1.23, -0.5))

for distParam in distParams:

    print('Distribution Parameters ', repr(distParam))
    print('Distribution Parameters ', distParam)

    non_native = distParam.getValues()
    desc = distParam.getDescription()
    print('non-native=', non_native, desc)
    native = distParam.evaluate()
    print('native=', native)
    non_native = distParam.inverse(native)
    print('non-native=', non_native)
    print('built dist=', distParam.getDistribution())

    # derivative of the native parameters with regards the parameters of the
Ejemplo n.º 4
0
#! /usr/bin/env python

import openturns as ot

distribution = ot.Gumbel(0.5, 2.5)
size = 10000
sample = distribution.getSample(size)
factory = ot.GumbelFactory()
print('Distribution                      =', repr(distribution))
result = factory.buildEstimator(sample)
estimatedDistribution = result.getDistribution()
print('Estimated distribution            =', repr(estimatedDistribution))
parameterDistribution = result.getParameterDistribution()
print('Parameter distribution            =', parameterDistribution)
defaultDistribution = factory.build()
print('Default distribution              =', defaultDistribution)
fromParameterDistribution = factory.build(distribution.getParameter())
print('Distribution from parameters      =', fromParameterDistribution)
typedEstimatedDistribution = factory.buildAsGumbel(sample)
print('Typed estimated distribution      =', typedEstimatedDistribution)
defaultTypedDistribution = factory.buildAsGumbel()
print('Default typed distribution        =', defaultTypedDistribution)
typedFromParameterDistribution = factory.buildAsGumbel(
    distribution.getParameter())
print('Typed distribution from parameters=', typedFromParameterDistribution)
result = factory.buildEstimator(sample, ot.GumbelMuSigma())
estimatedDistribution = result.getDistribution()
print('Estimated distribution (mu/sigma)       =', repr(estimatedDistribution))
parameterDistribution = result.getParameterDistribution()
print('Parameter distribution (mu/sigma)       =', parameterDistribution)