What is pymoten?
pymoten is a python package that provides a convenient way to extract motion energy features from video using a pyramid of spatio-temporal Gabor filters [1] [2]. The filters are created at multiple spatial and temporal frequencies, directions of motion, x-y positions, and sizes. Each filter quadrature-pair is convolved with the video and their activation energy is computed for each frame. These features provide a good basis to model brain responses to natural movies [3] [4].
Installation
Using pip, install the latest version from git:
pip install git+https://github.com/gallantlab/pymoten.git
Or the most recent release:
pip install pymoten
Getting started
Example using synthetic data
import moten
import numpy as np
# Generate synthetic data
nimages, vdim, hdim = (100, 90, 180)
noise_movie = np.random.randn(nimages, vdim, hdim)
# Create a pyramid of spatio-temporal gabor filters
pyramid = moten.get_default_pyramid(vhsize=(vdim, hdim), fps=24)
# Compute motion energy features
moten_features = pyramid.project_stimulus(noise_movie)
Simple example using a video file
import moten
# Stream and convert the RGB video into a sequence of luminance images
video_file = 'http://anwarnunez.github.io/downloads/avsnr150s24fps_tiny.mp4'
luminance_images = moten.io.video2luminance(video_file, nimages=100)
# Create a pyramid of spatio-temporal gabor filters
nimages, vdim, hdim = luminance_images.shape
pyramid = moten.get_default_pyramid(vhsize=(vdim, hdim), fps=24)
# Compute motion energy features
moten_features = pyramid.project_stimulus(luminance_images)
GPU acceleration
pymoten supports multiple computational backends. By default it runs on the CPU with NumPy, but it can also run on the GPU using PyTorch, which is much faster for large stimuli. The available backends are "numpy" (default), "torch", "torch_cuda" (NVIDIA GPUs), and "torch_mps" (Apple Silicon GPUs). The torch backends require PyTorch to be installed.
import moten
from moten.backend import set_backend
# Switch to a GPU backend (returns the backend module)
backend = set_backend("torch_cuda")
pyramid = moten.get_default_pyramid(vhsize=(vdim, hdim), fps=24)
# Move the stimulus onto the GPU, project, then bring the result back
stimulus_gpu = backend.asarray(luminance_images)
moten_features = pyramid.project_stimulus_batched(stimulus_gpu)
moten_features = backend.to_numpy(moten_features)
See the examples gallery for a complete walkthrough.
Cite as
Nunez-Elizalde AO, Deniz F, Dupré la Tour T, Visconti di Oleggio Castello M, and Gallant JL (2021). pymoten: scientific python package for computing motion energy features from video. Zenodo. https://doi.org/10.5281/zenodo.6349625
References
A MATLAB implementation can be found here.
Metadata
Release files for pymoten 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pymoten-0.1.3.tar.gz | 64.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymoten-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.8 kB
Release files / pymoten-0.1.3.tar.gz
| Download URL | pymoten-0.1.3.tar.gz |
|---|---|
| Size | 64.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c43e8185018bbea69add5e9624bc74bb6b7e9f02560561de3631bb6e23657c1d
|
|
BLAKE2b-256 checksum How to use checksums |
069b7eae11ebb64fdc5602671b9f67406066611790018a1f58284161163a2fb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency logRelease files / pymoten-0.1.3-py3-none-any.whl
| Download URL | pymoten-0.1.3-py3-none-any.whl |
|---|---|
| Size | 55.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ce81e3a76d3c737c5c5d7fad96d0bf768eb7e09f5f585c2cac5502e2312d65b
|
|
BLAKE2b-256 checksum How to use checksums |
ae261cf8c321fb6069e743d4116fbe02308f6fe743ca4109074d1bf87e8be8c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency log