Visualizing the motion energy filtersΒΆ

This example demonstrates how to display a motion energy filter from the pyramid.

import moten

pyramid = moten.pyramids.MotionEnergyPyramid(stimulus_vhsize=(768, 1024),
                                             stimulus_fps=24)
animation = pyramid.show_filter(1337)
aspect_ratio=1.33, centerh=0.14, centerv=0.11, direction=180.00,  filter_temporal_width=16.00, spatial_env=0.04, spatial_freq=16.00,  spatial_phase_offset=0.00, stimulus_fps=24.00, temporal_env=0.30,  temporal_freq=4.00,

The animation should look something like this:

These are the filter parameters:

from pprint import pprint
pprint(pyramid.filters[1337])

Out:

{'aspect_ratio': 1.3333333333333333,
 'centerh': 0.1416666666666666,
 'centerv': 0.10624999999999996,
 'direction': 180.0,
 'filter_temporal_width': 16.0,
 'spatial_env': 0.0375,
 'spatial_freq': 16.0,
 'spatial_phase_offset': 0.0,
 'stimulus_fps': 24.0,
 'temporal_env': 0.3,
 'temporal_freq': 4.0}

(Ignore this code block. It is needed to display the animation as a video on this website)

output = '../../docs/build/html/_downloads/example_moten_filter.mp4'
fig = animation._fig
title = 'Example filter:\ndirection of motion=180, spatial fq=16cpi, temporal fq=4Hz'
fig.suptitle(title)
animation.save(output)

# sphinx_gallery_thumbnail_number = 2
import matplotlib.pyplot as plt
spatial_component = pyramid.get_filter_spatial_quadrature(1337)[1]
fig, ax = plt.subplots()
ax.matshow(spatial_component, vmin=-1, vmax=1, cmap='coolwarm')
__ = ax.set_xticks([])
__ = ax.set_yticks([])
demo show filters

Total running time of the script: ( 0 minutes 3.372 seconds)

Gallery generated by Sphinx-Gallery