Ejemplo n.º 1
0
 def plot (self, ax, *args, **kwargs):
     ax.plot (self.xy[:,1], self.xy[:,0], *args, **kwargs)
     for xy,cov in zip (self.xy, self.cov):
         sig = cov.reshape ((2,2))
         draw_covariance (ax, xy, sig, 9., *args, **kwargs)
Ejemplo n.º 2
0
    dy = xy_client[:,1] - xy_server[:,1]
    dist = (dy**2.+dx**2.)**(1./2)
    print dist
    ii_max = np.argmax (dist)
    print 'mean norm diff between poses = ', dist.mean ()
    print 'max norm diff between poses = ', dist.max ()
    
    # plot it all
    fig = plt.figure ()
    ax = fig.add_subplot (111)

    ax.plot (server_nodes.mu[:,1], server_nodes.mu[:,0], 'b-', lw=0.5)
    ax.plot (xy_server[:,1], xy_server[:,0], 'b.-', label='server', lw=2)
    for xy,cov in zip (xy_server, cov_server):
        sig = cov.reshape ((2,2))
        draw_covariance (ax, xy, sig, 9., 'b', lw=2)

    #ii = np.where (client_nodes.id > 500)[0]
    #ax.plot (client_nodes.mu[ii,1], client_nodes.mu[ii,0], 'r-')

    ax.plot (xy_client[:,1], xy_client[:,0], 'r.-', label='client', lw=1)
    for xy,cov in zip (xy_client, cov_client):
        sig = cov.reshape ((2,2))
        draw_covariance (ax, xy, sig, 9., 'r', lw=1)

    ax.legend (numpoints=1)
    ax.axis ('equal')
    ax.grid ()

    plt.show ()