Exemple #1
0
    aData = [msg[1].data for msg in aNearB]
    assert aData == [0,0,0,1,1,3,3]
    

@testme
def test_Live():
    comm.setLive(True)
    comm.setTimeout(1)
    
    topic = "test_Live"
    delTopic(topic)
    pub = FilePublisher(topic, "txt")
    sub = FileSubscriber(topic,"txt",ArrayMessage)
    
    msg = ArrayMessage(data = np.ones((100,100)))
    def func():
        print "publishing"
        pub.send(msg)
        print "done"
    pub_thread = threading.Thread(target=func)
    pub_thread.start()
    
    print "trying to receive"
    msg_recv = sub.recv()
    print "received"
    
    assert (msg_recv.data == msg.data).all()

if __name__ == "__main__":
    test_all(stop=True)
Exemple #2
0
from ransac import ransac, ConstantModel
import numpy as np
from utils import testing

@testing.testme
def test_ConstantModel():
    true_inliers = np.random.rand(10,3)
    true_outliers = np.zeros((3,3)) + 100
    data = np.concatenate([true_inliers, true_outliers])
    true_inlier_inds = np.arange(10,dtype=int)
    
    est_model, est_inlier_inds, est_error = ransac(data, ConstantModel, 1, 10, 1, 5)
    assert np.all(est_inlier_inds == true_inlier_inds)


if __name__ == "__main__":
    testing.test_all(stop=True)