Package: sinterp
sinterpSimple fast linear interpolation for Pythonsinterpfunctions:interp1d(x:float,xp:list,yp:list,make_checks:bool=CHECK_INPUT)x - x-variable for interpolation, floatxp - list with x-values of function, listyp - list with y-values of function, listmake_checks - bool-flag of enable/disable for check inputs. Default value is True.interp2d(x:float,y:float,xp:list,yp:list,zp:list,make_checks:bool=CHECK_INPUT)x, y - x- and y-variable for interpolation, floatxp - list with x-values of function, listyp - list with y-values of function, listzp - list with y-values of function, listmake_checks - bool-flag of enable/disable for check inputs. Default value is True.BenchmarksSimple benchmark for compare 1d-interpolation with Numpy:importrandomimporttimefromnumpyimportinterpfromsinterpimportinterp1dtimes=[]# list with time of calculationratios=[]# ratio of calc with interp to interp1ddeltas=[]# summary delta of difference results by iterationsize=[]forkkinrange(2,5):x1=0x2=int(10**kk)size.append(x2)xp=[float(_)for_inrange(x1,x2+1)]yp=[_**3.0for_inxp]x=[random.uniform(float(x1),float(x2))for_inrange(10000)]start_time=time.time()v_1=[interp(_,xp,yp)for_inx]time_1=time.time()-start_timestart_time=time.time()v_2=[interp1d(_,xp,yp)for_inx]time_2=time.time()-start_timetimes.append([time_1,time_2])ratios.append(time_1/time_2)deltas.append(sum(_[1]-_[0]for_inzip(v_1,v_2)))# Print benchmark ratiosprint('--- Benchmark results ---')print('List size : Ratio')forr,vinzip(size,ratios):print('%i:%f'%(r,v))print('Check convergence. Difference between interp and interp1d =%f'%max(deltas))Results Python 3.6 Win10 (at my laptop):--- Benchmark results ---
List size : Ratio
    10 : 2.312361
    100 : 1.810310
    1000 : 7.835562
    10000 : 54.542985
    100000 : 514.559448
Check convergence. Delta between interp and interp1d = 0.000000Results Python 3.7 Linux-Mint 19.3--- Benchmark results ---
List size : Ratio
    10 : 2.409009
    100 : 3.836711
    1000 : 19.986599
    10000 : 141.633523
    100000 : 1155.362543
Check convergence. Delta between interp and interp1d = 0.000000Simple benchmark for compare interp2d from SciPy with sinterpimportrandomimporttimefromnumpyimportmeshgrid,arrayfromscipy.interpolateimportinterp2dassc_interp2dfromsinterpimportinterp2dassi_interp2dtimes=[]# list with time of calculationratios=[]# ratio of calc with interp to interp1ddeltas=[]# summary delta of difference results by iterationsize=[]forkkinrange(2,5):x1=0x2=int(10**kk)size.append(x2)xp=[float(_)for_inrange(0,x2+1)]yp=[float(_)for_inrange(0,x2+1)]zp=[[x*yforyinyp]forxinxp]XP_GRID,YP_GRID=meshgrid(xp,yp)ZP_GRID=array(zp)xv=[random.uniform(0.0,x2)for_inrange(1000)]yv=[random.uniform(0.0,x2)for_inrange(1000)]start_time=time.time()sci_interp2d=sc_interp2d(xp,yp,zp)v_1=[sci_interp2d(x,y)forx,yinzip(xv,yv)]time_1=time.time()-start_timestart_time=time.time()v_2=[si_interp2d(x,y,xp,yp,zp)forx,yinzip(xv,yv)]time_2=time.time()-start_timetimes.append([time_1,time_2])ratios.append(time_1/time_2)deltas.append(sum(_[1]-_[0]for_inzip(v_1,v_2)))# Print benchmark ratiosprint('--- Benchmark results ---')print('List size : Ratio')forr,vinzip(size,ratios):print('%i:%f'%(r,v))print('Check convergence. Difference between interp2d (scipy) and interp2d (sinterp) =%f'%max(deltas))