2012-11-21 24 views
1
plt.plot(jd1,spd1) 
plt.plot(jd1,spd1,marker="o",markerfacecolor="r",linestyle='None') 
plt.show() 

print 'click on any obviously bad points and then press the enter key.' 
badpoints=ginput(n=0) 

index_badpoints=[] 
badpoints_num=len(badpoints) 
for i in range(len(badpoints)): 
    index_badpoints.append(int(np.interp(badpoints[i][0], 
              yeardays, 
              range(len(yeardays))))) 

print index_badpoints #always[107,107,107...] 

問題是我點擊任何一個點,我只能拿到其中指數法是107 有人可以幫助我弄清楚問題出點?如何獲得不同點在IPython中

+0

帖子'badpoints'和'yeardays'請 – inspectorG4dget

回答

1

我已經無法測試你的版本,但我可以告訴你我會怎麼解決這個問題:

badpoints = np.array(ginput(n=0)) 
index_badpoints = np.argmin(abs(np.subtract(badpoints[:,0],yeardays)),axis=1) 

此計算badpoints沿着從yeardays x軸的距離並返回索引最接近的一個。

+0

非常感謝你爲你的methods.It對我非常有幫助:) – wuwucat