From ce18b24a2a99507f690ca82ae577dccb6d323bca Mon Sep 17 00:00:00 2001
From: "Olivier J.N. Bertrand" <olivier.bertrand@uni-bielefeld.de>
Date: Wed, 7 Mar 2018 09:11:31 +0100
Subject: [PATCH] Correct for PEP8

---
 .../examples/blenddemo_beesampling.py         | 68 ++++++++++---------
 .../tutorials/examples/blenddemo_cyberbee.py  |  4 +-
 navipy/__init__.py                            |  1 -
 navipy/maths/__init__.py                      |  2 +-
 navipy/maths/euler.py                         |  5 +-
 navipy/maths/random.py                        |  2 +-
 navipy/maths/test_euler.py                    |  2 -
 .../maths/test_homogenous_transformations.py  |  4 --
 8 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/doc/source/tutorials/examples/blenddemo_beesampling.py b/doc/source/tutorials/examples/blenddemo_beesampling.py
index e0a6e1d..09cda5b 100644
--- a/doc/source/tutorials/examples/blenddemo_beesampling.py
+++ b/doc/source/tutorials/examples/blenddemo_beesampling.py
@@ -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()
diff --git a/doc/source/tutorials/examples/blenddemo_cyberbee.py b/doc/source/tutorials/examples/blenddemo_cyberbee.py
index d689323..a1a7143 100644
--- a/doc/source/tutorials/examples/blenddemo_cyberbee.py
+++ b/doc/source/tutorials/examples/blenddemo_cyberbee.py
@@ -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)
diff --git a/navipy/__init__.py b/navipy/__init__.py
index d1a86f5..9c66ee8 100644
--- a/navipy/__init__.py
+++ b/navipy/__init__.py
@@ -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:
diff --git a/navipy/maths/__init__.py b/navipy/maths/__init__.py
index d3173e6..5bb534f 100644
--- a/navipy/maths/__init__.py
+++ b/navipy/maths/__init__.py
@@ -1 +1 @@
-#package
+# package
diff --git a/navipy/maths/euler.py b/navipy/maths/euler.py
index a125a63..0b9ca98 100644
--- a/navipy/maths/euler.py
+++ b/navipy/maths/euler.py
@@ -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
diff --git a/navipy/maths/random.py b/navipy/maths/random.py
index 096018d..e7b4b42 100644
--- a/navipy/maths/random.py
+++ b/navipy/maths/random.py
@@ -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])
diff --git a/navipy/maths/test_euler.py b/navipy/maths/test_euler.py
index c1c9533..6246e1f 100644
--- a/navipy/maths/test_euler.py
+++ b/navipy/maths/test_euler.py
@@ -1,8 +1,6 @@
 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
 
 
diff --git a/navipy/maths/test_homogenous_transformations.py b/navipy/maths/test_homogenous_transformations.py
index 2c45dea..e20ab66 100644
--- a/navipy/maths/test_homogenous_transformations.py
+++ b/navipy/maths/test_homogenous_transformations.py
@@ -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)
-- 
GitLab