python,image-processing,scipy,interpolation,spline

Using UnivariateSpline.roots() to get FWHM will only work if you shift the data so that its value is 0 at FWHM. Seeing that the background of the data is noisy, I'd first estimate the baseline. For example: y_baseline = y[(x<200) & (x>350)].mean() (adjust the limits for x as you see...

There are two implementations of bspline: uniform and standard. In uniform the first and the last control points are not interpolated and in the standard knot sequence both are interpolated. In uniform, you can have uniform knots usually 1,2,3,... For standard knot sequence if you have order k (degree k-1)...

There are multiple possible boundary conditions for splines, e.g.: second derivatives equals zero on the boundary given first derivatives on the boundary periodic conditions, i.e. same first and second derivatives on the boundary not-a-knot: take the outermost three points to specify the boundary conditions. It seems spline is using the...

Using a matrix. Using a matrix operation on a matrix is not slow: mat <- t(as.matrix(dt0[,-1,with=FALSE])) colnames(mat) <- dt0[[1]] mat[] <- na.spline(mat,na.rm=FALSE) which gives TOTAL,F,AD TOTAL,F,AL TOTAL,F,AM TOTAL,F,AT TOTAL,F,AZ 2014 32832 1409931 1692440 4351253 4755163 2013 37408 1409931 1688458 4328238 4707690 2012 38252 1409931 1684000 4309977 4651601 2011 38252 1409931...

Seems like a simple sapply would work here library(splines) sapply(1:ncol(exp.spl), function(i) { lm(exp.spl[,i] ~ bs(met.spl[,i]))$coef }) tested with met.spl<-read.table(text="AAAS ABCA7 ABCC12 ABCF1 ACN9 paciente6 0.15013343 0.01489557 0.7987748 0.02826255 0.02169665 paciente7 0.10827520 0.01215497 0.8515188 0.03378193 0.02452192 paciente8 0.12423923 0.01682172 0.4182180 0.03288906 0.02046130 paciente9 0.11779075 0.02198105 0.6101996 0.06389504 0.04574667 paciente10 0.09234602 0.01526621...

Why not using splinefun: func = splinefun(x=setx, y=population, method="fmm", ties = mean) Then you define the point to forecast you want: func(seq(1973, 2014, 0.25)) ...

c++,3d,computational-geometry,spline,sequence-points

interp3() is supposed to do interpolation for volumetric data points (Xi, Yi, Zi, Si), i=1~N. It will generate a function S=f(X, Y, Z). This is the reason why it needs the additional input 's' as noted in your post. When you encounter an interpolation problem/algorithm, the first thing you need...

r,plot,logistic-regression,spline,cox-regression

If you want the Odds ratio then you need to add a fun=-argument to transform to the odds ratio scale: plot(Predict(fit,fun=exp), anova=an, pval=TRUE, ylab="Odds ratio") I'm not sure I know what you mean by changing to the "probability of mortality", and "mortality rate" for "fit". The inverse logit function is...

If your goal is to simply come up with something visually plausible and not to do a full physical simulation, you can simply add a sine wave to the position. class Boat: def __init__(self, pace, spm, var=0.5): self.pace = pace #average velocity of the boat in m/s self.sps = spm/60.0...

r,plot,bezier,bezier-curve,spline

It may not the be the best approach, bit grid certainly isn't inactive. It's included as a default package with the R installation. It's the underlying graphics engine for plotting libraries like lattice and ggplot. You shouldn't need to install it, you should just be able to load it. Here's...

python,math,numpy,spline,cubic-spline

I just found something really interesting with the answer that I need with a bézier in this link. Then I used the code to try on my own. It's working fine apparently. This is my implementation: #! /usr/bin/python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as...

Specify full_output=True: (tck, u), fp, ier, msg = interpolate.splprep([[1.,2.,3.,4.,5.]], full_output=True) ...

Information about buzier curve and about surface rotation. You can take code from github. I wrote it few years ago, when I was quite new in Java, so code quality can be a bit poor... Output: Main classes: BezierCurve: package kpi.ua.shapes; import java.awt.Graphics2D; import java.util.LinkedList; import java.util.List; public class BezierCurve...

I assume you want to stretch the parts individually by moving the four points. Therefore it is a simple operation of adjusting all the points within the bounds. The overall shape of the curve is maintained as long as your constraint of non-overlapping is fulfilled. Of course it is not...

matlab,plot,spline,piecewise,cubic

That's pretty easy. You've already done half of the work by defining an anonymous function that is for the cubic spline in between each interval. However, you need to make sure that the operations in the function are element-wise. You currently have it operating on scalars, or assuming that we...

Internally it does this (which does not involve zoo): y <- c(NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.661698, 3.107128, 7.319669, 10.800864, 17.855491, 18.250267, 28.587002, 36.405397, 38.467383, 38.685956, 43.917737, 40.829615, 43.519173, 45.597497, 43.252656, 45.581646, 48.258325, 48.269969, 50.905045, 53.258165, 58.39137, 59.27844, 58.720518, 56.933438, 62.062116, 59.860849,...

animation,three.js,tween,spline,requestanimationframe

var sunGeo = new THREE.SphereGeometry(12,35,35); var sunMat = new THREE.MeshPhongMaterial(); sunMat.map = THREE.ImageUtils.loadTexture("image/sunmap.jpg"); var sun = new THREE.Mesh(sunGeo, sunMat); sun.position.set(0,0,0); scene.add(sun); // add Sun var mercuryGeo = new THREE.SphereGeometry(2,15,15); var mercuryMat = new THREE.MeshPhongMaterial(); mercuryMat.map = THREE.ImageUtils.loadTexture("image/mercurymap.jpg"); var mercury = new THREE.Mesh(mercuryGeo, mercuryMat); scene.add(mercury); // add Mercury var t =...

svg,graphics,trigonometry,bezier-curve,spline

After few tries/errors, I found that the correct ratio is K=0.37. "M" + x1 + "," + y1 + "C" + (x1 + K * (x2 - x1)) + "," + y1 + "," + (x2 - K * (x2 - x1)) + "," + y2 + "," + x2...

c++,arrays,interpolation,points,spline

I had to write a Bezier spline creation routine for an "entity" that was following a path in a game I am working on. I created a base class to handle a "SplineInterface" and the created two derived classes, one based on the classic spline technique (e.g. Sedgewick/Algorithms) an a...

matlab,spline,piecewise,cubic-spline

This is probably the easiest way to get pp1 + pp2 Adding to the code in the question: pp12 = @(x) ppval(pp1,x)+ppval(pp2,x); breaks = unique([pp1.breaks,pp2.breaks]); pp3 = spline(breaks,pp12(breaks)); plot(tnew,ppval(pp3,tnew),'k:'); Gives the dotted black line: with pp3 being in piecewise-polynomial form with segments defined only by the breakpoints of pp1 and...

This one is actually very easy if you know that there is a predict() method for objects created by smooth.spline() and that this method has an argument deriv which allows you to predict a given derivative (in your case the second derivative is required) instead of points on the spline....

matlab,regression,curve-fitting,spline

I'm not sure how to display any equations on the graph, but you should be able to replicate the cubic spline interpolation using the commands spline and unmkpp. % returns the piecewise polynomial form of the cubic spline interpolant pp = spline(x,Y) % use unmkpp(pp) to get the piecewise polynomial...

eclipse,libgdx,curve,spline,catmull-rom-curve

Your code should work fine according to the api and the source. The class IS generic. You must be using some old version of the class. Update to the latest version and the error should be solved. Hope this helps....

geometry,2d,bezier-curve,spline

Imagine cubic curve between points B and E. If it is defined as cardinal spline with tension parameter s, then tangent vectors in these points are Tb = s * (E - A) Te = s * (F - B) If curve is defined as Bezier one, then tangent vectors...

python,scipy,interpolation,spline,cubic-spline

Short answer: import numpy as np from scipy import interpolate def f(x): x_points = [ 0, 1, 2, 3, 4, 5] y_points = [12,14,22,39,58,77] tck = interpolate.splrep(x_points, y_points) return interpolate.splev(x, tck) print f(1.25) Long answer: scipy separates the steps involved in spline interpolation into two operations, most likely for computational...

algorithm,polygon,computational-geometry,spline

It can be done by recursively refining part which is not near segment between part ends. If we have curve (spline) C:[0,1]->R^n. Than first approximation is segment S between curve end points [C(0), C(1)]. Take point C(0.5) and check how far is it from segment S. If it is far...

javascript,charts,spline,timeserieschart,c3.js

What you need is a line chart with multiple x axes, like this: To use a multiple x chart in c3js, you must declare several xs values. I guessed you would need to add dates here and there, so I made the arrays containing data and dates global. The function...

android,opengl-es,3d,libgdx,spline

The Matrix4#rotate method has two arguments, base and target. In your case the base vector should be Vector3.X, while the target is derivative. You need to swap the arguments for this. Also, the Matrix4#rotate method post-multiplies the rotation on top the existing rotation. Or in other words: this will accumulate...