本文整理汇总了Python中location.Location.getXY方法的典型用法代码示例。如果您正苦于以下问题:Python Location.getXY方法的具体用法?Python Location.getXY怎么用?Python Location.getXY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location.Location
的用法示例。
在下文中一共展示了Location.getXY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateGrids
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import getXY [as 别名]
def updateGrids(self, ca1grids, ca1hd, b_odom, N_mazeSize, dictGrids):
loc=Location()
loc.setGrids(ca1grids, dictGrids)
(x_hat_prev, y_hat_prev) = loc.getXY()
## Hard coded again here North negative.....
dxys = [[1,0],[0,1],[-1,0],[0,-1]] #by hd cell
ihd = argmax(ca1hd)
odom_dir = dxys[ihd]
odom = [0,0]
if b_odom:
odom=odom_dir
x_hat_now = x_hat_prev + odom[0]
y_hat_now = y_hat_prev + odom[1]
##SMART UPDATE -- if odom took us outside the maze, then ignore it
#pdb.set_trace()
##if this takes me to somewhere not having a '3'(=N_mazeSize) in the coordinate, then the move was illegal?
if sum( (x_hat_now==N_mazeSize) + (y_hat_now==N_mazeSize))==0:
print "OFFMAZE FIX: OLD:" ,x_hat_now, y_hat_now
x_hat_now = x_hat_prev
y_hat_now = y_hat_prev
print "NEW:",x_hat_now, y_hat_now
x_hat_now = crop(x_hat_now, 0, 2*N_mazeSize)
y_hat_now = crop(y_hat_now, 0, 2*N_mazeSize) #restrict to locations in the maze
loc=Location()
loc.setXY(x_hat_now, y_hat_now)
#self.placeCells=zeros(ca1placeCells.shape)
#self.placeCells[loc.placeId] = 1
self.grids = loc.getGrids().copy()
示例2: plotResults
# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import getXY [as 别名]
def plotResults(path, hist, dictGrids, b_useNewDG, learningRate, note=""):
str_title = hist.str_title + "\nDG: %s learningRate: %f" % (b_useNewDG, learningRate )
plt.figure()
T=len(hist.ca1s)
xys_bel = np.zeros((T,2))
ihds_bel = np.zeros((T,1))
N_places = (1+2*path.N_mazeSize)**2
for t in range(0,T):
loc=Location()
loc.setGrids(hist.ca1s[t].grids, dictGrids)
xys_bel[t,:] = loc.getXY()
ihds_bel[t] = np.argmax(hist.ca1s[t].hd)
#plt.subplot(4,2, (b_col2)+1)
plt.subplot(4,1, 1)
plt.plot(0.1+xys_bel[:,0], 'b')
plt.hold(True)
plt.plot(path.posLog[:,0], 'k')
plt.ylabel('x location')
plt.title(str_title)
# plt.subplot(4,2, (b_col2)+3)
plt.subplot(4,1, 2)
plt.plot(0.1+xys_bel[:,1], 'b')
plt.hold(True)
plt.plot(path.posLog[:,1], 'k')
plt.ylabel('y location')
#head directions
# plt.subplot(4,2, (b_col2)+5)
plt.subplot(4,1, 3)
plt.plot(path.posLog[:,2], 'k') #ground truth
plt.plot(ihds_bel, 'b') #EC HD cells
plt.ylabel('Heading')
# plt.subplot(4,2, (b_col2)+7)
plt.subplot(4,1, 4)
plt.plot(hist.sub_errs, 'y')
plt.hold(True)
plt.plot(5*hist.sub_fires, 'b')
plt.plot(hist.sub_ints, 'r')
plt.ylim(0,1)
plt.ylabel('Subiculum activation')
plt.xlabel('time')
b_losts = (np.sum(xys_bel!=path.posLog[:,0:2], 1)!=0)
# COMMENTED OUT SAVING AS THE PATH IS BUGGY IN NOTEBOOK
#str = "Results/run_"+hist.str_title+"LR_%d_DG_%s_%s.eps" % (learningRate*1000, b_useNewDG, note)
#plt.savefig(str)
return (b_losts, xys_bel)