Как получить 3D-точки данных из 2D-данных - PullRequest
0 голосов
/ 26 июня 2019

У меня есть два набора 2D данных, которые перпендикулярны друг другу. Один набор находится в плоскости x-y, а другой - в плоскости x-z. Другими словами они разделяют ось X. Ниже приводится грубый рисунок того, что я описываю.

Форма данных

Данные на этих плоскостях отображают интенсивность в каждой точке, поэтому точки в красной области имеют значение 3, точки в желтой области - 2 и так далее.

Моей целью было написать программу, чтобы связать эти две плоскости для создания трехмерной формы. и ниже код, который я написал.

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 - полупрозрачным оранжевым. Ниже приведены скриншоты моих результатов, наблюдаемых с разных точек зрения.

y-z перспектива

Этот мне не подходит, так как кажется, что в оранжевых точках есть падение, которого я не ожидал. Что я делаю не так в программе, которая приводит к этому провалу, и как я могу это исправить?

перспектива x-y

перспектива x-z

Буду признателен за любые отзывы и, пожалуйста, сообщите мне, если есть какая-либо другая информация, которую я могу предоставить, чтобы помочь.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...