I have data from a series of points that over lap between two graphs that give the following data: MULTIPOINT (2.143370447157314 0.1353352832366127, 75.99346394751342 0.1353352832366127, 94.39258581473268 0.1353352832366127, 111.8928901992089 0.1353352832366127, 127.0468781718633 0.1353352832366127, 184.5804306294127 0.1353352832366127, 204.2456523252587 0.1353352832366127, 219.5685478372618 0.1353352832366127, 231.2004389877476 0.1353352832366127, 293.5451724106475 0.1353352832366127, 310.9486085910552 0.1353352832366127, 330.0610044903921 0.1353352832366127, 338.7762476890871 0.1353352832366127, 402.2859828353771 0.1353352832366127, 422.3815761349065 0.1353352832366127, 440.9842862789425 0.1353352832366127, 451.6324097852983 0.1353352832366127, 512.7034613293686 0.1353352832366127, 530.623914129864 0.1353352832366127, 549.842226961968 0.1353352832366127, 561.6760004904758 0.1353352832366127, 624.6195484846207 0.1353352832366127, 640.701617729866 0.1353352832366127, 659.3176260680895 0.1353352832366127, 659.6827799404297 0.1353352832366127, 661.1778885763671 0.1353352832366127, 671.2977053828017 0.1353352832366127, 738.9468397381991 0.1353352832366127, 747.9185452191947 0.1353352832366127, 768.0657707819746 0.1353352832366127, 782.5204038757331 0.1353352832366127, 879.0203459813714 0.1353352832366127, 895.3297620941928 0.1353352832366127, 958.2812971302388 0.1353352832366127, 958.9412279666292 0.1353352832366127, 986.2760322593815 0.1353352832366127, 1001.912171992246 0.1353352832366127, 1096.858061280496 0.1353352832366127, 1118.376788346299 0.1353352832366127, 1203.92639341071 0.1353352832366127, 1220.384947439686 0.1353352832366127, 1317.401330046149 0.1353352832366127, 1317.502930130382 0.1353352832366127, 1318.858929927066 0.1353352832366127, 1319.772755799937 0.1353352832366127, 1323.478519672568 0.1353352832366127, 1325.491001741218 0.1353352832366127, 1429.099147413253 0.1353352832366127)
All of the Y values are the same and so I want to separate the X and Y values and only call the X values. I have tried using the .split function but it doesn't work. I also will have to do this with more data sets so if there's a universal way of doing it without knowing the X values that would be very helpful. Any help would be Greatly appreciated! I am using python.
here is my code:
df = pd.read_csv("C:\\Users\\Kyle\\Desktop\\Plot_Values1.csv")
Distance = df['distance']
intensity = df['Gray_Value']
intensity_norm = (intensity - intensity.min())/ (intensity.max() - intensity.min())
x = Distance
y = intensity_norm
y2= np.full_like(intensity_norm, 1 / math.exp(2))
plt.plot(x, intensity_norm)
plt.axhline(y=1/math.exp(2), color='r', linestyle='-')
first_line = LineString(np.column_stack((x, y2)))
second_line = LineString(np.column_stack((x, y)))
intersection = first_line.intersection(second_line)
Inter = np.full_like(intersection, intersection)
.split(" ") to try to split by spaces.
2条答案
按热度按时间j2cgzkjk1#
假设你正在使用Python。
测试结果:
**编辑:**因为你看起来是在使用
shapely
,你可以遍历MultiPoint
对象的几何集合,直接提取x
的值。范例:
测试结果:
pgky5nke2#
有几种方法可以做到这一点。
这里有一种方法,使用 str.split 和 list comprehension。
您也可以使用 re 模块,并匹配这些值。
或者,您可以使用 enumerate 函数来遍历 string。
输出,截断。