scipy.interpolate.gridata speed issues

See original GitHub issue

I am trying to plot heatmap with three variables x, y and z, each with vector length of 932826. The time taken with the function below is 28 seconds, with a bin size of 10 on each x and y

When debugging I see that the maximum time consumed is while using the griddata function. So, I was wondering if there are any alternatives that I can use instead of griddata to make the interpolation quicker

 import numpy as np
 import matplotlib.pyplot as plt
 import time
 from scipy.interpolate import griddata
 import os
 
 x = np.loadtxt(savepath + '\\' + 'x.csv', delimiter=',')
 y = np.loadtxt(savepath + '\\' + 'y.csv', delimiter=',')
 z = np.loadtxt(savepath + '\\' + 'z.csv', delimiter=',')
 
 x_linspace = 10
 y_linspace = 10
 
 xi = np.linspace(min(x), max(x), x_linspace)
 yi = np.linspace(min(y), max(y), y_linspace)
 start = time.time()
 zi = griddata((x, y), z, (xi[None, :], yi[:, None]), method='linear')
 print('Time elapsed = ', time.time()-start)

Inputs.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tupuicommented, May 25, 2021

The new version of RBFInterpolator has a parameter to only use n-neighbouring points.

For the development version see: https://scipy.github.io/devdocs/dev/contributor/contributor_toc.html

0reactions
masoomk87commented, May 25, 2021

Where can I find the developement version ? Sorry I am bit new to GitHub

Read more comments on GitHub >

github_iconTop Results From Across the Web

Very slow interpolation using `scipy.interpolate.griddata`
I am experiencing excruciatingly slow performance of scipy.interpolate.griddata when trying to interpolate "almost" regularly gridded data to map ...
Read more >
griddata sensible to size of original grid when it should not
I am using scipy.interpolate.griddata in order to interpolate data from an original 2d grid to a target sub-region of that grid but at...
Read more >
speeding-up griddata()
Hi all, I would like to use griddata() to interpolate a function given at specified points ... I have a very good experience...
Read more >
[SciPy-User] 3D spline interpolation very, very slow
[SciPy-User] 3D spline interpolation very, very slow - UPDATE - ... This is why linear 3D interpolation (`order=1`) takes a fraction of a ......
Read more >
Interpolation (scipy.interpolate) — SciPy v1.11.0.dev0+1188 ...
interpolate )#. There are several general facilities available in SciPy for interpolation and smoothing for data in 1, 2, and higher dimensions. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found