import numpy as np from scipy.interpolate import PchipInterpolator x = np.array([0.0, 10.0, 20.0, 30.0, 40.0]) y = np.array([0.2, 1.1, 1.8, 2.4, 2.7]) interpolator = PchipInterpolator(x, y, extrapolate=False) x_query = np.array([5.0, 15.0, 25.0, 35.0]) y_query = interpolator(x_query) print("Interpolated signal:") for xi, yi in zip(x_query, y_query): print(f"x={xi:4.1f} -> y={yi:.3f}") print() print("Known sample points match:", np.allclose(interpolator(x), y)) print("Out-of-range values:", interpolator(np.array([-5.0, 45.0])))