Skip to content

A python package containing classes for (linear and bilinear) interpolation

License

Notifications You must be signed in to change notification settings

pmav99/interpolation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interpolation

A python package containing classes for (linear and bilinear) interpolation

The API is optimized for reusing the same table many times.

If the x or y values are outside the indexes and extrapolate is True, then a linear extrapolation will be performed using the edge segment. If it is false, then a ValueError will be raised.

Examples

Linear

from interpolation import LinearInterpolation

table = LinearInterpolation(
    x_index=(1, 2, 3),
    values=(10, 20, 30),
    extrapolate=False)

assert table(1.5) == 15
assert table(2.5) == 25

Bilinear

from interpolation import BilinearInterpolation

table = BilinearInterpolation(
    x_index=(1, 2, 3),
    y_index=(1, 2, 3),
    values=((110, 120, 130),
            (210, 220, 230),
            (310, 320, 330)),
    extrapolate=True)

assert table(1, 1) == 110
assert table(2.5, 2.5) == 275

About

A python package containing classes for (linear and bilinear) interpolation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages