interpolation

Plotting interpolated values using LinearNDInterpolator (Python)

流过昼夜 提交于 2020-01-01 07:37:12
问题 I am using the LinearNDInterpolator on some (x, y, z) data, using the following script. However, I cannot figure out how to go from the interpolated data to plotting/showing the interpolation in heatmap form? Am I missing something like setting up a meshgrid based on the min and max of x and y? Any help or an example would be great! import numpy as np import scipy.interpolate x = np.array([-4386795.73911443, -1239996.25110694, -3974316.43669208, 1560260.49911342, 4977361.53694849, -1996458

Extrapolating data with interp not producing accurate image

谁说胖子不能爱 提交于 2020-01-01 06:55:10
问题 I have a graph where the extrapolation does not match the initial interpolation. I would like the heatmap to fill the entire image. First, the interpolation code: library(akima) library(reshape2) xmin <- signif(min(CBLo2$MD1)) xmax <- signif(max(CBLo2$MD1)) ymin <- signif(min(CBLo2$MD2)) ymax <- signif(max(CBLo2$MD2)) gridint <- 100 fld <- with(CBLo2, interp(x = MD1, y = MD2, z = Abundance, xo=seq(xmin, xmax, length=gridint), yo=seq(ymin, ymax, length=gridint) )) df <- melt(fld$z, na.rm =

Drawing Hermite curves in OpenGL

微笑、不失礼 提交于 2020-01-01 04:46:10
问题 How can I draw Hermite curves using OpenGL, are there any built in functions? I saw some examples on-line that show how to use evaluators to draw Bezier curves but could not find any information for Hermite curves. 回答1: Let the vector of control points for your Bezier be [b0 b1 b2 b3] and those for your Hermite be [h0 h1 v0 v1] (v0 and v1 being the derivative / tangent at points h0 and h1). Then we can use a matrix form to show the conversions: Hermite to Bezier [b0] = 1 [ 3 0 0 0] [h0] [b1]

How to increase sample frequency of dataset (reshape, interpolate?) and fill the Nan values with means

坚强是说给别人听的谎言 提交于 2019-12-31 05:09:33
问题 I have a dataset with an uneven sample frequency as seen on this subset: time date x y id nn1 nn2 0 2019-09-17 08:43:06 234 236 4909 22.02271554554524 38.2099463490856 0 2019-09-17 08:43:06 251 222 4911 22.02271554554524 46.57252408878007 1 2019-09-17 08:43:07 231 244 4909 30.4138126514911 41.617304093369626 1 2019-09-17 08:43:07 252 222 4911 30.4138126514911 46.57252408878007 1 2019-09-17 08:43:07 207 210 4900 41.617304093369626 46.57252408878007 2 2019-09-17 08:43:08 234 250 4909 33

2d probability distribution with rbf and scipy

随声附和 提交于 2019-12-31 04:02:16
问题 I have something similar to this problem respectivly the answer of this problem: RBF interpolation: LinAlgError: singular matrix But I want to do the probability distribution with rbf. My code until now: from scipy.interpolate.rbf import Rbf # radial basis functions import cv2 import matplotlib.pyplot as plt import numpy as np x = [1, 1, 2 ,3, 4, 4, 2, 6, 7] y = [0, 2, 5, 6, 2, 4, 1, 5, 2] rbf_adj = Rbf(x, y, function='gaussian') plt.figure() # Plotting the original points. plot3 = plt.plot(x

How to interpolate points between two irregular sets of data?

丶灬走出姿态 提交于 2019-12-30 08:12:17
问题 I'm sorry for the somewhat confusing title, but I wasn't sure how to sum this up any clearer. I have two sets of X,Y data, each set corresponding to a general overall value. They are fairly densely sampled from the raw data. What I'm looking for is a way to find an interpolated X for any given Y for a value in between the sets I already have. The graph makes this more clear: In this case, the red line is from a set corresponding to 100, the yellow line is from a set corresponding to 50. I

Interpolation in vector-valued multi-variate function

时光毁灭记忆、已成空白 提交于 2019-12-30 06:49:40
问题 In Python, I'm trying to construct a routine that interpolates in vector-valued data in a multi-dimensional (5+) parameter space. i.e. I have a function that takes a number of input variables and returns a number of output variables. At the moment, there is one call for each element of the vector. The data is in a columned file, so I retrieve it with import numpy [x_data,y_data,f1_data,f2_data] = numpy.loadtxt('data',unpack=True) Then, I instantiate individual interpolators using SciPy's

Python - Kriging (Gaussian Process) in scikit_learn

别等时光非礼了梦想. 提交于 2019-12-30 06:20:50
问题 I am considering using this method to interpolate some 3D points I have. As an input I have atmospheric concentrations of a gas at various elevations over an area. The data I have appears as values every few feet of vertical elevation for several tens of feet, but horizontally separated by many hundreds of feet (so 'columns' of tightly packed values). The assumption is that values vary in the vertical direction significantly more than in the horizontal direction at any given point in time. I

Using interp2 in Matlab with NaN inputs

自闭症网瘾萝莉.ら 提交于 2019-12-30 05:29:06
问题 I have some observational data that is relatively complete, but contains some NaN values, in an matrix in matlab and I want to interpolate them to a more evenly spaced grid using interp2 So, to keep things simple lets say I have one complete (no NaN values) matrix, and one that looks something like: A = [ 1 2 3 4; 2 3 2 NaN; 0 2 3 4; 0 NaN 4 5 ] with B and C being complete matrices, interp2 won't accept an input matrix with NaN values. So if I do something like this: [AI,BI] = meshgrid(a,b) %

Python interp1d vs. UnivariateSpline

流过昼夜 提交于 2019-12-30 01:10:11
问题 I'm trying to port some MatLab code over to Scipy, and I've tried two different functions from scipy.interpolate, interp1d and UnivariateSpline. The interp1d results match the interp1d MatLab function, but the UnivariateSpline numbers come out different - and in some cases very different. f = interp1d(row1,row2,kind='cubic',bounds_error=False,fill_value=numpy.max(row2)) return f(interp) f = UnivariateSpline(row1,row2,k=3,s=0) return f(interp) Could anyone offer any insight? My x vals aren't