I have a recorded data from lab equipment. In several cases I would like to interpolate and extrapolate from recorded data.
I will be using I_id
and I_iq
as my main control variables.
I have tried many different variations to get this working but I cannot.
My data looks like this for the first piece of measurement equipment:
I_id = [0,-25,-50,-75,-100,-125,-150,-175,0,-25,-50,-75,-100,-125,-150,-175,0,-25,-50,-75,-100,-125,-150,-175,0,-25,-50,-75,-100,-125,-150,-175,0,-25,-50,-75,-100,-125,-150,0,-25,-50,-75,-100,-125,-150,0,-25,-50,-75,-100,-125,0,-25,-50,-75,0,0,-25,-50,-75,-100,-125,-150,-175]
I_iq = [0,0,0,0,0,0,0,0,25,25,25,25,25,25,25,25,50,50,50,50,50,50,50,50,75,75,75,75,75,75,75,75,100,100,100,100,100,100,100,125,125,125,125,125,125,125,150,150,150,150,150,150,175,175,175,175,200,0,0,0,0,0,0,0,0]
var = [-0.040032,0.011188,0.030851,0.183906,0.258842,0.355956,0.560895,0.753436,3.325974,11.611581,12.113206,12.804795,13.11953,13.423358,13.689702,13.899162,17.267299,23.553225,24.495611,25.086743,25.559352,25.953261,26.248565,26.534781,34.935503,35.761774,36.52968,37.227405,37.834295,38.310515,38.715564,38.944562,46.322635,47.382142,48.31467,49.163737,49.897316,50.510074,50.936424,57.367325,58.686137,59.86712,60.871714,61.727998,62.407764,62.902043,68.254704,69.745637,71.075856,72.232987,73.282945,74.110145,78.724496,80.425047,81.965227,83.270788,88.79109,69.950271,1.538601,0.005484,0.160758,0.336944,0.44188,0.568149,0.825262]
I_id | I_iq | var |
---|---|---|
0 | 0 | 0 |
1 | -25 | 0 |
2 | -50 | 0 |
3 | -75 | 0 |
4 | -100 | 0 |
5 | -125 | 0 |
6 | -150 | 0 |
7 | -175 | 0 |
8 | 0 | 25 |
9 | -25 | 25 |
10 | -50 | 25 |
11 | -75 | 25 |
12 | -100 | 25 |
13 | -125 | 25 |
14 | -150 | 25 |
15 | -175 | 25 |
16 | 0 | 50 |
17 | -25 | 50 |
18 | -50 | 50 |
19 | -75 | 50 |
20 | -100 | 50 |
21 | -125 | 50 |
22 | -150 | 50 |
23 | -175 | 50 |
24 | 0 | 75 |
25 | -25 | 75 |
26 | -50 | 75 |
27 | -75 | 75 |
28 | -100 | 75 |
29 | -125 | 75 |
30 | -150 | 75 |
31 | -175 | 75 |
32 | 0 | 100 |
33 | -25 | 100 |
34 | -50 | 100 |
35 | -75 | 100 |
36 | -100 | 100 |
37 | -125 | 100 |
38 | -150 | 100 |
39 | 0 | 125 |
40 | -25 | 125 |
41 | -50 | 125 |
42 | -75 | 125 |
43 | -100 | 125 |
44 | -125 | 125 |
45 | -150 | 125 |
46 | 0 | 150 |
47 | -25 | 150 |
48 | -50 | 150 |
49 | -75 | 150 |
50 | -100 | 150 |
51 | -125 | 150 |
52 | 0 | 175 |
53 | -25 | 175 |
54 | -50 | 175 |
55 | -75 | 175 |
56 | 0 | 200 |
57 | 0 | 0 |
58 | -25 | 0 |
59 | -50 | 0 |
60 | -75 | 0 |
61 | -100 | 0 |
62 | -125 | 0 |
63 | -150 | 0 |
64 | -175 | 0 |
I have tried creating a meshgrid
:
for var in target_variables:
x = idq_data["Id"]
y = idq_data["Iq"]
z = idq_data[var]
# Create a grid of data for the target variables
xi = np.arange(np.min(x), np.max(x), 1)
yi = np.arange(np.min(y), np.max(y), 1)
xx, yy = np.meshgrid(xi, yi)
# Interpolation function using gridata
zi = griddata((x, y), z, (xx, yy), method='cubic')
However, when using griddata
when I plot the extrapolated points do not exist.
# plot the interpolated data on a contour plot
fig = go.Figure()
fig.add_trace(go.Contour(
x=xi,
y=yi,
z=zi,
colorscale='Jet',
))
fig.show()
I understand they have not been plotted as they are NaN
's but why has the values not been extrapolated?