How to build a complicated and long lookup table for use with Numpy
Interpolation?
The following extract is of a 500 row table that I'm trying to build a
numpy lookup function for. My problem is that the values are non-linear.
The user enters a density, volume, and content. so the function will be:
def capacity_lookup(density, volume, content:
For example a typical user entry would be capacity_lookup (47, 775, 41.3).
The function should interpolate between the values of 45 and 50 and
densities 700 and 800, and contents 40 and 45.
The table extract is:
Volume Density Content
<30 35 40 45 50>=
45.0 <=100 0.1 1.8 0.9 2.0 0.3
45.0 200 1.5 1.6 1.4 2.4 3.0
45.0 400 0.4 2.1 0.9 1.8 2.5
45.0 600 1.3 0.8 0.2 1.7 1.9
45.0 800 0.6 0.9 0.8 0.4 0.2
45.0 1000 0.3 0.8 0.5 0.3 1.0
45.0 1200 0.6 0.0 0.6 0.2 0.2
45.0 1400 0.6 0.4 0.3 0.7 0.1
45.0 >=1600 0.3 0.0 0.6 0.1 0.3
50.0 <=100 0.1 0.0 0.5 0.9 0.2
50.0 200 1.3 0.4 0.8 0.2 2.7
50.0 400 0.4 0.1 0.7 1.3 1.7
50.0 600 0.8 0.7 0.1 1.2 1.6
50.0 800 0.5 0.3 0.4 0.2 0.0
50.0 1000 0.2 0.4 0.4 0.2 0.3
50.0 1200 0.4 0.0 0.0 0.2 0.0
50.0 1400 0.0 0.3 0.1 0.5 0.1
50.0 >=1600 0.1 0.0 0.0 0.0 0.2
55.0 <=100 0.0 0.0 0.4 0.6 0.1
55.0 200 0.8 0.3 0.7 0.1 1.2
55.0 400 0.3 0.1 0.3 1.1 0.7
55.0 600 0.4 0.3 0.0 0.6 0.1
55.0 800 0.0 0.0 0.0 0.2 0.0
55.0 1000 0.2 0.1 0.2 0.1 0.3
55.0 1200 0.1 0.0 0.0 0.1 0.0
55.0 1400 0.0 0.2 0.0 0.2 0.1
55.0 >=1600 0.0 0.0 0.0 0.0 0.1
Question
How can I store the 500 row table so I can do interpolation on its non
linear data and get the correct value based on user input?
No comments:
Post a Comment