Package: fastcubicspline
fastcubicsplinea fast cubic spline interpolator for equally spaced values and complex dataWhy not using scipy's Cubic Spline?There are two reasons why fcSpline should be used instead
ofscipy.interpolate.CubicSpline.When called in a loop, fcSpline it 3 to 5 time faster than CubicSpline (seefcs_timing.py).Natively handles complex data.What are the drawbacks? Well, fcSpline works on equally spaced data only.
At the moment it supports 64-floats and 128-bit compex-values
(however, generalization should be trivial).ExamplefromfastcubicsplineimportFCS# set up x-limitsx_low=1x_high=5# set up the y-data, here complex valuesy_data=[9+9j,4+4j,0,6+6j,2+2j]# class initfcs=FCS(x_low,x_high,y_data)# simply call the FCS-object like a regular function# to get interpolated valuesprint(fcs(2.5))# (0.921875+0.921875j)For convenience, this package also provides a polynomial interpolator.
Note that the NPointPoly class is not intended for time crucial applications.fromfastcubicsplineimportNPointPoly# the x and y valuesx=[1,2,4,5,8]y=[9+9j,4+4j,0,6+6j,2+2j]npp=NPointPoly(x,y)# call the NPointPoly-object to get interpolated value at any xprint(npp(2.5))(see alsoexamples/examples.py)DocumentationThere is not much of an API, so there is no extra documentation page.
Everything is, however, documented by means of function annotations and doc-strings
within the code and should be visible when developing in a modern IDE.Installfastcubicsplineis on PyPi. So you can simply install the latest release withpip install fastcubicsplineFrom SourceFetch the latest version (or check any previous stage)
by cloning fromhttps://github.com/cimatosa/fcSpline.pipMake surepipis installed.
Change into the fcSpline package directory and run:python -m pip install .See the option--userif you don't have the appropriate permission
for an installation to the standard location.poetryChange into the fcSpline package directory.
Installfastcubicsplineand its dependencies into a virtual environment withpoetry installand spawn a shell using that environmentpoetry shell.
Now you can check if the tests pass withpytest.poetry installshould build the cython extension which you cen check withpytest -v -k cython.In case of poetry errors, you might want to get the latest poetry version
withpoetry self update.Manually Build Cython ExtensionSome distutils magic is contained inbuild_ext.pyso you can simply callpython3 build_ext.pyto build the Cython extension inplace.
Runpytest -v -k cythonto verify that the Cython extension is available.Clean the build files by callingpython3 build_ext.py cleanTestingRun and list all tests withpytest -vReferences* Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P., 2007.
  Numerical Recipes 3rd Edition: The Art of Scientific Computing,
  Auflage: 3. ed. Cambridge University Press, Cambridge, UK; New York.

* Wikipedia, Retrieved September 1, 2023, from 
  https://en.wikipedia.org/wiki/Finite_difference_coefficient#Forward_finite_differenceMIT licenceCopyright (c) 2023 Richard HartmannPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.