Skip to content
Snippets Groups Projects
Commit 2947bfce authored by Olivier J.N. Bertrand's avatar Olivier J.N. Bertrand
Browse files

Update the doc of database

parent 97f320f1
No related branches found
No related tags found
No related merge requests found
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from navipy.database import DataBaseLoad
import pkg_resources
# 1) Connect to the database
mydb_filename = pkg_resources.resource_filename(
'navipy', 'resources/database.db')
mydb = DataBaseLoad(mydb_filename)
posorients = mydb.posorients
posorients.head(n=5)
......@@ -2,11 +2,12 @@ import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from navipy.database import DataBaseLoad
import os
import pkg_resources
# 1) Connect to the database
mydb_filename = os.path.abspath('../database.db')
mydb_filename = pkg_resources.resource_filename(
'navipy', 'resources/database.db')
mydb = DataBaseLoad(mydb_filename)
# 2) Define the position-orinetation at which
# we want the image
......@@ -19,7 +20,8 @@ posorient.alpha_0 = np.pi / 2
posorient.alpha_1 = 0
posorient.alpha_2 = 0
# 3) Load the image
image = mydb.read_image(posorient=posorient)
image = mydb.scene(posorient=posorient)
image = image[...,0]
# 4) plot the image
to_plot_im = image[:, :, :3]
to_plot_im -= to_plot_im.min()
......
import numpy as np
import matplotlib.pyplot as plt
from navipy.database import DataBaseLoad
import os
import pkg_resources
# 1) Connect to the database
mydb_filename = os.path.abspath('../database.db')
mydb_filename = pkg_resources.resource_filename(
'navipy', 'resources/database.db')
mydb = DataBaseLoad(mydb_filename)
# 2) Define the position-orinetation at which
# we want the image
rowid = 12
# 3) Load the image
image = mydb.read_image(rowid=rowid)
image = mydb.scene(rowid=rowid)
image = image[...,0]
# 4) plot the image
to_plot_im = image[:, :, :3]
to_plot_im -= to_plot_im.min()
......
Moving
======
Moving on a grid
----------------
.. automodule:: navipy.moving
Moving between grid points
--------------------------
Interpolation of neighbouring images
.. autoclass:: navipy.moving.agent.CyberBeeAgent
:members:
.. autoclass:: navipy.moving.agent.GridAgent
:members:
.. autoclass:: navipy.moving.agent.GraphAgent
:members:
......@@ -13,11 +13,8 @@ are normalised, so to use the full coding range.
How to load a database
----------------------
.. code-block:: python
from database import DataBaseLoad
mydb_filename = 'database.db'
mydb = DataBaseLoad(mydb_filename)
.. literalinclude:: example/database/get_posorients.py
:lines: 11
How to load all position-orientation
------------------------------------
......@@ -28,10 +25,10 @@ situation, it may be usefull to know all \
position-orientation in the database. More technically \
speaking, loading the full table of position-orientaiton.
.. code-block:: python
.. literalinclude:: example/database/get_posorients.py
:lines: 12-13
posorients = mydb.get_posorients()
posorients.head()
.. plot:: example/database/get_posorients.py
How to load an image
--------------------
......@@ -44,17 +41,8 @@ the position-orientation can be given. The DataBaseLoader will \
look if this position-orientation has been rendered. If it is \
the case, the image will be returned.
.. code-block:: python
posorient = pd.Series(index=['x', 'y', 'z',
'alpha_0', 'alpha_1', 'alpha_2'])
posorient.x = -0.6
posorient.y = -7.2
posorient.z = 2.35
posorient.alpha_0 = np.pi / 2
posorient.alpha_1 = 0
posorient.alpha_2 = 0
image = mydb.read_image(posorient=posorient)
.. literalinclude:: example/database/load_image_posorient.py
:lines: 14-23
.. plot:: example/database/load_image_posorient.py
......@@ -65,15 +53,12 @@ Indeed each position-orientation can be identified by a unique row \
number. This number is consistant through the entire database. Thus, \
an image can be loaded by providing the row number.
.. code-block:: python
rowid = 1000
image = mydb.read_image(rowid=rowid)
.. literalinclude:: example/database/load_image_rowid.py
:lines: 13-15
.. plot:: example/database/load_image_rowid.py
.. todo: channels as part of database
"""
......
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