def weighted_distances( dx=10, dy=10, c=(5,5)):
'''
Map with weighted distances to a point
args: Dimension maps and point
'''
a = np.zeros((dx,dy))
a[c]=1
indr = np.indices(a.shape)[0,:]
indc = np.indices(a.shape)[1,:]
difr = indr-c[0]
difc = indc-c[1]
map_diff = np.sqrt((difr**2)+(difc**2))
map_diff = 1.0 - (map_diff/ map_diff.flatten().max())
# Return inverse distance map
return map_diff
评论列表
文章目录