Z_c = H + Z_v return [Z_c - Z_d] # Creation of the problem function inputDim = 4 # Input dimension f = PythonFunction(inputDim, 1, functionCrue) f.enableHistory() # Random vector definition Qmu=1013. Qsigma=558. Q = Gumbel(1./Qsigma, Qmu) Q = TruncatedDistribution(Q, 0, inf) K_s = Normal(30.0, 7.5) K_s = TruncatedDistribution(K_s, 0, inf) Z_v = Uniform(49.0, 51.0) Z_m = Uniform(54.0, 56.0) Q.setDescription(["Q (m3/s)"]) K_s.setDescription(["Ks (m^(1/3)/s)"]) Z_v.setDescription(["Zv (m)"]) Z_m.setDescription(["Zm (m)"]) View(Q.drawPDF()).show() View(K_s.drawPDF()).show() View(Z_v.drawPDF()).show() View(Z_m.drawPDF()).show() inputRandomVector = ComposedDistribution([Q, K_s, Z_v, Z_m]) outputRandomVector = RandomVector(f, RandomVector(inputRandomVector)) eventF = Event(outputRandomVector, GreaterOrEqual(), 0)
def gsobolDistribution(d): distribution = ComposedDistribution([Uniform(0, 1)] * d) return distribution
def ishigamiDistribution(): distribution = ComposedDistribution([Uniform(-pi, pi)] * 3) return distribution
H_d = 3.0 # Hauteur de la digue Z_b = 55.5 # Côte de la berge L = 5.0e3 # Longueur de la rivière B = 300.0 # Largeur de la rivière myParametricWrapper = CrueFunction(H_d, Z_b, L, B) myWrapper = Function(myParametricWrapper) # 2. Random vector definition Q = Gumbel(1.0 / 558.0, 1013.0) Q = TruncatedDistribution(Q, 0.0, TruncatedDistribution.LOWER) K_s = Normal(30.0, 7.5) K_s = TruncatedDistribution(K_s, 0.0, TruncatedDistribution.LOWER) Z_v = Uniform(49.0, 51.0) Z_m = Uniform(54.0, 56.0) # 3. Create the joint distribution function, # the output and the event. inputDistribution = ComposedDistribution([Q, K_s, Z_v, Z_m]) inputRandomVector = RandomVector(inputDistribution) outputRandomVector = RandomVector(myWrapper, inputRandomVector) # 4. Get a sample of the output sampleS = outputRandomVector.getSample(500) # 5. Plot the histogram barsNumber = int(sqrt(sampleS.getSize())) histoGraph = VisualTest.DrawHistogram(sampleS, barsNumber)
def create_uniform_distribution(): distribution = ComposedDistribution([Uniform(0., 1.)] * 2) return distribution