diff --git a/doc/source/tutorials/examples/blenddemo_beesampling.py b/doc/source/tutorials/examples/blenddemo_beesampling.py index e0a6e1d77703ca6128aa2427efea364279ea5df3..09cda5bec9e53300bfe517da96fe9d3aa534732d 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 d689323d1bd0770871bed7e160dbf3b99d7ba63d..a1a71430b5db7d661b6158873d2a31db9693953d 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 d1a86f5360ce71170998de25cef1ec913c89700b..9c66ee80b65d7488f53dd330799b206e620f0829 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 d3173e6360a3eeeeffd356895771a31de79dad1d..5bb534f795ae0f566ba9f57c31944d8c6f45284c 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 a125a6313033121aa593d3cf0d694d71da7805bd..0b9ca987c9b6ff527a4d89eef2b8a4f5fba33db5 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 096018d6fd02019f12ab9afbf42b1252daf4e63c..e7b4b420a122427fd65fd96c8b785dcd6cfebadf 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 c1c95337abf5949684b6d79374a568096d01230d..6246e1fceb6562290c593d9272badb98cc880c9c 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 2c45dea553c744cb9838384e1c91ea48d40a1751..e20ab66c4c9f9bd443585dea990b3822b135224c 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)