Note
Go to the end to download the full example code.
Quantile-based Knot Generator Example#
Generate knot locations based on quantiles of time points.
Inputs:
x: 0 to 1, length 100
dimension = 10
Generated knots:
[-1.00000000e-05 1.11111111e-01 2.22222222e-01 3.33333333e-01
4.44444444e-01 5.45454545e-01 6.56565657e-01 7.67676768e-01
8.78787879e-01 1.00001000e+00]
import numpy as np
from spheresmooth import knots_quantile
# Example input
x = np.linspace(0.0, 1.0, 100) # time points
dimension = 10 # number of knots
print("Inputs:")
print("x: 0 to 1, length 100")
print("dimension =", dimension)
# Generate knots
knots = knots_quantile(x, dimension)
print("\nGenerated knots:")
print(knots)
Total running time of the script: (0 minutes 0.001 seconds)