interpolation

Smooth line with spline + datetime objects doesn't work

别等时光非礼了梦想. 提交于 2019-12-01 05:29:56
问题 I have been trying to make a plot smoother like it is done here, but my Xs are datetime objects that are not compatible with linspace.. I convert the Xs to matplotlib dates: Xnew = matplotlib.dates.date2num(X) X_smooth = np.linspace(Xnew.min(), Xnew.max(), 10) Y_smooth = spline(Xnew, Y, X_smooth) But then I get an empty plot, as my Y_smooth is [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ] for some unknown reason. How can I make this work? EDIT Here's what I get when I print the variables, I see nothing

scipy.interpolate.LinearNDInterpolator hangs indefinitely on large data sets

本秂侑毒 提交于 2019-12-01 04:30:00
问题 I'm interpolating some data in Python to regrid it on a regular mesh such that I can partially integrate it. The data represents a function of a high dimension parameter space (presently 3, to be extended to at least 5) and returns a multi-valued function of observables (presently 2, to be extended to 3 and then potentially dozens). I'm performing the interpolation via scipy.interpolate.LinearNDInterpolator for lack of any other apparent options (and because I understand griddata just calls

Pandas timeseries resampling and interpolating together

天大地大妈咪最大 提交于 2019-11-30 23:40:58
I have timestamped sensor data. Because of technical details, I get data from the sensors at approximately one minute intervals. The data may look like this: tstamp val 0 2016-09-01 00:00:00 57 1 2016-09-01 00:01:00 57 2 2016-09-01 00:02:23 57 3 2016-09-01 00:03:04 57 4 2016-09-01 00:03:58 58 5 2016-09-01 00:05:00 60 Now, essentially, I would be extremely happy if I got all data at the exact minute, but I don't. The only way to conserve the distribution and have data at each minute is to interpolate. For example, between row indexes 1 and 2 there are 83 seconds, and the natural way to get a

MATLAB: Interpolating to find the x value of the intersection between a line and a curve

﹥>﹥吖頭↗ 提交于 2019-11-30 22:19:26
Here is the graph I currently have : The Dotted Blue line represented the y value that corresponds to the x value I am looking for. I am trying to find the x values of the line's intersections with the blue curve(Upper).Since the interesections do not fall on a point that has already been defined, we need to interpolate a point that falls onto the Upper plot. Here is the information I have: LineValue - The y value of the intersection and the value of the dotted line( y = LineValue) Frequency - an array containing the x value coordinates seen on this plot. The interpolated values of Frequency

ANTIALIAS vs BICUBIC in PIL(Python Image Library)?

人走茶凉 提交于 2019-11-30 20:33:47
I am using PIL to resize my images, my case is to scale up the original image. I am confused about the algorithm used with `resample=ANTIALIAS'. According to the document below, ANTIALIAS seems to be the best while scaling down. I wonder In which case can BICUBIC win?(some of my test case shows bicubic is better choice) An optional resampling filter. This can be one of NEAREST (use nearest neighbour), BILINEAR (linear interpolation in a 2x2 environment), BICUBIC (cubic spline interpolation in a 4x4 environment), or ANTIALIAS (a high-quality downsampling filter). If omitted, or if the image has

SciPy interpolation of large matrix

China☆狼群 提交于 2019-11-30 20:15:47
问题 I have a ndarray (Z) with some 500000 elements on a rectangular grid (X, Y). Now I want to interpolate values at some 100 locations in x,y which are not necessarily on the grid. I have some code working in Matlab: data = interp2(X,Y,Z, x,y); However, when I try to use the same approach with scipy.interpolate I get various errors depending on the method. For example interp2d fails with MemoryError if i specify kind = 'linear' and "OverflowError: Too many data points to interpolate" if I

Python - Kriging (Gaussian Process) in scikit_learn

回眸只為那壹抹淺笑 提交于 2019-11-30 19:30:18
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 want to perform 3D kriging with that assumption accounted for (as a parameter I can adjust or that is

Interpolating a scalar field in a 3D space

假装没事ソ 提交于 2019-11-30 19:12:35
I have a 3D space (x, y, z) with an additional parameter at each point (energy), giving 4 dimensions of data in total. I would like to find a set of x, y, z points which correspond to an iso-energy surface found by interpolating between the known points. The spacial mesh has constant spacing and surrounds the iso-energy surface entirely, however, it does not occupy a cubic space (the mesh occupies a roughly cylindrical space) Speed is not crucial, I can leave this number crunching for a while. Although I'm coding in Python and NumPy, I can write portions of the code in FORTRAN. I can also wrap

Pandas timeseries resampling and interpolating together

怎甘沉沦 提交于 2019-11-30 18:23:27
问题 I have timestamped sensor data. Because of technical details, I get data from the sensors at approximately one minute intervals. The data may look like this: tstamp val 0 2016-09-01 00:00:00 57 1 2016-09-01 00:01:00 57 2 2016-09-01 00:02:23 57 3 2016-09-01 00:03:04 57 4 2016-09-01 00:03:58 58 5 2016-09-01 00:05:00 60 Now, essentially, I would be extremely happy if I got all data at the exact minute, but I don't. The only way to conserve the distribution and have data at each minute is to

Using interp2 in Matlab with NaN inputs

╄→гoц情女王★ 提交于 2019-11-30 16:08:02
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) %# matrices to interpolate data to, arbitrary CI = interp2(A,B,C,AI,BI) %# interpolation, A has NaN