N-dimensional interpolation/extrapolation methods
Project description
interpn
Python bindings to the interpn
Rust library for N-dimensional interpolation and extrapolation.
Docs | Repo | Rust Library (github) | Rust Docs (docs.rs)
Features
Feature → ↓ Interpolant Method |
Regular Grid |
Rectilinear Grid |
Json Serialization |
---|---|---|---|
Linear | ✅ | ✅ | ✅ |
Cubic | ✅ | 💡 | ✅ |
The methods provided here, while more limited in scope than scipy's, are
- significantly faster for higher dimensions (1-3 orders of magnitude under most conditions)
- use almost no RAM (and perform no heap allocations at all)
- produce significantly improved floating-point error (by 1-2 orders of magnitude)
- are json-serializable using Pydantic
- can also be used easily in web and embedded applications via the Rust library
See here for more info about quality-of-fit, throughput, and memory usage.
Example: Multilinear Interpolation on a Regular Grid
import interpn
import numpy as np
# Build grid
x = np.linspace(0.0, 10.0, 5)
y = np.linspace(20.0, 30.0, 3)
xgrid, ygrid = np.meshgrid(x, y, indexing="ij")
zgrid = (xgrid + 2.0 * ygrid) # Values at grid points
# Grid inputs for true regular grid
dims = [x.size, y.size]
starts = np.array([x[0], y[0]])
steps = np.array([x[1] - x[0], y[1] - y[0]])
# Observation points pointed back at the grid
obs = [xgrid.flatten(), ygrid.flatten()]
# Initialize
interpolator = interpn.MultilinearRegular.new(
dims, starts, steps, zgrid.flatten()
)
# Interpolate
out = interpolator.eval(obs)
# Check result
assert np.all(out == zgrid.flatten())
# Serialize and deserialize
roundtrip_interpolator = interpn.MultilinearRegular.model_validate_json(
interpolator.model_dump_json()
)
out2 = roundtrip_interpolator.eval(obs)
# Check result from roundtrip serialized/deserialized interpolator
assert np.all(out == out2)
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
interpn-0.2.0.tar.gz
(164.2 kB
view hashes)
Built Distributions
interpn-0.2.0-cp311-none-win32.whl
(147.6 kB
view hashes)
interpn-0.2.0-cp310-none-win32.whl
(147.6 kB
view hashes)
interpn-0.2.0-cp39-none-win_amd64.whl
(160.9 kB
view hashes)
interpn-0.2.0-cp39-none-win32.whl
(147.6 kB
view hashes)
Close
Hashes for interpn-0.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 053cfdb2327001dd59898e63ad3d79b46b4797f8f7eb5999dcc1912b6bf7a89d |
|
MD5 | a9def46a91f5440c538917f3c92e5ab4 |
|
BLAKE2b-256 | 9e441db09fb3206ba71a7315e00d2e0beb4c7213eda8acd58f63d5f2c12944ea |
Close
Hashes for interpn-0.2.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9303b50d3b74c646d46b6653396093a8c6f974205b9b9669db82fb8bf92d8c97 |
|
MD5 | 80691af36b2d362a9ad740b6898c28cd |
|
BLAKE2b-256 | 554f25f5b36b6e5115582b9fa5db3d365c1d5b9c4bd9a2004dec7353d22ae196 |
Close
Hashes for interpn-0.2.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32d4a1f77c15036cab8e1c2faaad52c43f68358876912975cb561006c5423f7d |
|
MD5 | a854d74825d53a9a96608c2a78e35626 |
|
BLAKE2b-256 | 7d76a1151eddd54985d56bc49a85317143a185502ba6a0ff7d0ef61e742e005b |
Close
Hashes for interpn-0.2.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fac7b47c0135836f224f7590b272771a8697bdd90037c7f297a2b563a4c412c9 |
|
MD5 | f5c205ce110a3f054e7e39a74a1830d7 |
|
BLAKE2b-256 | 2cfc7f63583404d0a15d100ab86b3720805b53bb37733544bf13896ab9cdc14e |
Close
Hashes for interpn-0.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1cf26d1d0552951b400ca544c64dff973bbccc1239f57608444694b08f9db55 |
|
MD5 | ac720a9f66947b87651470ff89d9b44d |
|
BLAKE2b-256 | f2178dea7f9c4f8aab994d40a2cd588c8c9adeb5eb1988d6e3e4160e4c93c22b |
Close
Hashes for interpn-0.2.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ceda7dafad813b2be2f647c588f45e6bbb641e98151da84845ec73f130d448e |
|
MD5 | a7cfbeda6f6e35ba24f99aa94a1d83a9 |
|
BLAKE2b-256 | 78cdd5c137acc704ab5bd12a931b02f5a8c13b6c75eed60af879e088b8329434 |
Close
Hashes for interpn-0.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b17af2847f8b52080a67f06c75c677ecdd15d31cbb78a19974d1fbf339519698 |
|
MD5 | 75189e31512ffd89aa7b09e01e0602b2 |
|
BLAKE2b-256 | 780f6f271e3cf0cd4c152e294d074b8aada8fbf5ebbcf2e44d6cb56637f4b89c |
Close
Hashes for interpn-0.2.0-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41a1fe247c95aa4427c8a5391407c8e0a00bede250979be1aacd99ad6384be46 |
|
MD5 | 31c07933fec8f46dc1cd5cc60f7014e9 |
|
BLAKE2b-256 | 8f6060e5ccb116bc8080d72a1551f4bdfa11a3853e459bc2ab6e5d8326bc3d36 |
Close
Hashes for interpn-0.2.0-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0353ac55e6dda345ed209b3c691cf02d823c8e64c3688db6679eba56d0a646f |
|
MD5 | c756ff125004d2adaf5c151ed69c3c4d |
|
BLAKE2b-256 | 076f45deeea4ce5ead29df9e57fba85a857bb0bc6f4f56c3dae0ee31b568a0d2 |
Close
Hashes for interpn-0.2.0-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d0b18ae9d22daf93cb51bbc1888a13914a3d3dca58ae22da597b1cff1146e1e |
|
MD5 | 7602938eaf86e2de8c0c308d9e3e3c0b |
|
BLAKE2b-256 | be94028872b164e4b673f75a14fd17d0031a6974ba4ef227f24a9e5ded3e8fb1 |
Close
Hashes for interpn-0.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 231f3da60e623a7dcb6d21651ad7bc925219fe6c52a3aa2a405bd5898bbabcb6 |
|
MD5 | c8e4ece99b5ada5c745ad287dfe491c8 |
|
BLAKE2b-256 | 3871db02fe9e47a2b09c136fbdb6432171e4586818bce0f4442bdb8533fb87b5 |
Close
Hashes for interpn-0.2.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff50bceb9198fd42871a84c79a88497942f93a4e03cde202764d7cd457ba4caf |
|
MD5 | d4c9be2736e8236ece890fe1b6b22f88 |
|
BLAKE2b-256 | 1a1404f2d94d2dd83a96662780d29bfc98ffe97a5f9c45405564d155a3c3abdc |
Close
Hashes for interpn-0.2.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea0031b2c322ba4bfb4d1b33891ab953d6ece3e5243ad9179936b98dc4285eac |
|
MD5 | 61ec9d391798d722c304fc8f3e70812e |
|
BLAKE2b-256 | 3951cdcab5117c7a51d8e66b365e0772652bd239554cedebb18ef10b8ea6a4ac |
Close
Hashes for interpn-0.2.0-cp311-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dbe9750c26c985d2ce20f8cd9a1f25a0967c705e67304ed9da6c373bbf326d1 |
|
MD5 | 0f93ca962e2c81eb9b94d60a336d90f6 |
|
BLAKE2b-256 | 222b8d8d79e802dadcad952271a06e34793154a22e3c2e7717fe8ce38796a8f9 |
Close
Hashes for interpn-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66b5d4fd6557b7a62a57f7fa7d74771db6fe26746c3305cba31977fa69676015 |
|
MD5 | c5edbc9cc650838936f595490c353347 |
|
BLAKE2b-256 | ed3710215229c68f638bb2d7c28f3f81c8e486971b760dfba730445722866e50 |
Close
Hashes for interpn-0.2.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c9fa6a3888641de6d3ae30da7db6d23af4a9a0928a47514e42807d4534f4150 |
|
MD5 | 7614929dab7b418a9cf71ec3a0e580ae |
|
BLAKE2b-256 | 1ccf0b211dcc0c4d6851f7d070bafa7dab70f53173e81375a9175c9817bd583d |
Close
Hashes for interpn-0.2.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 521a24987bff29ac3a22342340a9b795c9d0290945ea2605cdb81243b0bd00f8 |
|
MD5 | 2fbabcc67186fe4642ea68039233e12e |
|
BLAKE2b-256 | c544ff61de7763610c3b33074ba7c4c9524fae05b00c869291ca87db6eb42227 |
Close
Hashes for interpn-0.2.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3862e99b95699b2296a8a82ce05b504508dc3df12d1b63650cb1de9a059b9332 |
|
MD5 | 28302456a5e03674f0c5de391f951b2b |
|
BLAKE2b-256 | b8fe8acabfb96947a9c63ee0437f91d4b7bd46974545c271e34767d3703cddb7 |
Close
Hashes for interpn-0.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1e83668f3d83e13d8658500ca6cd9533df0805a11371feed7c655b7fd8818db |
|
MD5 | d50daaee398d0c25c955012dfd8f8068 |
|
BLAKE2b-256 | 543ed28f46260c59fd27b7101235dffd61d0e8b49f95615b2d67170fcb0f618f |
Close
Hashes for interpn-0.2.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dba594874cac45d98a5ff6fb3393db3da6249c3debe617e33660fd83642fe55 |
|
MD5 | 5e96b8e0e5daea7b80f048576fb61564 |
|
BLAKE2b-256 | 71fd799db8249377f41e0557ce03d41fdcaccdc08cb30f2d66234d4b0f517fd9 |
Close
Hashes for interpn-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fddf7abbe2cca90edc9fc682ece825e710112a0878bf701936302a1e3bfdf939 |
|
MD5 | e16645b1e4a217c1fa49573c197c72e5 |
|
BLAKE2b-256 | 58750b10c944d416d8597d63474de55a28dbbfcba54e6c5994f53fda14b83528 |
Close
Hashes for interpn-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18aa722302d541e882398ad3ad79451b55603f7dd427a41668898bfb88be5fbe |
|
MD5 | 98b64c65f342f42e6e25cc92ed216c28 |
|
BLAKE2b-256 | 91289da25539b6bb2fb04128c2bf571206cbd26e77fd6f8054fce6f971a28711 |
Close
Hashes for interpn-0.2.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6241acb87dbf8b79487e13c3c427ba0947daf3d837572a599c4748e1725190f3 |
|
MD5 | 65e5b3c8ace5a632c4753cf7251b39a3 |
|
BLAKE2b-256 | 8bdaf651f664c62ea41076215605b18d075a8b0b4d36c6eb70c5d89086b498f7 |
Close
Hashes for interpn-0.2.0-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da5588a8f5b01969ffb09c72d7fdd3767923738ff6b34f4b9bffee49a79ceab9 |
|
MD5 | 2adeacc2f5a2fdc2b97d735ce996e8bf |
|
BLAKE2b-256 | b40af8cdb8803eda8b1dc8e172077394f4e1549edb86328d832bc0f262a69a34 |
Close
Hashes for interpn-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fb9767046372a5981dacf4131034ef532f3bc047e298e9d7c10e76eb3628adb |
|
MD5 | 08241b993f6980b23c7ac3d4e4f40cc0 |
|
BLAKE2b-256 | 5b1dff5843eee0dfd704c6e8cb930fa2564076dd0f03c478f15e50780b4363b0 |
Close
Hashes for interpn-0.2.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9347ee8c6ddcdca8d81fe9483bbe11808c85d86239d96b44e759dd3e0ad441f2 |
|
MD5 | 781987787757c3e261033029b77828b2 |
|
BLAKE2b-256 | 0b7ab1ddfa9bc8c7610d62adb6ab2df4a1baf36a79f10ca5f2ea0548d51112ca |
Close
Hashes for interpn-0.2.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17582f6d34f6526909ad82cac32ca28d9f7fb4cb89527481110515374e3f8053 |
|
MD5 | 12cc28cee0a072e561c328be18b4d052 |
|
BLAKE2b-256 | 2dcd6efbc30db84f5ddbbeaa0b280020809b1c4a6f2252d8b15117f8afad9d41 |
Close
Hashes for interpn-0.2.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5ca3c2cb9cb2b246c6484247c3b0973983374b82e31dca3c0db0c791a759333 |
|
MD5 | fa4bf6e454480411bd293044b0fd7657 |
|
BLAKE2b-256 | 406c6166139687a01f35fcbba780ebc2b96d85ae1c9131703ed36eb79abb1b33 |
Close
Hashes for interpn-0.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fa536c45447203be994f330c3590335d077bd611662dbe32659009876653282 |
|
MD5 | 43e244ca93fd1a44222b5bb6c70e98f3 |
|
BLAKE2b-256 | 62b991de9ce97e7c1147ee1e07909709e7e1eaeba951d27c1ddaa541bf53fb6a |
Close
Hashes for interpn-0.2.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a722d066a220efbe8282cdc6b6e1e1ed75d625f03471845ffbf19ebf369e7e54 |
|
MD5 | eb49ed15743c463c0e3c5c2d1f46b0df |
|
BLAKE2b-256 | 4a0e3f9767ac9fadff9837907d81c21bee1cdaae08a18bf312a3663e7268955f |
Close
Hashes for interpn-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c05a6e922be236f86a1872c2ad041e11f39d498f26e5abec5a000b4f04eabce8 |
|
MD5 | eab11aa9e87989d0223279a9f5259548 |
|
BLAKE2b-256 | 9c26e3d10c2828dc8cceb46a71422e9c95bdc2f55f015f11eb083e3ddb916f16 |
Close
Hashes for interpn-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad687b80a93ee6358c8bebb4b0c669c595e1b8aa4358932a45cba2030c19f849 |
|
MD5 | 06d464fdcfb9588daee8a9816c1c72c6 |
|
BLAKE2b-256 | 33c00384a03ca7299e585954a104142713d0f15154fc3a4b92d95d4efcc36107 |
Close
Hashes for interpn-0.2.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40650c407589e33398840b05902d8b562bcf17eaec11079661fa3880035721b7 |
|
MD5 | c3eca8ceb4e3bc11b8443d22dbb3e135 |
|
BLAKE2b-256 | 6997cb485e6bcda4c7dede999624133e6e0c560f7a58f3a6dec8f00f495dfab9 |
Close
Hashes for interpn-0.2.0-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79ed7969b4177429d74b79bea5ae61707ab084fa11ea842a5b05e31b0c9c243a |
|
MD5 | fe152bfa9bbb28a599d0de1951a53a03 |
|
BLAKE2b-256 | 5c1c288f4d99a8c8b3a24438877c7c631f94b23db8129a7d093904d1158078ef |
Close
Hashes for interpn-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 821b735d971d34457cd56f75011ffa64d5cf6223e9e76353b8df942c2ad952bd |
|
MD5 | a912d8a88f1368f59d9caed63080a683 |
|
BLAKE2b-256 | 1a09f9368cb9903af28a628cc350d1f0dbf1968011e0d36a83be08a06aac7653 |
Close
Hashes for interpn-0.2.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc6db6fa2220bbee6010e04f489ff738e829c73e5a71245d88095c94bc91a24b |
|
MD5 | 4d49dd447fe5ab5cd3d3bc7f6a3fe3ea |
|
BLAKE2b-256 | 7cca203f82f527e8e08f0464e3010dc9c388f31ecfcba99b21c50f30975c7935 |
Close
Hashes for interpn-0.2.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc3e022d324649289a88e8c7c4dae6dda9ecc2f2d4104be47e41acde79457717 |
|
MD5 | e76bab92b70cad00f485a7e85a59dab1 |
|
BLAKE2b-256 | 6e8d2bb818968e18403e92d7011797c110b53c7c70eb3c98f138008bda93c63f |
Close
Hashes for interpn-0.2.0-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e584035dfbc13c16d81ea5d739c9d1eb2afcc89ff055d0321b2bcf2faeaf35ab |
|
MD5 | 3f28c5e2aff52b4dc375c73af8130141 |
|
BLAKE2b-256 | 87fd7ac0a94c571d098bae92431649a1a60ae935ef92b51bca0f898ff2ed4b71 |
Close
Hashes for interpn-0.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4be08be94d21980d86afbfda856648fb9b16f6166cd823de061a60a8d1279e90 |
|
MD5 | 6ef66f1cf118333f1f89dda740e3e7e6 |
|
BLAKE2b-256 | 9b2b28c08547716eeb172b13cd158674c1b57c40ffca179404718658eb6f8029 |
Close
Hashes for interpn-0.2.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1381745ebe1c8c3787568866b243486cd91a33e0d37702dd6b27f04f3d965479 |
|
MD5 | f47ed3ae63d2a9e0eb6fa711acaa9a3e |
|
BLAKE2b-256 | e9ba94f47aafd394f9a42557c9621c57bf82e57d709c3186d380255c2ee9d471 |
Close
Hashes for interpn-0.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e884579e620338d2e99e086b8cc863395c41e7b63ba49e247961f198723e2f83 |
|
MD5 | 00220dd45ea8b896fcdd0f54ef7ab787 |
|
BLAKE2b-256 | c129ee267431df299b672765ef0f5fca4e085bcc4874136a1d7eaac9d2a787f7 |
Close
Hashes for interpn-0.2.0-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb8446498a7122b9d3a1119c42361136e6d25239bc8f7ebe088b75a54f593675 |
|
MD5 | a767bef1eaa7c21ec7359c7516f69ffa |
|
BLAKE2b-256 | b250da77c29965775b5deed370b57ed42662136a5181f9b950bd64848734339e |