File: OrthogonalUniVariateFunctionFamily.rst_t

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (47 lines) | stat: -rw-r--r-- 1,483 bytes parent folder | download | duplicates (2)
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
{{ objname }}
{{ underline }}

.. plot::
    :include-source: False

    import openturns as ot
    import numpy as np
    from matplotlib import pyplot as plt
    n_functions = 8
    function_factory = ot.{{ objname }}()
    if function_factory.getClassName() == "KrawtchoukFactory":
        function_factory = ot.{{ objname }}(n_functions, .5)
    functions = [function_factory.build(i) for i in range(n_functions)]
    measure = function_factory.getMeasure()
    if hasattr(measure, "getA") and hasattr(measure, "getB"):
        x_min = measure.getA()
        x_max = measure.getB()
    else:
        x_min = measure.computeQuantile(1e-3)[0]
        x_max = measure.computeQuantile(1. - 1e-3)[0]
    n_points = 200
    meshed_support = np.linspace(x_min, x_max, n_points)
    fig = plt.figure()
    ax = fig.add_subplot(111)
    for i in range(n_functions):
        plt.plot(meshed_support,
                 [functions[i](x) for x in meshed_support], lw=1.5,
                 label=fr"$\phi_{{i}}(x)$")
    plt.xlabel(r"$x$")
    plt.ylabel(r"$\phi_i(x)$")
    plt.xlim(x_min, x_max)
    plt.grid()
    box = ax.get_position()
    ax.set_position([box.x0, box.y0, box.width, box.height * 0.9])
    plt.legend(loc='upper center', bbox_to_anchor=(.5, 1.25), ncol=4)

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

   {% block methods %}
   .. automethod:: __init__
   {% endblock %}

.. minigallery:: {{module}}.{{objname}}
   :add-heading: Examples using the class