Classical conditioning experiments of weakly electric fish Apteronotus albifrons
-- Benda Lab, University of Tübingen, Germany --
Context:
In [6]:
import nixio as nix
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from utils.notebook import print_stats
from utils.video_player import Playback
nix_file = nix.File.open('data/tracking_data.h5', nix.FileMode.ReadOnly)
print_stats(nix_file.blocks)
In [7]:
b = nix_file.blocks[0]
print_stats(b.data_arrays)
print_stats(b.multi_tags)
Movies are, depending on the number of color channels, stored as 3D, respectively 4D DataArrays.
In [9]:
video = [a for a in b.data_arrays if a.name == "video"][0]
In [ ]:
fig = plt.figure(facecolor='white', figsize=(1024 / 90, 768 / 90), dpi=90)
pb = Playback(fig,video)
pb.start()
Tracking data is stored as positions in the 4D Matrix, the fourth dimension specifies the time (frame) at which an objkect was tracked. Link between video data and position data is established using a MultiTag entity.
In [10]:
# get the tag linking tracking and video data
tag = [t for t in b.multi_tags if t.name == "tracking"][0]
In [5]:
fig = plt.figure(facecolor='white', figsize=(1024 / 90, 768 / 90), dpi=90)
pb = Playback(fig, video, tracking_tag=tag)
pb.start()
During tracking additional information, i.e. the fish's orientation, is gathered. For each position there is also an orientation. This information is stored as a Feature of the tracking.
In [ ]:
fig = plt.figure(facecolor='white', figsize=(1024 / 90, 768 / 90), dpi=90)
pb = Playback(fig, video, tracking_tag=tag, show_orientation=True)
pb.start()
In [ ]:
nix_file.close()
In [ ]: