示例#1
0
def gsobolDistribution(d):
    distribution = ComposedDistribution([Uniform(0, 1)] * d)
    return distribution
示例#2
0
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)
histoGraph.setTitle("Histogramme de la surverse")
histoGraph.setXTitle("S (m)")
histoGraph.setYTitle("Frequence")
histoGraph.setLegends([""])
View(histoGraph).show()
示例#3
0
def ishigamiDistribution():
    distribution = ComposedDistribution([Uniform(-pi, pi)] * 3)
    return distribution
示例#4
0
def create_uniform_distribution():
    distribution = ComposedDistribution([Uniform(0., 1.)] * 2)
    return distribution
示例#5
0
Z_m = Uniform(54.0, 56.0)

# 3. View the PDF
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()

# 4. Create the joint distribution function, 
#    the output and the event. 
inputRandomVector = ComposedDistribution([Q, K_s, Z_v, Z_m])
outputRandomVector = RandomVector(f, RandomVector(inputRandomVector))
eventF = Event(outputRandomVector, GreaterOrEqual(), 0) 

# 4.bis Draw pairs
sample = inputRandomVector.getSample(500)
myPairs = Pairs(sample, "N=500", sample.getDescription(), "red", "bullet")
View(myPairs).show()

# 5. Create the Monte-Carlo algorithm
algoProb = MonteCarlo(eventF)
algoProb.setMaximumOuterSampling(100000)
algoProb.run()

# 6. Get the results
resultAlgo = algoProb.getResult()
Zm = Uniform(54.0, 56.0)

# 3. View the PDF
Q.setDescription(["Q (m3/s)"])
Ks.setDescription(["Ks (m^(1/3)/s)"])
Zv.setDescription(["Zv (m)"])
Zm.setDescription(["Zm (m)"])

View(Q.drawPDF()).show()
View(Ks.drawPDF()).show()
View(Zv.drawPDF()).show()
View(Zm.drawPDF()).show()

# 4. Create the joint distribution function, 
#    the output and the event. 
inputvector = ComposedDistribution([Q, Ks, Zv, Zm])
outputvector = RandomVector(f, RandomVector(inputvector))
eventF = Event(outputvector, GreaterOrEqual(), 0) 

# 4.bis Draw pairs
sample = inputvector.getSample(500)
myPairs = Pairs(sample, "N=500", sample.getDescription(), "red", "bullet")
View(myPairs).show()

# 5. Create the Monte-Carlo algorithm
algoProb = MonteCarlo(eventF)
algoProb.setMaximumOuterSampling(100000)
algoProb.run()

# 6. Get the results
resultAlgo = algoProb.getResult()