Skip to content
Snippets Groups Projects
ridf.py 893 B
import numpy as np
import matplotlib.pyplot as plt
from navipy.database import DataBaseLoad
from navipy.comparing import rot_imagediff
import pkg_resources


# 1) Connect to the database
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 and get the scene
rowid = 12
my_scene_memory = mydb.scene(rowid=rowid)
rowid = 1
my_scene_current = mydb.scene(rowid=rowid)

# Calculate image rot diff
rotdf = rot_imagediff(my_scene_current, my_scene_memory)
rotdf = np.roll(rotdf, 180, axis=0)
f, axarr = plt.subplots(1, 2, figsize=(15, 4))
for chan_i, chan_n in enumerate(mydb.channels):
    if chan_n == 'D':
        color = 'k'
        ax = axarr[1]
    else:
        color = chan_n
        ax = axarr[0]
    ax.plot(rotdf[:, chan_i], color=color)

    
f.show()