Skip to content
Snippets Groups Projects
Commit ce18b24a authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Correct for PEP8

parent 58b4b076
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ from navipy.sensors.renderer import BlenderRender ...@@ -13,7 +13,7 @@ from navipy.sensors.renderer import BlenderRender
# create a bee sampling # create a bee sampling
cyberbee = BlenderRender() cyberbee = BlenderRender()
cyberbee.cycle_samples = 100 # higher value -> slower but nicer cyberbee.cycle_samples = 100 # higher value -> slower but nicer
bee_samp = BeeSampling(cyberbee) bee_samp = BeeSampling(cyberbee)
# Create a list of point from which we want to render images # Create a list of point from which we want to render images
# Careful three d meshing grow quickly. # Careful three d meshing grow quickly.
...@@ -41,52 +41,56 @@ mydb = DataBaseLoad(filename_db) ...@@ -41,52 +41,56 @@ mydb = DataBaseLoad(filename_db)
# Plot a view of db # Plot a view of db
posorients = mydb.posorients posorients = mydb.posorients
posorient = posorients.loc[1,:] posorient = posorients.loc[1, :]
f, axarr = plt.subplots(3,3,figsize=(15,10)) f, axarr = plt.subplots(3, 3, figsize=(15, 10))
ax=axarr[1][1] ax = axarr[1][1]
ax.plot(posorients.x,posorients.y,'ko') ax.plot(posorients.x, posorients.y, 'ko')
ax.set_xlabel('x') ax.set_xlabel('x')
ax.set_ylabel('y') ax.set_ylabel('y')
ax.set_aspect('equal') ax.set_aspect('equal')
ax.text(0,2.5,'Top view of the grid',horizontalalignment='center',fontsize=15) ax.text(0, 2.5, 'Top view of the grid',
horizontalalignment='center', fontsize=15)
unique_x = posorients.x.unique()[::-1] unique_x = posorients.x.unique()[::-1]
unique_y = posorients.y.unique() unique_y = posorients.y.unique()
for i,axar in enumerate(axarr): for i, axar in enumerate(axarr):
for j, ax in enumerate(axar): for j, ax in enumerate(axar):
if j==1 and i==1: if j == 1 and i == 1:
continue continue
posorient.x=unique_x[j] posorient.x = unique_x[j]
posorient.y=unique_y[i] posorient.y = unique_y[i]
scene = mydb.scene(posorient) scene = mydb.scene(posorient)
to_plot_im = scene[:, :, :3,0] to_plot_im = scene[:, :, :3, 0]
ax.imshow(to_plot_im) ax.imshow(to_plot_im)
ax.invert_yaxis() ax.invert_yaxis()
ax.set_aspect('equal') ax.set_aspect('equal')
ax.get_xaxis().set_ticks([]) ax.get_xaxis().set_ticks([])
ax.get_yaxis().set_ticks([]) ax.get_yaxis().set_ticks([])
ax.set_title('Panorama at ({},{})'.format(posorient.x,posorient.y)) ax.set_title('Panorama at ({},{})'.format(posorient.x, posorient.y))
xyA=[0,0] xyA = [0, 0]
if j==0: if j == 0:
xyA[0]=to_plot_im.shape[1] xyA[0] = to_plot_im.shape[1]
elif j==1: elif j == 1:
xyA[0]=to_plot_im.shape[1]//3 xyA[0] = to_plot_im.shape[1] // 3
elif j==2: elif j == 2:
xyA[0]=0 xyA[0] = 0
print(i,j,posorient.x,posorient.y) print(i, j, posorient.x, posorient.y)
if i==0: if i == 0:
xyA[1]=0 xyA[1] = 0
elif i==1: elif i == 1:
xyA[1]=to_plot_im.shape[0]//3 xyA[1] = to_plot_im.shape[0] // 3
elif i==2: elif i == 2:
xyA[1]=to_plot_im.shape[0] xyA[1] = to_plot_im.shape[0]
con = ConnectionPatch(xyA=xyA, xyB=(posorient.x,posorient.y), coordsA="data", coordsB="data", con = ConnectionPatch(xyA=xyA,
axesA=ax, axesB=axarr[1][1], color="black") xyB=(posorient.x, posorient.y),
coordsA="data", coordsB="data",
axesA=ax, axesB=axarr[1][1],
color="black")
ax.add_artist(con) ax.add_artist(con)
for i,axar in enumerate(axarr): for i, axar in enumerate(axarr):
axar[0].set_ylabel('Elevation') axar[0].set_ylabel('Elevation')
for i,axar in enumerate(axarr.transpose()): for i, axar in enumerate(axarr.transpose()):
axar[-1].set_xlabel('Azimuth') axar[-1].set_xlabel('Azimuth')
f.show() f.show()
......
...@@ -25,8 +25,8 @@ scene = cyberbee.scene(posorient) ...@@ -25,8 +25,8 @@ scene = cyberbee.scene(posorient)
# plot # plot
f, axarr = plt.subplots(2, 1, sharex=True) f, axarr = plt.subplots(2, 1, sharex=True)
to_plot_im = scene[:, :, :3,0] to_plot_im = scene[:, :, :3, 0]
to_plot_dist = 1 / scene[:, :, 3,0] to_plot_dist = 1 / scene[:, :, 3, 0]
ax = axarr[0] ax = axarr[0]
ax.imshow(to_plot_im) ax.imshow(to_plot_im)
......
...@@ -38,7 +38,6 @@ An agent using an average skyline homing vector, could be build as follow ...@@ -38,7 +38,6 @@ An agent using an average skyline homing vector, could be build as follow
""" """
from navipy.database import DataBaseLoad from navipy.database import DataBaseLoad
import numpy as np
class Bunch: class Bunch:
......
#package # package
...@@ -64,8 +64,9 @@ def from_matrix(matrix, axes='sxyz'): ...@@ -64,8 +64,9 @@ def from_matrix(matrix, axes='sxyz'):
Note that many Euler angle triplets can describe one matrix. Note that many Euler angle triplets can describe one matrix.
""" """
try: try:
firstaxis, parity, repetition, frame = constants._AXES2TUPLE[axes.lower( firstaxis, parity, \
)] repetition, frame = constants._AXES2TUPLE[axes.lower(
)]
except (AttributeError, KeyError): except (AttributeError, KeyError):
constants._TUPLE2AXES[axes] # validation constants._TUPLE2AXES[axes] # validation
firstaxis, parity, repetition, frame = axes firstaxis, parity, repetition, frame = axes
......
...@@ -46,4 +46,4 @@ def quaternion(rand=None): ...@@ -46,4 +46,4 @@ def quaternion(rand=None):
t1 = pi2 * rand[1] t1 = pi2 * rand[1]
t2 = pi2 * rand[2] t2 = pi2 * rand[2]
return np.array([np.cos(t2) * r2, np.sin(t1) * r1, return np.array([np.cos(t2) * r2, np.sin(t1) * r1,
np.cos(t1) * r1, np.sin(t2) * r2]) np.cos(t1) * r1, np.sin(t2) * r2])
import unittest import unittest
import numpy as np import numpy as np
import navipy.maths.random as random
import navipy.maths.euler as euler import navipy.maths.euler as euler
from navipy.maths.tools import vector_norm
import navipy.maths.constants as constants import navipy.maths.constants as constants
......
...@@ -137,11 +137,8 @@ class TestHT(unittest.TestCase): ...@@ -137,11 +137,8 @@ class TestHT(unittest.TestCase):
def test_projection_matrix(self): def test_projection_matrix(self):
point = np.random.random(3) - 0.5 point = np.random.random(3) - 0.5
normal = np.random.random(3) - 0.5 normal = np.random.random(3) - 0.5
direct = np.random.random(3) - 0.5
persp = np.random.random(3) - 0.5 persp = np.random.random(3) - 0.5
projection_0 = ht.projection_matrix(point, normal) projection_0 = ht.projection_matrix(point, normal)
projection_1 = ht.projection_matrix(point, normal,
direction=direct)
projection_2 = ht.projection_matrix(point, normal, projection_2 = ht.projection_matrix(point, normal,
perspective=persp) perspective=persp)
projection_3 = ht.projection_matrix(point, normal, projection_3 = ht.projection_matrix(point, normal,
...@@ -184,7 +181,6 @@ class TestHT(unittest.TestCase): ...@@ -184,7 +181,6 @@ class TestHT(unittest.TestCase):
def test_projection_from_matrix_persp_pseudo_true(self): def test_projection_from_matrix_persp_pseudo_true(self):
point = np.random.random(3) - 0.5 point = np.random.random(3) - 0.5
normal = np.random.random(3) - 0.5 normal = np.random.random(3) - 0.5
direct = np.random.random(3) - 0.5
persp = np.random.random(3) - 0.5 persp = np.random.random(3) - 0.5
projection_0 = ht.projection_matrix(point, normal, persp, projection_0 = ht.projection_matrix(point, normal, persp,
pseudo=True) pseudo=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment