MMF Contexts
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:
KeyboardInterruptsare 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 useCtrl-Cetc. to stop the loop without crashing your program. (If you really need to stop it immediately, you can send 3Ctrl-Cin rapid succession.)- 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.mdso PyPI has a description. No code changes.
REL: 0.1.1
- Added
README.mddocumentation. - 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)
| File | Size | Uploaded | |
|---|---|---|---|
| mmf_contexts-0.1.3.tar.gz | 19.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmf_contexts-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
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
|