繁体   English   中英

Python从Surface Contour Plot中提取PointProbes

[英]Python Extract PointProbes from Surface Contour Plot

我想从表面轮廓图中提取给定的点探针。 因此,我使用以下代码段创建了曲面:

def createInterpolatedSurface():
  npts=1000
  xi = np.linspace(min(x), max(x),npts)
  yi = np.linspace(min(y), max(y),npts)
  xi,yi=np.meshgrid(xi,yi,indexing='xy')
  ui=scipy.interpolate.griddata((x,y),u,(xi,yi),method='linear')
return xi,yi,ui

我的下一步是设置点数组,并将initSensorArray作为嵌套循环函数,我感兴趣的是:

所以这是我的主要问题。 我想使用我点的真实物理坐标,而不是griddata插值函数的ij索引坐标。

例如:物理空间中的Point(0.5,0.1)等于griddata ij索引中的Pointg(100,125)。

如何将物理点坐标映射到网格数据,外推点并将其映射回去?

感谢帮助

您可以在2D模式下使用scipy的插值函数,

from scipy import interpolate

x,y,u = createInterpolatedSurface()

#Create an interpolation function 
f = interpolate.interp2d(x, y, u, kind='cubic')

#Use interpolation function to get results
xpoint = 0.5
ypoint = 0.1
upoint = f(xpoint, ypoint)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM