我有两组相互垂直的二维数据。一组在x-y平面上,另一组在x-z平面上。换句话说,它们共享x轴。下面是我所描述的内容的一个大概图
这些平面上的数据映射每个点的强度,因此红色区域中的点的值为3,黄色区域中的点的值为2,依此类推
我的目标是编写一个程序,将这两个平面关联起来,创建一个3D形状。下面是我写的代码
mPoints1 = pd.DataFrame(columns = ['X','Y','Z','I'])
iPoints1 = pd.DataFrame(columns = ['X','Y','Z','I'])
#newV_transposed and newH_transposed.columns are the dataframes containing intensities for each value on the axis
for m in list(newV_transposed.columns.values): #This iterates through the x values of the x-y dataset
for n in list(newH_transposed.columns.values): #This iterates through the x values of the x-z dataset
if (m == n and 931.717<= m <=932.145): #check that we are looking at the intensity value associated with the same x in both sets of data
ymatches = newV_transposed.loc[newV_transposed[m] == 3] #selecting all the rows that have an intensity of 3 in the x-y data set
zmatches = newH_transposed.loc[newH_transposed[m] == 3] #selecting all the rows that have an intensity of 3 in the x-z data set
ys = ymatches.index.values #storing all the y values of the rows
zs = zmatches.index.values #storing all the z values of the rows
for z in zs: #iterate through the z values found
for y in ys: #iterate through the y values found
iPoints1 = iPoints1.append({'X': m, 'Y': y, 'Z': z, 'I': 3}, ignore_index=True)
# add a set of coordinates to the data frame iPoints one
# This nested loops ensures that I am layering a set of points along the z axis
for m in list(newV_transposed.columns.values):
for n in list(newH_transposed.columns.values):
if (m == n and 931.717<= m <=932.145): #and m == 932.505
ymatches = newV_transposed.loc[newV_transposed[m] == 2]
zmatches = newH_transposed.loc[newH_transposed[m] == 2]
ys = ymatches.index.values
zs = zmatches.index.values
for z in zs:
for y in ys:
mPoints1 = mPoints1.append({'X': m, 'Y': y, 'Z': z, 'I': 2}, ignore_index=True)
因此,我用红色绘制了iPoints1
中存储的坐标点,用半透明橙色绘制了mPoints1
中存储的坐标点。下面是我从不同角度观察结果的截图
这一个看起来不正确,因为似乎有一个橙色的点,我没有预料到下降。我在程序中做错了什么导致了这种下降?我如何修复这种情况
我将感谢任何反馈,如果有任何其他信息我可以提供帮助,请让我知道
目前没有回答
相关问题 更多 >
编程相关推荐