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
# create a bee sampling
cyberbee = BlenderRender()
cyberbee.cycle_samples = 100 # higher value -> slower but nicer
cyberbee.cycle_samples = 100 # higher value -> slower but nicer
bee_samp = BeeSampling(cyberbee)
# Create a list of point from which we want to render images
# Careful three d meshing grow quickly.
......@@ -41,52 +41,56 @@ mydb = DataBaseLoad(filename_db)
# Plot a view of db
posorients = mydb.posorients
posorient = posorients.loc[1,:]
f, axarr = plt.subplots(3,3,figsize=(15,10))
ax=axarr[1][1]
ax.plot(posorients.x,posorients.y,'ko')
posorient = posorients.loc[1, :]
f, axarr = plt.subplots(3, 3, figsize=(15, 10))
ax = axarr[1][1]
ax.plot(posorients.x, posorients.y, 'ko')
ax.set_xlabel('x')
ax.set_ylabel('y')
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_y = posorients.y.unique()
for i,axar in enumerate(axarr):
for i, axar in enumerate(axarr):
for j, ax in enumerate(axar):
if j==1 and i==1:
if j == 1 and i == 1:
continue
posorient.x=unique_x[j]
posorient.y=unique_y[i]
posorient.x = unique_x[j]
posorient.y = unique_y[i]
scene = mydb.scene(posorient)
to_plot_im = scene[:, :, :3,0]
to_plot_im = scene[:, :, :3, 0]
ax.imshow(to_plot_im)
ax.invert_yaxis()
ax.set_aspect('equal')
ax.get_xaxis().set_ticks([])
ax.get_yaxis().set_ticks([])
ax.set_title('Panorama at ({},{})'.format(posorient.x,posorient.y))
xyA=[0,0]
if j==0:
xyA[0]=to_plot_im.shape[1]
elif j==1:
xyA[0]=to_plot_im.shape[1]//3
elif j==2:
xyA[0]=0
print(i,j,posorient.x,posorient.y)
if i==0:
xyA[1]=0
elif i==1:
xyA[1]=to_plot_im.shape[0]//3
elif i==2:
xyA[1]=to_plot_im.shape[0]
con = ConnectionPatch(xyA=xyA, xyB=(posorient.x,posorient.y), coordsA="data", coordsB="data",
axesA=ax, axesB=axarr[1][1], color="black")
ax.set_title('Panorama at ({},{})'.format(posorient.x, posorient.y))
xyA = [0, 0]
if j == 0:
xyA[0] = to_plot_im.shape[1]
elif j == 1:
xyA[0] = to_plot_im.shape[1] // 3
elif j == 2:
xyA[0] = 0
print(i, j, posorient.x, posorient.y)
if i == 0:
xyA[1] = 0
elif i == 1:
xyA[1] = to_plot_im.shape[0] // 3
elif i == 2:
xyA[1] = to_plot_im.shape[0]
con = ConnectionPatch(xyA=xyA,
xyB=(posorient.x, posorient.y),
coordsA="data", coordsB="data",
axesA=ax, axesB=axarr[1][1],
color="black")
ax.add_artist(con)
for i,axar in enumerate(axarr):
for i, axar in enumerate(axarr):
axar[0].set_ylabel('Elevation')
for i,axar in enumerate(axarr.transpose()):
for i, axar in enumerate(axarr.transpose()):
axar[-1].set_xlabel('Azimuth')
f.show()
......
......@@ -25,8 +25,8 @@ scene = cyberbee.scene(posorient)
# plot
f, axarr = plt.subplots(2, 1, sharex=True)
to_plot_im = scene[:, :, :3,0]
to_plot_dist = 1 / scene[:, :, 3,0]
to_plot_im = scene[:, :, :3, 0]
to_plot_dist = 1 / scene[:, :, 3, 0]
ax = axarr[0]
ax.imshow(to_plot_im)
......
......@@ -38,7 +38,6 @@ An agent using an average skyline homing vector, could be build as follow
"""
from navipy.database import DataBaseLoad
import numpy as np
class Bunch:
......
#package
# package
......@@ -64,8 +64,9 @@ def from_matrix(matrix, axes='sxyz'):
Note that many Euler angle triplets can describe one matrix.
"""
try:
firstaxis, parity, repetition, frame = constants._AXES2TUPLE[axes.lower(
)]
firstaxis, parity, \
repetition, frame = constants._AXES2TUPLE[axes.lower(
)]
except (AttributeError, KeyError):
constants._TUPLE2AXES[axes] # validation
firstaxis, parity, repetition, frame = axes
......
......@@ -46,4 +46,4 @@ def quaternion(rand=None):
t1 = pi2 * rand[1]
t2 = pi2 * rand[2]
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 numpy as np
import navipy.maths.random as random
import navipy.maths.euler as euler
from navipy.maths.tools import vector_norm
import navipy.maths.constants as constants
......
......@@ -137,11 +137,8 @@ class TestHT(unittest.TestCase):
def test_projection_matrix(self):
point = 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
projection_0 = ht.projection_matrix(point, normal)
projection_1 = ht.projection_matrix(point, normal,
direction=direct)
projection_2 = ht.projection_matrix(point, normal,
perspective=persp)
projection_3 = ht.projection_matrix(point, normal,
......@@ -184,7 +181,6 @@ class TestHT(unittest.TestCase):
def test_projection_from_matrix_persp_pseudo_true(self):
point = 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
projection_0 = ht.projection_matrix(point, normal, persp,
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