splines

scipy.interpolate.UnivariateSpline not smoothing regardless of parameters

随声附和 提交于 2019-11-30 16:19:17
问题 I'm having trouble getting scipy.interpolate.UnivariateSpline to use any smoothing when interpolating. Based on the function's page as well as some previous posts, I believe it should provide smoothing with the s parameter. Here is my code: # Imports import scipy import pylab # Set up and plot actual data x = [0, 5024.2059124920379, 7933.1645067836089, 7990.4664106277542, 9879.9717114947653, 13738.60563208926, 15113.277958924193] y = [0.0, 3072.5653360000988, 5477.2689107965398, 5851

scipy.interpolate.UnivariateSpline not smoothing regardless of parameters

夙愿已清 提交于 2019-11-30 15:42:17
I'm having trouble getting scipy.interpolate.UnivariateSpline to use any smoothing when interpolating. Based on the function's page as well as some previous posts , I believe it should provide smoothing with the s parameter. Here is my code: # Imports import scipy import pylab # Set up and plot actual data x = [0, 5024.2059124920379, 7933.1645067836089, 7990.4664106277542, 9879.9717114947653, 13738.60563208926, 15113.277958924193] y = [0.0, 3072.5653360000988, 5477.2689107965398, 5851.6866463790966, 6056.3852496014106, 7895.2332350173638, 9154.2956175610598] pylab.plot(x, y, "o", label="Actual

Point Sequence Interpolation

心不动则不痛 提交于 2019-11-30 13:14:04
Given an arbitrary sequence of points in space, how would you produce a smooth continuous interpolation between them? 2D and 3D solutions are welcome. Solutions that produce a list of points at arbitrary granularity and solutions that produce control points for bezier curves are also appreciated. Also, it would be cool to see an iterative solution that could approximate early sections of the curve as it received the points, so you could draw with it. The Catmull-Rom spline is guaranteed to pass through all the control points. I find this to be handier than trying to adjust intermediate control

mgcv: how to extract knots, basis, coefficients and predictions for P-splines in adaptive smooth?

£可爱£侵袭症+ 提交于 2019-11-29 00:15:19
I'm using the mgcv package in R to fit some polynomial splines to some data via: x.gam <- gam(cts ~ s(time, bs = "ad"), data = x.dd, family = poisson(link = "log")) I'm trying to extract the functional form of the fit. x.gam is a gamObject , and I've been reading the documentation but haven't found enough information in order to manually reconstruct the fitted function. x.gam$smooth contains information about whether the knots have been placed; x.gam$coefficients gives the spline coefficients, but I don't know what order polynomial splines are used and looking in the code has not revealed

How to make a line curve through points

只谈情不闲聊 提交于 2019-11-28 12:06:41
I'm looking for a way to make a line curve through a number of points. It would be preferable to use 3 points although I've considered that in order to give context to the angle of the line entering a point more may be needed to give context to the curve so to speak. In general a start point P1, a control point P2 and an end point P3, the line should curve to P2 from P1 and then curve from P2 to P3. In fact here is a perfect example of the effect I would like to achieve: If I could do this I really would be eternally grateful! In Java so far, I have tried playing around with things such as

mgcv: how to extract knots, basis, coefficients and predictions for P-splines in adaptive smooth?

青春壹個敷衍的年華 提交于 2019-11-27 14:09:13
问题 I'm using the mgcv package in R to fit some polynomial splines to some data via: x.gam <- gam(cts ~ s(time, bs = "ad"), data = x.dd, family = poisson(link = "log")) I'm trying to extract the functional form of the fit. x.gam is a gamObject , and I've been reading the documentation but haven't found enough information in order to manually reconstruct the fitted function. x.gam$smooth contains information about whether the knots have been placed; x.gam$coefficients gives the spline coefficients

evaluate (i.e., predict) a smoothing spline outside R

夙愿已清 提交于 2019-11-27 08:52:42
问题 I fitted a smoothing spline to data in R with library(splines) Model <- smooth.spline(x, y, df =6) I would like to take the fitted spline and evaluate it for arbitrary new data in an external code (not in R). In other words, do what the predict.smooth.spline function does. I had a look at the Model object: > str(Total_work_model) List of 15 $ x : num [1:14] 0.0127 0.0186 0.0275 0.0343 0.0455 ... $ y : num [1:14] 3174 3049 2887 2862 2975 ... $ w : num [1:14] 1 1 1 1 1 1 1 1 1 1 ... $ yin : num

How to make a line curve through points

半世苍凉 提交于 2019-11-27 06:45:15
问题 I'm looking for a way to make a line curve through a number of points. It would be preferable to use 3 points although I've considered that in order to give context to the angle of the line entering a point more may be needed to give context to the curve so to speak. In general a start point P1, a control point P2 and an end point P3, the line should curve to P2 from P1 and then curve from P2 to P3. In fact here is a perfect example of the effect I would like to achieve: If I could do this I