Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove copy of less_simple_linear_interpolation
  • Loading branch information
dstansby committed Feb 2, 2018
commit 104e73a12cfe86b4a331ed633cc8c6c7aa459e7f
42 changes: 0 additions & 42 deletions lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1594,48 +1594,6 @@ def simple_linear_interpolation(a, steps):
.reshape((len(x),) + a.shape[1:]))


def less_simple_linear_interpolation(x, y, xi, extrap=False):
"""
This function provides simple (but somewhat less so than
:func:`cbook.simple_linear_interpolation`) linear interpolation.
:func:`simple_linear_interpolation` will give a list of point
between a start and an end, while this does true linear
interpolation at an arbitrary set of points.

This is very inefficient linear interpolation meant to be used
only for a small number of points in relatively non-intensive use
cases. For real linear interpolation, use scipy.
"""
x = np.asarray(x)
y = np.asarray(y)
xi = np.atleast_1d(xi)

s = list(y.shape)
s[0] = len(xi)
yi = np.tile(np.nan, s)

for ii, xx in enumerate(xi):
bb = x == xx
if np.any(bb):
jj, = np.nonzero(bb)
yi[ii] = y[jj[0]]
elif xx < x[0]:
if extrap:
yi[ii] = y[0]
elif xx > x[-1]:
if extrap:
yi[ii] = y[-1]
else:
jj, = np.nonzero(x < xx)
jj = max(jj)

yi[ii] = (y[jj] +
(xx - x[jj]) / (x[jj + 1] - x[jj]) *
(y[jj + 1] - y[jj]))

return yi


@deprecated('2.1', alternative='shutil.rmtree')
def recursive_remove(path):
if os.path.isdir(path):
Expand Down