Lookup tables and spline fitting in Python