1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
{{ objname }}
{{ underline }}{{ underline }}
.. plot::
:include-source: False
import openturns as ot
from matplotlib import pyplot as plt
from openturns.viewer import View
if "{{ objname }}" == "ExponentialModel":
covarianceModel = ot.ExponentialModel([0.5], [5.0])
elif "{{ objname }}" == "GeneralizedExponential":
covarianceModel = ot.GeneralizedExponential([2.0], [3.0], 1.5)
elif "{{ objname }}" == "ProductCovarianceModel":
amplitude = [1.0]
scale1 = [4.0]
scale2 = [4.0]
cov1 = ot.ExponentialModel(scale1, amplitude)
cov2 = ot.ExponentialModel(scale2, amplitude)
covarianceModel = ot.ProductCovarianceModel([cov1, cov2])
elif "{{ objname }}" == "RankMCovarianceModel":
variance = [1.0, 2.0]
basis = ot.LinearBasisFactory().build()
covarianceModel = ot.RankMCovarianceModel(variance, basis)
elif "{{ objname }}" == "StationaryFunctionalCovarianceModel":
rho = ot.SymbolicFunction(["tau"], ["exp(-tau)*cos(2*pi_*tau)"])
covarianceModel = ot.StationaryFunctionalCovarianceModel([1.0], [1.0], rho)
else:
covarianceModel = ot.{{ objname }}()
title = str(covarianceModel)[:100]
if covarianceModel.getInputDimension() == 1:
scale = covarianceModel.getScale()[0]
if covarianceModel.isStationary():
def f(x):
return [covarianceModel(x)[0, 0]]
func = ot.PythonFunction(1, 1, f)
func.setDescription(["$tau$", "$cov$"])
cov_graph = func.draw(-3.0 * scale, 3.0 * scale, 129)
cov_graph.setTitle(title)
fig = plt.figure(figsize=(10, 4))
cov_axis = fig.add_subplot(111)
View(cov_graph, figure=fig, axes=[cov_axis], add_legend=False)
else:
def f(x):
return [covarianceModel([x[0]], [x[1]])[0, 0]]
func = ot.PythonFunction(2, 1, f)
func.setDescription(["$s$", "$t$", "$cov$"])
cov_graph = func.draw([-3.0 * scale]*2, [3.0 * scale]*2, [129]*2)
cov_graph.setTitle(title)
fig = plt.figure(figsize=(10, 4))
cov_axis = fig.add_subplot(111)
View(cov_graph, figure=fig, axes=[cov_axis], add_legend=False, square_axes=True)
elif covarianceModel.getInputDimension() == 2:
scale = covarianceModel.getScale()
if covarianceModel.isStationary():
def f(x):
return [covarianceModel(x)[0, 0]]
func = ot.PythonFunction(2, 1, f)
func.setDescription(["$s$", "$t$", "$cov$"])
cov_graph = func.draw(-3.0 * scale, 3.0 * scale, [129]*2)
cov_graph.setTitle(title)
fig = plt.figure(figsize=(10, 4))
cov_axis = fig.add_subplot(111)
View(cov_graph, figure=fig, axes=[cov_axis], add_legend=False, square_axes=True)
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:exclude-members: __call__, thisown
{% block methods %}
.. automethod:: __init__
{% endblock %}
.. minigallery:: {{module}}.{{objname}}
:add-heading: Examples using the class
|