Skip to content

Instantly share code, notes, and snippets.

@kmuehlbauer
Created October 16, 2022 06:58
Show Gist options
  • Save kmuehlbauer/bf3d2d16c7a3fc592b4c8fd8d33d7416 to your computer and use it in GitHub Desktop.
Save kmuehlbauer/bf3d2d16c7a3fc592b4c8fd8d33d7416 to your computer and use it in GitHub Desktop.
scipy RegularGridInterpolator current main
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9fd25b3f-ba2b-41a4-b015-15ad2e9532b5",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from scipy.interpolate import RegularGridInterpolator\n",
"import cProfile\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "45344f99-62dd-4952-a63d-e865142fc6b5",
"metadata": {},
"outputs": [],
"source": [
"def create_test_data(descending=False):\n",
" # create points, values, xi\n",
" \n",
" if descending:\n",
" ll = (12, 55)\n",
" ur = (2, 45)\n",
" else:\n",
" ll = (2, 45)\n",
" ur = (12, 55)\n",
"\n",
" x = np.linspace(ll[0], ur[0], 1001)\n",
" y = np.linspace(ll[1], ur[1], 501)\n",
" X, Y = np.meshgrid(x, y)\n",
"\n",
" # points\n",
" grid = np.stack((X, Y), axis=-1)\n",
" grd_dim0 = np.take(grid[..., 0], 0, axis=0)\n",
" grd_dim1 = np.take(grid[..., 1], 0, axis=1)\n",
" points = grd_dim0, grd_dim1\n",
"\n",
" # values\n",
" values = (X + Y).T\n",
"\n",
" # xi\n",
" np.random.seed(42)\n",
" xt = np.random.uniform(ll[0], ur[0], 10000)\n",
" yt = np.random.uniform(ll[1], ur[1], 10000)\n",
" xi = np.stack((xt, yt), axis=-1)\n",
" \n",
" return points, values, xi"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4ba9d082-94ad-40f2-9612-085359bb1a0c",
"metadata": {},
"outputs": [],
"source": [
"# test function\n",
"def test_ipol_xi(points, values, xi, iterations=1):\n",
" \"\"\"Simulate evaluation of values, hence effectively re-creating the interpolator.\n",
" \"\"\"\n",
" for i in range(iterations):\n",
" interp = RegularGridInterpolator(points, values, method=\"linear\",\n",
" bounds_error=False,\n",
" fill_value=np.nan)\n",
" valip = interp(xi)"
]
},
{
"cell_type": "markdown",
"id": "df2f8c5a-f83a-4827-b761-f5bce071b3c7",
"metadata": {},
"source": [
"# Normal Test, one iteration"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ec8a50cb-c228-4255-a2b5-6027298ebcd6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 142 function calls in 0.005 seconds\n",
"\n",
" Ordered by: standard name\n",
"\n",
" ncalls tottime percall cumtime percall filename:lineno(function)\n",
" 1 0.000 0.000 0.005 0.005 4049209860.py:2(test_ipol_xi)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(all)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(any)\n",
" 1 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(can_cast)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(diff)\n",
" 2 0.000 0.000 0.002 0.001 <__array_function__ internals>:177(searchsorted)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(where)\n",
" 1 0.000 0.000 0.005 0.005 <string>:1(<module>)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:212(__init__)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:259(<listcomp>)\n",
" 1 0.000 0.000 0.005 0.005 _rgi.py:262(__call__)\n",
" 1 0.001 0.001 0.002 0.002 _rgi.py:358(_evaluate_linear)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:363(<listcomp>)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:364(<listcomp>)\n",
" 1 0.001 0.001 0.003 0.003 _rgi.py:469(_find_indices)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:490(_find_out_of_bounds)\n",
" 4 0.000 0.000 0.000 0.000 _ufunc_config.py:131(geterr)\n",
" 4 0.000 0.000 0.000 0.000 _ufunc_config.py:32(seterr)\n",
" 2 0.000 0.000 0.000 0.000 _ufunc_config.py:425(__init__)\n",
" 2 0.000 0.000 0.000 0.000 _ufunc_config.py:429(__enter__)\n",
" 2 0.000 0.000 0.000 0.000 _ufunc_config.py:434(__exit__)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:1315(_searchsorted_dispatcher)\n",
" 2 0.000 0.000 0.002 0.001 fromnumeric.py:1319(searchsorted)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:2302(_any_dispatcher)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:2307(any)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:2401(_all_dispatcher)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:2406(all)\n",
" 2 0.000 0.000 0.002 0.001 fromnumeric.py:51(_wrapfunc)\n",
" 4 0.000 0.000 0.000 0.000 fromnumeric.py:69(_wrapreduction)\n",
" 4 0.000 0.000 0.000 0.000 fromnumeric.py:70(<dictcomp>)\n",
" 2 0.000 0.000 0.000 0.000 function_base.py:1315(_diff_dispatcher)\n",
" 2 0.000 0.000 0.000 0.000 function_base.py:1319(diff)\n",
" 2 0.000 0.000 0.000 0.000 multiarray.py:341(where)\n",
" 1 0.000 0.000 0.000 0.000 multiarray.py:498(can_cast)\n",
" 2 0.000 0.000 0.000 0.000 numerictypes.py:282(issubclass_)\n",
" 1 0.000 0.000 0.000 0.000 numerictypes.py:356(issubdtype)\n",
" 1 0.000 0.000 0.005 0.005 {built-in method builtins.exec}\n",
" 2 0.000 0.000 0.000 0.000 {built-in method builtins.getattr}\n",
" 4 0.000 0.000 0.000 0.000 {built-in method builtins.hasattr}\n",
" 3 0.000 0.000 0.000 0.000 {built-in method builtins.issubclass}\n",
" 8 0.000 0.000 0.000 0.000 {built-in method builtins.len}\n",
" 2 0.000 0.000 0.000 0.000 {built-in method numpy.asanyarray}\n",
" 9 0.000 0.000 0.000 0.000 {built-in method numpy.asarray}\n",
" 11 0.000 0.000 0.003 0.000 {built-in method numpy.core._multiarray_umath.implement_array_function}\n",
" 2 0.000 0.000 0.000 0.000 {built-in method numpy.core._multiarray_umath.normalize_axis_index}\n",
" 8 0.000 0.000 0.000 0.000 {built-in method numpy.geterrobj}\n",
" 4 0.000 0.000 0.000 0.000 {built-in method numpy.seterrobj}\n",
" 1 0.000 0.000 0.000 0.000 {built-in method numpy.zeros}\n",
" 1 0.000 0.000 0.000 0.000 {built-in method scipy.interpolate.interpnd._ndim_coords_from_arrays}\n",
" 6 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}\n",
" 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}\n",
" 4 0.000 0.000 0.000 0.000 {method 'items' of 'dict' objects}\n",
" 4 0.000 0.000 0.000 0.000 {method 'reduce' of 'numpy.ufunc' objects}\n",
" 2 0.000 0.000 0.000 0.000 {method 'reshape' of 'numpy.ndarray' objects}\n",
" 2 0.002 0.001 0.002 0.001 {method 'searchsorted' of 'numpy.ndarray' objects}\n",
"\n",
"\n"
]
}
],
"source": [
"points, values, xi = create_test_data()\n",
"cProfile.run('test_ipol_xi(points, values, xi, 1)')"
]
},
{
"cell_type": "markdown",
"id": "dc45be5a-24c6-4779-819f-0a2ea70f4c64",
"metadata": {},
"source": [
"# Descending dimensions, one iteration"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f652ab2a-0d08-4c8b-b4c6-2ef3ac572bcf",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 442 function calls (434 primitive calls) in 1.700 seconds\n",
"\n",
" Ordered by: standard name\n",
"\n",
" ncalls tottime percall cumtime percall filename:lineno(function)\n",
" 1 0.000 0.000 1.700 1.700 4049209860.py:2(test_ipol_xi)\n",
" 4 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(all)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(any)\n",
" 4 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(argsort)\n",
" 4 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(broadcast_arrays)\n",
" 1 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(can_cast)\n",
" 2 0.000 0.000 0.001 0.001 <__array_function__ internals>:177(copyto)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(diff)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(empty_like)\n",
" 4 0.000 0.000 0.004 0.001 <__array_function__ internals>:177(meshgrid)\n",
" 2 0.000 0.000 0.001 0.001 <__array_function__ internals>:177(searchsorted)\n",
" 2 0.000 0.000 0.000 0.000 <__array_function__ internals>:177(where)\n",
" 2 0.000 0.000 0.001 0.001 <__array_function__ internals>:177(zeros_like)\n",
" 1 0.000 0.000 1.700 1.700 <string>:1(<module>)\n",
" 2 1.676 0.838 1.697 0.848 _rgi.py:13(_make_points_and_values_ascending)\n",
" 6 0.000 0.000 0.000 0.000 _rgi.py:15(<genexpr>)\n",
" 6 0.000 0.000 0.000 0.000 _rgi.py:16(<genexpr>)\n",
" 6 0.000 0.000 0.000 0.000 _rgi.py:21(<genexpr>)\n",
" 1 0.000 0.000 1.697 1.697 _rgi.py:212(__init__)\n",
" 2 0.000 0.000 0.003 0.001 _rgi.py:23(<listcomp>)\n",
" 2 0.000 0.000 0.004 0.002 _rgi.py:25(<listcomp>)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:259(<listcomp>)\n",
" 1 0.000 0.000 0.002 0.002 _rgi.py:262(__call__)\n",
" 1 0.001 0.001 0.001 0.001 _rgi.py:358(_evaluate_linear)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:363(<listcomp>)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:364(<listcomp>)\n",
" 1 0.000 0.000 0.001 0.001 _rgi.py:469(_find_indices)\n",
" 1 0.000 0.000 0.000 0.000 _rgi.py:490(_find_out_of_bounds)\n",
" 4 0.000 0.000 0.000 0.000 _ufunc_config.py:131(geterr)\n",
" 4 0.000 0.000 0.000 0.000 _ufunc_config.py:32(seterr)\n",
" 2 0.000 0.000 0.000 0.000 _ufunc_config.py:425(__init__)\n",
" 2 0.000 0.000 0.000 0.000 _ufunc_config.py:429(__enter__)\n",
" 2 0.000 0.000 0.000 0.000 _ufunc_config.py:434(__exit__)\n",
" 4 0.000 0.000 0.000 0.000 fromnumeric.py:1008(_argsort_dispatcher)\n",
" 4 0.000 0.000 0.000 0.000 fromnumeric.py:1012(argsort)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:1315(_searchsorted_dispatcher)\n",
" 2 0.000 0.000 0.001 0.001 fromnumeric.py:1319(searchsorted)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:2302(_any_dispatcher)\n",
" 2 0.000 0.000 0.000 0.000 fromnumeric.py:2307(any)\n",
" 4 0.000 0.000 0.000 0.000 fromnumeric.py:2401(_all_dispatcher)\n",
" 4 0.000 0.000 0.000 0.000 fromnumeric.py:2406(all)\n",
" 6 0.000 0.000 0.001 0.000 fromnumeric.py:51(_wrapfunc)\n",
" 6 0.000 0.000 0.000 0.000 fromnumeric.py:69(_wrapreduction)\n",
" 6 0.000 0.000 0.000 0.000 fromnumeric.py:70(<dictcomp>)\n",
" 2 0.000 0.000 0.000 0.000 function_base.py:1315(_diff_dispatcher)\n",
" 2 0.000 0.000 0.000 0.000 function_base.py:1319(diff)\n",
" 8 0.000 0.000 0.000 0.000 function_base.py:346(iterable)\n",
" 4 0.000 0.000 0.000 0.000 function_base.py:4841(_meshgrid_dispatcher)\n",
" 4 0.000 0.000 0.004 0.001 function_base.py:4846(meshgrid)\n",
" 4 0.000 0.000 0.000 0.000 function_base.py:4977(<listcomp>)\n",
" 4 0.000 0.000 0.003 0.001 function_base.py:4990(<listcomp>)\n",
" 2 0.000 0.000 0.000 0.000 multiarray.py:1071(copyto)\n",
" 2 0.000 0.000 0.000 0.000 multiarray.py:341(where)\n",
" 1 0.000 0.000 0.000 0.000 multiarray.py:498(can_cast)\n",
" 2 0.000 0.000 0.000 0.000 multiarray.py:80(empty_like)\n",
" 2 0.000 0.000 0.000 0.000 numeric.py:72(_zeros_like_dispatcher)\n",
" 2 0.000 0.000 0.001 0.001 numeric.py:76(zeros_like)\n",
" 2 0.000 0.000 0.000 0.000 numerictypes.py:282(issubclass_)\n",
" 1 0.000 0.000 0.000 0.000 numerictypes.py:356(issubdtype)\n",
" 8 0.000 0.000 0.000 0.000 stride_tricks.py:25(_maybe_view_as_subclass)\n",
" 8 0.000 0.000 0.000 0.000 stride_tricks.py:340(_broadcast_to)\n",
" 24 0.000 0.000 0.000 0.000 stride_tricks.py:345(<genexpr>)\n",
" 4 0.000 0.000 0.000 0.000 stride_tricks.py:416(_broadcast_shape)\n",
" 4 0.000 0.000 0.000 0.000 stride_tricks.py:476(_broadcast_arrays_dispatcher)\n",
" 4 0.000 0.000 0.000 0.000 stride_tricks.py:480(broadcast_arrays)\n",
" 4 0.000 0.000 0.000 0.000 stride_tricks.py:538(<listcomp>)\n",
" 8 0.000 0.000 0.000 0.000 stride_tricks.py:542(<genexpr>)\n",
" 4 0.000 0.000 0.000 0.000 stride_tricks.py:546(<listcomp>)\n",
" 4 0.000 0.000 0.000 0.000 {built-in method builtins.all}\n",
" 8 0.000 0.000 0.000 0.000 {built-in method builtins.any}\n",
" 1 0.000 0.000 1.700 1.700 {built-in method builtins.exec}\n",
" 6 0.000 0.000 0.000 0.000 {built-in method builtins.getattr}\n",
" 4 0.000 0.000 0.000 0.000 {built-in method builtins.hasattr}\n",
" 3 0.000 0.000 0.000 0.000 {built-in method builtins.issubclass}\n",
" 8 0.000 0.000 0.000 0.000 {built-in method builtins.iter}\n",
" 20 0.000 0.000 0.000 0.000 {built-in method builtins.len}\n",
" 20 0.009 0.000 0.009 0.000 {built-in method numpy.array}\n",
" 10 0.000 0.000 0.000 0.000 {built-in method numpy.asanyarray}\n",
" 15 0.000 0.000 0.000 0.000 {built-in method numpy.asarray}\n",
" 31/23 0.002 0.000 0.007 0.000 {built-in method numpy.core._multiarray_umath.implement_array_function}\n",
" 2 0.000 0.000 0.000 0.000 {built-in method numpy.core._multiarray_umath.normalize_axis_index}\n",
" 8 0.000 0.000 0.000 0.000 {built-in method numpy.geterrobj}\n",
" 4 0.000 0.000 0.000 0.000 {built-in method numpy.seterrobj}\n",
" 3 0.000 0.000 0.000 0.000 {built-in method numpy.zeros}\n",
" 1 0.000 0.000 0.000 0.000 {built-in method scipy.interpolate.interpnd._ndim_coords_from_arrays}\n",
" 8 0.000 0.000 0.000 0.000 {method '__exit__' of 'numpy.nditer' objects}\n",
" 6 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}\n",
" 4 0.000 0.000 0.000 0.000 {method 'argsort' of 'numpy.ndarray' objects}\n",
" 8 0.003 0.000 0.003 0.000 {method 'copy' of 'numpy.ndarray' objects}\n",
" 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}\n",
" 8 0.006 0.001 0.006 0.001 {method 'flatten' of 'numpy.ndarray' objects}\n",
" 6 0.000 0.000 0.000 0.000 {method 'items' of 'dict' objects}\n",
" 6 0.000 0.000 0.000 0.000 {method 'reduce' of 'numpy.ufunc' objects}\n",
" 10 0.000 0.000 0.000 0.000 {method 'reshape' of 'numpy.ndarray' objects}\n",
" 2 0.001 0.001 0.001 0.001 {method 'searchsorted' of 'numpy.ndarray' objects}\n",
" 4 0.000 0.000 0.000 0.000 {method 'transpose' of 'numpy.ndarray' objects}\n",
"\n",
"\n"
]
}
],
"source": [
"points, values, xi = create_test_data(descending=True)\n",
"cProfile.run('test_ipol_xi(points, values, xi, 1)')"
]
},
{
"cell_type": "markdown",
"id": "4f2fd3cf-354c-4124-b77c-9135da92af1a",
"metadata": {},
"source": [
"# Normal test, 1000 iterations"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "e03df216-6061-4884-8eff-97ccdd4d037c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 138004 function calls in 2.073 seconds\n",
"\n",
" Ordered by: standard name\n",
"\n",
" ncalls tottime percall cumtime percall filename:lineno(function)\n",
" 1 0.005 0.005 2.073 2.073 4049209860.py:2(test_ipol_xi)\n",
" 2000 0.001 0.000 0.015 0.000 <__array_function__ internals>:177(all)\n",
" 2000 0.002 0.000 0.154 0.000 <__array_function__ internals>:177(any)\n",
" 1000 0.001 0.000 0.004 0.000 <__array_function__ internals>:177(can_cast)\n",
" 2000 0.001 0.000 0.019 0.000 <__array_function__ internals>:177(diff)\n",
" 2000 0.002 0.000 1.147 0.001 <__array_function__ internals>:177(searchsorted)\n",
" 2000 0.002 0.000 0.024 0.000 <__array_function__ internals>:177(where)\n",
" 1 0.000 0.000 2.073 2.073 <string>:1(<module>)\n",
" 1000 0.017 0.000 0.062 0.000 _rgi.py:212(__init__)\n",
" 1000 0.001 0.000 0.001 0.000 _rgi.py:259(<listcomp>)\n",
" 1000 0.021 0.000 2.006 0.002 _rgi.py:262(__call__)\n",
" 1000 0.367 0.000 0.392 0.000 _rgi.py:358(_evaluate_linear)\n",
" 1000 0.013 0.000 0.013 0.000 _rgi.py:363(<listcomp>)\n",
" 1000 0.011 0.000 0.011 0.000 _rgi.py:364(<listcomp>)\n",
" 1000 0.187 0.000 1.384 0.001 _rgi.py:469(_find_indices)\n",
" 1000 0.050 0.000 0.051 0.000 _rgi.py:490(_find_out_of_bounds)\n",
" 4000 0.006 0.000 0.007 0.000 _ufunc_config.py:131(geterr)\n",
" 4000 0.008 0.000 0.019 0.000 _ufunc_config.py:32(seterr)\n",
" 2000 0.001 0.000 0.001 0.000 _ufunc_config.py:425(__init__)\n",
" 2000 0.002 0.000 0.013 0.000 _ufunc_config.py:429(__enter__)\n",
" 2000 0.002 0.000 0.010 0.000 _ufunc_config.py:434(__exit__)\n",
" 2000 0.000 0.000 0.000 0.000 fromnumeric.py:1315(_searchsorted_dispatcher)\n",
" 2000 0.002 0.000 1.143 0.001 fromnumeric.py:1319(searchsorted)\n",
" 2000 0.000 0.000 0.000 0.000 fromnumeric.py:2302(_any_dispatcher)\n",
" 2000 0.002 0.000 0.146 0.000 fromnumeric.py:2307(any)\n",
" 2000 0.000 0.000 0.000 0.000 fromnumeric.py:2401(_all_dispatcher)\n",
" 2000 0.002 0.000 0.012 0.000 fromnumeric.py:2406(all)\n",
" 2000 0.002 0.000 1.141 0.001 fromnumeric.py:51(_wrapfunc)\n",
" 4000 0.007 0.000 0.153 0.000 fromnumeric.py:69(_wrapreduction)\n",
" 4000 0.002 0.000 0.002 0.000 fromnumeric.py:70(<dictcomp>)\n",
" 2000 0.000 0.000 0.000 0.000 function_base.py:1315(_diff_dispatcher)\n",
" 2000 0.014 0.000 0.015 0.000 function_base.py:1319(diff)\n",
" 2000 0.000 0.000 0.000 0.000 multiarray.py:341(where)\n",
" 1000 0.000 0.000 0.000 0.000 multiarray.py:498(can_cast)\n",
" 2000 0.002 0.000 0.002 0.000 numerictypes.py:282(issubclass_)\n",
" 1000 0.002 0.000 0.004 0.000 numerictypes.py:356(issubdtype)\n",
" 1 0.000 0.000 2.073 2.073 {built-in method builtins.exec}\n",
" 2000 0.001 0.000 0.001 0.000 {built-in method builtins.getattr}\n",
" 4000 0.001 0.000 0.001 0.000 {built-in method builtins.hasattr}\n",
" 3000 0.001 0.000 0.001 0.000 {built-in method builtins.issubclass}\n",
" 8000 0.001 0.000 0.001 0.000 {built-in method builtins.len}\n",
" 2000 0.000 0.000 0.000 0.000 {built-in method numpy.asanyarray}\n",
" 9000 0.002 0.000 0.002 0.000 {built-in method numpy.asarray}\n",
" 11000 0.034 0.000 1.350 0.000 {built-in method numpy.core._multiarray_umath.implement_array_function}\n",
" 2000 0.001 0.000 0.001 0.000 {built-in method numpy.core._multiarray_umath.normalize_axis_index}\n",
" 8000 0.002 0.000 0.002 0.000 {built-in method numpy.geterrobj}\n",
" 4000 0.003 0.000 0.003 0.000 {built-in method numpy.seterrobj}\n",
" 1000 0.001 0.000 0.001 0.000 {built-in method numpy.zeros}\n",
" 1000 0.001 0.000 0.001 0.000 {built-in method scipy.interpolate.interpnd._ndim_coords_from_arrays}\n",
" 6000 0.001 0.000 0.001 0.000 {method 'append' of 'list' objects}\n",
" 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}\n",
" 4000 0.001 0.000 0.001 0.000 {method 'items' of 'dict' objects}\n",
" 4000 0.143 0.000 0.143 0.000 {method 'reduce' of 'numpy.ufunc' objects}\n",
" 2000 0.002 0.000 0.002 0.000 {method 'reshape' of 'numpy.ndarray' objects}\n",
" 2000 1.138 0.001 1.138 0.001 {method 'searchsorted' of 'numpy.ndarray' objects}\n",
"\n",
"\n"
]
}
],
"source": [
"points, values, xi = create_test_data()\n",
"cProfile.run('test_ipol_xi(points, values, xi, 1000)')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment