.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/introduction/demo_show_filters.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_introduction_demo_show_filters.py: ======================================= Visualizing the motion energy filters ======================================= This example demonstrates how to display a motion energy filter from the pyramid. .. GENERATED FROM PYTHON SOURCE LINES 8-14 .. code-block:: default import moten pyramid = moten.pyramids.MotionEnergyPyramid(stimulus_vhsize=(768, 1024), stimulus_fps=24) animation = pyramid.show_filter(1337) .. image:: /auto_examples/introduction/images/sphx_glr_demo_show_filters_001.png :alt: 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, :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 15-22 The animation should look something like this: .. raw:: html .. GENERATED FROM PYTHON SOURCE LINES 24-25 These are the filter parameters: .. GENERATED FROM PYTHON SOURCE LINES 25-29 .. code-block:: default from pprint import pprint pprint(pyramid.filters[1337]) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none {'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} .. GENERATED FROM PYTHON SOURCE LINES 30-31 (*Ignore this code block. It is needed to display the animation as a video on this website*) .. GENERATED FROM PYTHON SOURCE LINES 31-44 .. code-block:: default 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([]) .. image:: /auto_examples/introduction/images/sphx_glr_demo_show_filters_002.png :alt: demo show filters :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 3.372 seconds) .. _sphx_glr_download_auto_examples_introduction_demo_show_filters.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_show_filters.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_show_filters.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_