Skip to main content

MMF Contexts

Documentation Status

This package provides a set of contexts to help working with Jupyter notebooks, especially producing animations, movies, and managing signals.

Usage

The main use-case is to do your work in an FPS context:

from mmf_contexts import FPS
for n in FPS(30, fps=10):
    print(n)

This adds the following functionality:

  1. KeyboardInterrupts are suspended during the loop body and will be processed each cycle. Thus, the actions in the loop are safe from being interrupted in a sensitive location. This allows you to use Ctrl-C etc. to stop the loop without crashing your program. (If you really need to stop it immediately, you can send 3 Ctrl-C in rapid succession.)
  2. The loop will be rate limited to a maximum of approximately 10 frames per second.

A nice use-case is to make movies. The following works well in Jupyter Notebooks:

%matplotlib
import numpy as np, matplotlib.pyplot as plt

from mmf_contexts import FPS

x = np.linspace(0, 1)
fs = np.linspace(1, 30)

fig, ax = plt.subplots()
for f in FPS(fs, display=fig, embed=True, filename="mymovie.mp4"):
    ax.cla()
    ax.plot(x, np.sin(f*x))

This will make an animation while running in the Jupyter notebook, then embed this animation as a movie so you can view it even if the notebook is running. Finally, it will also save the animation to the file mymovie.mp4.

To Do: This does not yet work with standard IPython terminals since it relies on display. Support for more general use-cases is a work in progress.

.. include:: Notes.md .. include:: Docs/Animation.md

Change Log

REL: 0.1.2

  • Just add README.md so PyPI has a description. No code changes.

REL: 0.1.1

  • Added README.md documentation.
  • Fixed bug with Jupyter Notebooks and movies (missing MovieWriter). *(We need to find a good way of automating tests with Jupyter notbeook.)
  • Fixed links to docs etc.

REL: 0.1.0

Initial release. Attempted to upload this as animate to PyPI, but this is not allowed, so we are renaming it mmf-contexts.

Metadata

Release files for mmf-contexts 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mmf-contexts 0.1.3
File Size Uploaded Provenance Actions
mmf_contexts-0.1.3.tar.gz 19.8 kB Without provenance Details for mmf_contexts-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mmf-contexts 0.1.3
File Interpreter ABI Platform Actions
mmf_contexts-0.1.3-py3-none-any.whl Python 3 none any Details for mmf_contexts-0.1.3-py3-none-any.whl

Total release size: 34.2 kB

Release files / mmf_contexts-0.1.3.tar.gz

Download URL mmf_contexts-0.1.3.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1e9be2c2a8199e5c7800e066b081d18822fdfcb613d931ef8498bd14691ae4a2
BLAKE2b-256 checksum
How to use checksums
d87f770d2902382824611882c9faac4a562187f0e26df2d56ac45047fde325aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.28.0 CPython/3.11.13 Darwin/23.6.0

Release files / mmf_contexts-0.1.3-py3-none-any.whl

Download URL mmf_contexts-0.1.3-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aefeb7cdcbe874777d56fa3baa1ef506d2250123fbc606f5d93385bcb5605dfb
BLAKE2b-256 checksum
How to use checksums
5d23a429191b740bdceb7e0fec68cf817e117567b8806ff08deb27847d145551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.28.0 CPython/3.11.13 Darwin/23.6.0

Security for mmf-contexts 0.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page