无法使用Rectbivariatespline在meshgrid上的2D数组上进行插值

时间:2018-06-16 12:50:35

标签: python python-3.x matplotlib scipy

我试图在精细的网格上绘制SS是一个二维数组,其值为SRTemp。我想制作一个SRTemp的精细网格网格,并绘制S的等高线图。我正在尝试使用RectBivariateSpline,但在找到Z2时收到错误。

我得到的错误是:

in line  Z2 = zspline(TT,SR)
raise ValueError("Error code returned by bispev: %s" % ier)
ValueError: Error code returned by bispev: 10

我的代码:

import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import RectBivariateSpline

T = np.array([850,800,750])  
strain_rate = np.array([0.0003,0.001,0.01,0.1])  
flow_stress1 = np.array([[28.16,  49.46,  95.96],
                         [46.45,  80.51,  126.62],
                         [151.46, 107.94, 235.14], 
                         [165.63, 228.77, 319.15]])
Temp = 1000/(273+T)
TT = np. linspace(max(Temp), min(Temp),50)

S = np.log10(flow_stress1)
SR= np.log10(strain_rate)
srate= np.linspace(min(SR), max(SR),100)
zspline = RectBivariateSpline(SR,Temp,S , kx=2, ky=2)
Z2 = zspline(TT,SR)

fig = plt.figure()
ax = fig.add_subplot(111)
x,y = np.meshgrid(Temp,SR)
ax.contourf(x,y,Z2)
plt.show()

我试过看,但没有找到解决这个问题的令人满意的方法。

0 个答案:

没有答案