def occupancy(grid, points, spacing=0.01):
    """Return a vector with the occupancy of each grid point for 
    given array of points"""
    distances = ((grid[:,None,:] - points[None,:,:])**2).sum(axis=2)
    occupied = (distances < spacing).sum(axis=1)
    return occupied
Return a vector with the occupancy of each grid point for 
    given array of points