Create a TGraphSmooth and show the usage of the interpolation function Approx.
See the TGraphSmooth documentation
from ctypes import c_double
import numpy as np
import ROOT
n = 11
x =
np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 6.0, 8.0, 9.0, 10.0])
y =
np.array([1.0, 4.0, 9.0, 16.0, 25.0, 25.0, 36.0, 49.0, 64.0, 81.0, 100.0])
nout = 14
xout =
np.array([1.2, 1.7, 2.5, 3.2, 4.4, 5.2, 5.7, 6.5, 7.6, 8.3, 9.7, 10.4, 11.3, 13])
DrawSmooth(1,
"Approx: ties = mean",
"X-axis",
"Y-axis")
grout =
gs.Approx(grin,
"linear", 14, xout, 0, 130)
print(f"k= {k} vXout[k]= {vXout.value} vYout[k]= {vYout.value}")
grout =
gs.Approx(grin,
"constant", 50, 0, 0, 0, 1, 0.5,
"min")
grout =
gs.Approx(grin,
"linear", 14, xout, 0, 0, 2, 0,
"max")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
- Author
- Christian Stratowa, Jamie Gooding
Definition in file gr010_approx_smooth.py.