462 questions
0
votes
1
answer
92
views
How to deal with boundary points when upscaling with linear interpolation
I have a list of numbers that needs to be interpolated for the purpose of upscaling an image. I am using bilinear interpolation. The boundary must be of "clamp" type. Now consider the a ...
1
vote
1
answer
35
views
Interpolation x and y values with n time duration
if x values change from 3 to 9 over a 60 seconds duration , and y values change from 4 to 6 in the same duration time (60 seconds ).
what time n will make x = y ?
I tried , X3 = X1 + ((Y3 - Y1) * ((X2 ...
1
vote
1
answer
39
views
interpolarization within groups with NA
I have difficulties interpolating a grouped dataframe. My problem is: Some of my groups have no value at all, then either 0 or NA; some groups have only one value, then this should be multiplied and ...
1
vote
0
answers
72
views
How to dynamically update a single plot for multiple iterations in Python (equivalent to MATLAB drawnow)?
I am trying to translate the following MATLAB code to Python. In MATLAB, the code dynamically updates a single plot for multiple iterations (n = 1:100), and each update displays the interpolation ...
1
vote
0
answers
267
views
Using the asammdf library to resample a signal with linear interpolation
I use the asammdf python library to read files in MDF4 format and export them to CSV format :
from asammdf import MDF
mdf = MDF("C:/Users/haonf/Downloads/RecordFile_24-11-12_22_11_10_237.mf4"...
0
votes
1
answer
96
views
How to interpolate 3d variable like RAINC from netcdf file using wrf-python
Currently ,I am working on netcdf file ,from which i need to extract data using wrf-python and plot in the graph,
while plotting , i got an issue ( i have attached the image, you can refer it).
Before ...
1
vote
0
answers
46
views
Interpolation of vertex attributes during rasterization
RENDER
There is a set of vertices:
new Vector(-0.5,-0.5,-0.5),
new Vector(-0.5, 0.5,-0.5),
new Vector( 0.5, 0.5,-0.5),
new Vector( 0.5,-0.5,-0.5),
new Vector(-0....
0
votes
1
answer
276
views
How can I deal with passing 360 degrees when I linearly interpolate between two headings?
A part of my python program linearly interpolates between two compass headings. It works fine as long as I don't have to deal with passing through North. Is there a good way to deal with this rather ...
1
vote
4
answers
160
views
Boundedness of linear interpolation formula
Consider the following implementation of linear interpolation:
lerp(x1, x2, y1, y2, x) = y1 * (x - x2) / (x1 - x2) + y2 * (x - x1) / (x2 - x1)
Is it true that x1 <= x <= x2 implies y1 <= lerp(...
1
vote
0
answers
106
views
linearly interpolate 1D array against n dimensional arrays over axis in parallel
Is there any way to interpolate an 1D array against two n-dimensional arrays along certain axis?
In particular, I have x and y arrays with shapes (6, 2, 10). I also have an x_in array with shape(10, ) ...
-1
votes
2
answers
115
views
Interpolation of data with pandas
I have several measured values, each in a time series.
Time steps are unevenly distributed and also uneven between the data series.
I'm trying to interpolate each series into a fixed 10 second time ...
1
vote
1
answer
66
views
Looking to process 1d linear interpolation on a 3D gridded dataset
This is a follow-up question to an earlier question: Implementing 1D interpolation on a 3D Array in Numpy or Xarray
Tsoil is a 3D xarray dataset with the following dimensions:
<xarray.DataArray '...
0
votes
1
answer
69
views
How can I interpolate missing values based on the sum of the gap using pyspark?
I have a timeseries dataset with four fields, eg: user_id, timestamp, miles, and total_mileage. Miles would be the amount of miles driven in one time step, the total_mileage the mileage of the car at ...
1
vote
2
answers
431
views
What's the function object alternative to 1D linear interpolation with SciPy/NumPy?
I'm looking for a way to create a "functor" for linear interpolation of time,value pairs using SciPy (or NumPy) but according to the SciPy tutorial there is none! (Kind of the opposite of ...
1
vote
1
answer
214
views
Interpolate array along first axis with scipy
I'm struggling hard to perform a simple linear interpolation of a datacube of size Nx*Ny*Nz into a new one that would keep the other two dimensions constant i.e. the resulting output would be Nxnew*Ny*...
0
votes
1
answer
110
views
Linear interpolation between data points onto a fixed y-grid
I want to use linear interpolation to create a finer dataset where my responses y are non-monotonic and I need to interpolate onto a fixed y-grid (this is not negotiable). I have a script that does ...
-1
votes
2
answers
123
views
MySQL Query for Spread/Difference of Energy Counter and missing Value interpolation
I have an energy counter (kWh) recorded in a MySQL database every 15 minutes.
Sometimes the recording fails for several reasons (power outage, computer reboot for updates...) and values are missing.
...
0
votes
0
answers
57
views
Which function in R would do a piecewise linear interpolation per each row, using other variables?
Basically, I have this dataset with missing obs. So suppose we want to fill in missing data using the previous observation's Xs, and the average change for the Xs that exist for both the current and ...
0
votes
1
answer
105
views
Interpolating along a table of values
I have a dataframe with 5 columns (a, b, c, d, e, f). I then have specific values for columns a, b and c and need to interpolate along the dataframe to get values for columns d and e as well.
As a ...
1
vote
3
answers
1k
views
Numpy scipy 2d interpolation for linear piecewise data
I have the points:
points = np.array([[0, 105],[5000, 105],[0, 135],[5000, 135],[0, 165],[5000, 165]])
and values
values = np.array([[300, 380, 300, 390, 300, 400]]).transpose()
with the inputs I'm ...
1
vote
0
answers
114
views
How to define an address/cell location thats in a range
I am trying to write code that essentially performs linear interpolation for me and spits the result out into an email. I have set both the first column and top row as their own ranges (excluding 3300)...
2
votes
1
answer
538
views
How to set SciPy interpolator to preserve the data most accurately?
This is an (x,y) plot I have of a vehicle's position data every 0.1 seconds. The total set is around 500 points.
I read other solutions about interpolating with SciPy (here and here), but it seems ...
0
votes
1
answer
59
views
MATLAB Interp2 equivalent in SciPy python not working
Original MATLAB Statement is -
Output = (interp2(X,Y,Tbl',Z,ThrtlPrcnt,'linear'));
Where parameter values (in Python) are
X = array([0, 550, 600, 700, 800, 874, 900, 950, 1000, 1100, 1200, 1300, 1400,...
0
votes
0
answers
70
views
Combine output of ctc distribution with decoder output distribution?
A visual representation of what I want to do
I have a transformer encoder decoder structure, but want to jointly train with ctc. The encoder outputs(vis softmax) the ctc frame wise probabilities(batch ...
1
vote
2
answers
454
views
Linear interpolation time series of data through columns
I would like to use linear interpolation to replace NA values on a Df. On my Df columns represent a time series of daily data, so the Df in on a wide format. My data represents Days (in columns) and ...
0
votes
0
answers
104
views
Fast interpolation of the values on two parallel planes in 3d space
I have sparsely sampled slices of data which are aligned to a 3d volume (medical imaging volume). The slices are all parallel planes to one another. I want to perform a linear interpolation of the ...
1
vote
2
answers
120
views
R-question: How to linear interpolate using na.approx() for wind directions (angles) 355 and 5 make 0 instead of 180
I'm trying to linear interpolate a very large dataframe using the na.approx function.
Works very well except for angular data e.g. wind directions. If you linear interpolate e.g. 350 and 10 you would ...
0
votes
1
answer
118
views
Natural interpolation in R
I'm trying to interpolate data by using the spline function (stats R package).
Specifically, I have a dataset like the following one:
DATE Y
01/01/2020
02/01/2020 0.705547512
04/01/2020 0....
0
votes
1
answer
314
views
How to get equally spaced values with Linear Interpolation when using a Limit lower than the amount of rows between values?
I have a wide dataframe with values (seconds) that decrease over time. Every row represents 1 day. It's like a "best time" for every column so the number can only decrease.
There are gaps ...
2
votes
2
answers
121
views
Resampling data from 6 min to 5min with nan
I have a linear interpolation problem with nans in my data. I have instantaneous measurements that I want to resample from 6 min intervals to 5 min intervals.
df = pd.DataFrame(zip(['10:00','10:06','...
1
vote
1
answer
542
views
GODOT Interpolation: Interpolation is not behaving how I expect visually
I am programming in the Godot game engine, and I have recently been working with interpolation to smooth out the turning (rotation) of one of my mob instances. I am new to interpolation in general, so ...
1
vote
1
answer
449
views
Can Pandas Linear interpolation capture seasonality patterns?
I have a time series dataset that contains 29,184 hours of data. There are around 1k+ rows of missing values.
Here is the link to the dataset: dropbox
Here is a small preview of the dataset:
...
3
votes
1
answer
256
views
Optimal way to take a network of nodes and interpolate missing values
I have an example data frame below:
data = [
[1, 2, 100, 4342],
[3, 4, 100, 999],
[5, 6, 500, 4339],
[4, 5, 300, 999],
[12, 13, 100, 4390],
[6, 7, 600, 4335],
[2, 3, 200, ...
2
votes
3
answers
851
views
Smooth linear interpolation using NumPy
I need to recode an equivalent of the NumPy interp function. In order to do that, I thought of building a pairwise distance matrix, and then using this matrix to define "weights" that I use ...
5
votes
0
answers
596
views
PyTorch grid_sample for 2D tensors
I have a 3D tensor data of shape (N, W, D) and another 1D tensor index of shape (B,). I need to sample data using index such that my output should be of shape (B,N,D). That is, for every element of ...
0
votes
1
answer
270
views
How to interpolate logarithmically evenly-spaced data using scipy.interpolate.interp1d?
I have a real-valued function G(t) which I want to interpolate over logarithmically evenly-spaced times: . This is needed in order to obtain an approximate expression of the components of G as a ...
0
votes
1
answer
70
views
Linear interpolation application/clarification [closed]
I am reading a manuscript, and the authors state that variables L2, L3, L4 were calculated using linear interpolations of the first and last measurement occasions (L1 and L5). L1-L5 can be thought of ...
5
votes
3
answers
3k
views
RegularGridInterpolator excruciatingly slow compared to interp2d
Consider the following code example:
# %%
import numpy
from scipy.interpolate import interp2d, RegularGridInterpolator
x = numpy.arange(9000)
y = numpy.arange(9000)
z = numpy.random.randint(-1000, ...
1
vote
0
answers
34
views
Non-conformable arrays error in Regression Kriging in R
Grretings to all!
In the Regression Kriging, i want to create a map for Standard Deviation of the Ordinary and the Regression Kriging.
The pH.sd (from the OK, Ordinary Kriging) are in a matrix: double ...
1
vote
1
answer
263
views
Linear interpolation in Python using interpolate.interp2d
I have recently started using Python and I have a problem that I would like to propose. I have three arrays (X1, X2, and X3). I need to apply linear interpolation. The goal is given new points with ...
-1
votes
1
answer
343
views
Power Query M: List.Generate condition doesn't work between values of 4 and 16
I have a table like this:
v
p
3
89
3.5
178
4
328
4.5
522
5
758
5.5
1040
v goes from 3 to 24 in steps of 0.5 (v = List.Numbers(3, 43, 0.5)).
p = {89, 178, 328, 522, 758, 1040, 1376, 1771, 2230, 2758, ...
1
vote
0
answers
175
views
How to calculate unknown values in Sine linear interpolation using quadrature look up table (LUT)?
I have generated a sine wave using a 257-point look-up table that covers only one quadrant (4th quadrant). The entries in the table are in fixed point format (Q1.15) [o,.....,-32768]. linear ...
0
votes
1
answer
148
views
Having a problem doing linear interpolation with multiple 0.0 values in a row in python
In this problem I am trying to linearly interpoplate a set of provided data without numpy or any other importable functions. The problem really arises when I am trying to linearly interpolate between ...
2
votes
1
answer
467
views
Time series interpolation: monthly data to certain day frequency data
I have time series data containing monthly observations. I now want the given interpolate monthly values (preferred linear, cubic is fine) according to a data sequence (for eg. 15-day sequence). The ...
2
votes
1
answer
751
views
What's the relationship between the barycentric coordinates of triangle in clip space and the one in screen space [closed]
Suppose I have a triangle say(PC0,PC1,PC2), and its barycentric coordinates is((1,0),(0,1),(0,0)), they are all in clip space.
And now I want calculate the interpolated barycentric coordinates in ...
0
votes
1
answer
188
views
Why does scipy.interpolate not print interpolated values in scatter plot?
I am trying to use scipy linear interpolation to fill gaps in my data so that I can draw a scatter plot of my data.
I also want to print the values changed by linear interpolation, but I am not sure ...
0
votes
1
answer
652
views
How to do linear interpolation on with approx function in R [duplicate]
I have two NA's in my Data and I simply have to do a linear interpolation to find their value but I don't understand why it does not work.
Here is the data.
It is quite big.
Here is what i've tried:
...
0
votes
1
answer
56
views
Combination of approx and map2 is surprisingly slow
I have a dataset that looks like the below:
> head(mydata)
id value1 value2
1: 1 200001 300001
2: 2 200002 300002
3: 3 200003 300003
4: 4 200004 300004
5: 5 200005 300005
6: 6 200006 ...
1
vote
1
answer
191
views
Linearly Interpolate Missing Data in mySQL
COVID-19 Data obtained from OurWorldInData includes total_boosters column to track vaccine boosters in any given country. My goal is to create a column for daily new boosters (boosters_new), then ...
1
vote
1
answer
601
views
Interpolation on irregular grids
Is it possible to perform 2D interpolation in Julia where one of the coordinates is irregular? Take the following example, where x is irregular, but y is regular:
x = [0.5 2 3 4.;
0.6 1 3 4.;
...