Berthold Höllmann's berhoelSplines module🔗
Description🔗
berhoel.splines.line-- Class for representing lines between two points.berhoel.splines.akima-- Cubic interpolation using Akima subsplines.-
Tbd
berhoel.splines.renner-- Cubic interpolation using Renner subsplines.
Installation🔗
pip install https://gitlab.com/berhoel/python/berhoelSplines.git
Availability🔗
The latest version should be available at my GitLab repository.
Documentation🔗
Documentation for the project is avaliable here.
Example with NACA foil data🔗
# mkdocs: render
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from berhoel.splines import AkimaSubspline
NACA0012 = Path("NACA0012")
data = []
with NACA0012.open("r") as inp:
for line in inp:
if not line.strip() or line.strip().startswith("#"):
continue
data.append([float(i) for i in line.strip().split()[:2]])
naca = AkimaSubspline(np.linspace(0, 1, len(data)), data)(np.linspace(0, 1, 4000))
fig, ax = plt.subplots(2, 1)
ax[0].plot(naca[:, 0], naca[:, 1])
ax[0].plot(np.array(data)[:, 0], np.array(data)[:, 1], "o-")
ax[0].set_aspect("equal", adjustable="box")
ax[1].plot(naca[:, 0], naca[:, 1])
ax[1].plot(np.array(data)[:, 0], np.array(data)[:, 1], "o-")
ax[1].set_xlim(-.0001, .004)
ax[1].set_ylim(-.01, .01)
fig.show()