def testIntegrity(self): """ Make sure that this sensor does not modify the map object """ os = self.createSimpleOlfactionSensor() map = create_random_world(10) map_original = deepcopy(map) os.set_map(map) self.assertEqual(map, map_original)
def my_world_gen(): return create_random_world(radius=10)
def testWorldGeneration(self): """ Testing if we can parse the output of world generation utils """ sensor = Rangefinder() sensor.set_map(create_random_world(10))
def testIntegrity(self): """ Make sure that this sensor does not modify the map object """ map = create_random_world(10) map_original = deepcopy(map) self.raytracer.set_map(map) self.assertEqual(map, map_original)
def testPickling2(self): """ Pickling after map loading """ self.raytracer.set_map(create_random_world(10)) make_sure_pickable(self.raytracer)
from pybv.worlds import create_random_world from pybv.sensors import ImageRangeSensor from pybv.utils import RigidBodyState from numpy import deg2rad, linspace, pi from time import time world = create_random_world(radius=10) sensor = ImageRangeSensor(world=world) sensor.add_photoreceptors(linspace(-pi / 2, pi / 2, 100), spatial_sigma=deg2rad(5), sigma=0.01) sensor.add_photoreceptors(linspace(-pi / 6, pi / 6, 20), spatial_sigma=deg2rad(2), sigma=0.01) t0 = time(); ntrials = 100 for i in range(ntrials): rbs = RigidBodyState() answer = sensor.render(rbs) T = time() - t0 print answer print "Average time:", T / ntrials
def testPickling(self): """ Make sure that we are generating pickable structures (no lambdas) """ map = create_random_world(radius=10) make_sure_pickable(map)
def testPickling2(self): """ Pickling after map loading """ os = self.createSimpleOlfactionSensor() os.set_map(create_random_world(10)) os2 = make_sure_pickable(os) make_sure_pickable(os2)
def testRandomGeneration(self): """ Test if we can interpret a map from create_random_world() """ world = create_random_world(10) os = self.createSimpleOlfactionSensor() os.set_map(world) os.compute_observations(RigidBodyState())