spline

“Invalid input data” from SciPy's cublic spline interpolation process; bad results from interpolate.bisplrep?

喜你入骨 提交于 2020-05-29 08:35:40
问题 I'm attempting to use scipy.interpolate.bisplrep and scipy.interpolate.bisplev to perform a 2D regression on the differences between two datasets, based on a small set of known differences. The code is: splineRT = interp.bisplrep(diffPoints[0], diffPoints[1], RTdiffs) allDiffs = interp.bisplev(features[0], features[1], splineRT) When I run this, bisplev throws the inscrutable exception "ValueError: Invalid input data", which is in response from an error code returned from the underlying

“Invalid input data” from SciPy's cublic spline interpolation process; bad results from interpolate.bisplrep?

强颜欢笑 提交于 2020-05-29 08:32:37
问题 I'm attempting to use scipy.interpolate.bisplrep and scipy.interpolate.bisplev to perform a 2D regression on the differences between two datasets, based on a small set of known differences. The code is: splineRT = interp.bisplrep(diffPoints[0], diffPoints[1], RTdiffs) allDiffs = interp.bisplev(features[0], features[1], splineRT) When I run this, bisplev throws the inscrutable exception "ValueError: Invalid input data", which is in response from an error code returned from the underlying

“Invalid input data” from SciPy's cublic spline interpolation process; bad results from interpolate.bisplrep?

泪湿孤枕 提交于 2020-05-29 08:32:10
问题 I'm attempting to use scipy.interpolate.bisplrep and scipy.interpolate.bisplev to perform a 2D regression on the differences between two datasets, based on a small set of known differences. The code is: splineRT = interp.bisplrep(diffPoints[0], diffPoints[1], RTdiffs) allDiffs = interp.bisplev(features[0], features[1], splineRT) When I run this, bisplev throws the inscrutable exception "ValueError: Invalid input data", which is in response from an error code returned from the underlying

How to add boundary constraints to a spline with geomdl or other library?

僤鯓⒐⒋嵵緔 提交于 2020-05-17 06:05:54
问题 Here is the spline without constraints: from geomdl import fitting from geomdl.visualization import VisMPL path = [(2077.0, 712.0, 1136.6176470588234), (2077.0004154771536, 974.630482962754, 1313.735294117647), (2077.1630960823995, 1302.460574562254, 1490.8529411764707), (2078.1944091179635, 1674.693193015173, 1667.9705882352941), (2080.5096120056783, 2086.976611915444, 1845.0882352941176), (2085.1051468332066, 2711.054258877495, 2022.2058823529412), (1477.0846185328733, 2803.6223679691457,

Cubic hermit spline interpolation python

坚强是说给别人听的谎言 提交于 2020-05-11 02:59:57
问题 I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points. https://en.wikipedia.org/wiki/Cubic_Hermite_spline I know of scipy's interpolation methods. Specifically splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives. Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data. To give

Cubic hermit spline interpolation python

荒凉一梦 提交于 2020-05-11 02:57:52
问题 I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points. https://en.wikipedia.org/wiki/Cubic_Hermite_spline I know of scipy's interpolation methods. Specifically splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives. Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data. To give

Cubic hermit spline interpolation python

≡放荡痞女 提交于 2020-05-11 02:57:50
问题 I would like to calculate a third-degree polynomial that is defined by its function values and derivatives at specified points. https://en.wikipedia.org/wiki/Cubic_Hermite_spline I know of scipy's interpolation methods. Specifically splprep to interpolate a N-dimensional spline and splev to eveluate its derivatives. Is there a python routine that takes function values f(x) and derivatives f'(x) corresponding to values x and calculates a spline representation that fits the given data. To give

Differentiate a 2d cubic spline in python

隐身守侯 提交于 2020-05-09 06:56:13
问题 I'm using interpolate.interp2d() to fit a 2-D spline over a function. How can I get the first derivative of the spline w.r.t. each of the dependent variables? Here is my code so far, Z are the descrete points on a mesh-grid that I have from scipy import interpolate YY, XX = np.meshgrid(Y, X) f = interpolate.interp2d(AA, XX, Z, kind='cubic') So, I need df/dx and df/dy. Note also that my Y-grid is not evenly spaced. I guess I can numerically differentiate Z and then fit a new spline, but it

Spline with constraints at border

好久不见. 提交于 2020-03-17 10:21:12
问题 I have measured data on a three dimensional grid, e.g. f(x, y, t) . I want to interpolate and smooth this data in the direction of t with splines. Currently, I do this with scipy.interpolate.UnivariateSpline : import numpy as np from scipy.interpolate import UnivariateSpline # data is my measured data # data.shape is (len(y), len(x), len(t)) data = np.arange(1000).reshape((5, 5, 40)) # just for demonstration times = np.arange(data.shape[-1]) y = 3 x = 3 sp = UnivariateSpline(times, data[y, x]

How can I put constraint of derivative zero at all data points for spline interpolation?

偶尔善良 提交于 2020-02-24 16:51:51
问题 Is there any method in scipy for spline interpolation in which I can use constraint on derivative at each data points? I found one "scipy.interpolate.PiecewisePolynomial" but PiecewisePolynomial class has been deprecated. 回答1: Yes. The BPoly class in scipy.interpolate has a method that constructs a piecewise polynomial in the Bernstein basis, compatible with the specified values and derivatives at breakpoints. as stated in the scipy reference, here. Basic usage on Python3 can go as following: