del_between=raw_input('Do you want to delete all the points between two points? input "N" or "Y"')
if del_between=="N" or del_between=="n":
print "You have choosen NOT to delete all the points between two points."
if del_between=="Y" or del_between=="y" :
print "Please click the first bad point and the last bad point to choose the range of the bad points"
between_badpoints=ginput(n=2)
print between_badpoints
index_between_badpoints=[]
for i in range(len(between_badpoints)):
index_between_badpoints.append(int(np.interp(between_badpoints[i][0],jd2,range(len(jd2)))))
print index_between_badpoints
index_betweens=[]
for i in range(sorted(index_between_badpoints)[0],sorted(index_between_badpoints)[1]+1):
index_betweens.append(i)
print index_betweens
for i in index_betweens[::-1]:
del lat[i],lon[i],time[i],yeardays[i],depth[i],temp[i]
这个程序试图删除收集到的两点之间的所有点。问题是当我尝试运行这个程序时,它会显示分段错误。
当我单击选择点时,它会引发异常“分段错误”,所以我认为问题可能集中在这一行'between_badpoints = ginput(n = 2)'。但我不明白为什么它是错误的。
(我在同一个程序中使用过这个'ginput'命令并且效果很好,然后我删除了ginput变量并像这样再次使用它,它无法工作。)