From 95cc856e821ab0ac4936a8bfffdb133e627c5441 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 05:10:07 +0000 Subject: automatic import of python-celluloid --- .gitignore | 1 + python-celluloid.spec | 568 ++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 570 insertions(+) create mode 100644 python-celluloid.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..9cab9e1 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/celluloid-0.2.0.tar.gz diff --git a/python-celluloid.spec b/python-celluloid.spec new file mode 100644 index 0000000..de35c00 --- /dev/null +++ b/python-celluloid.spec @@ -0,0 +1,568 @@ +%global _empty_manifest_terminate_build 0 +Name: python-celluloid +Version: 0.2.0 +Release: 1 +Summary: Easy matplotlib animation. +License: MIT License +URL: https://github.com/jwkvam/celluloid +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/0d/31/80e96c4b221de342eef55f1f07de84b11b5f7cfb8c3b00e235a0bdd0b476/celluloid-0.2.0.tar.gz +BuildArch: noarch + +Requires: python3-matplotlib + +%description +# celluloid + +[![Build Status](https://travis-ci.com/jwkvam/celluloid.svg?branch=master)](https://travis-ci.com/jwkvam/celluloid) +[![codecov](https://codecov.io/gh/jwkvam/celluloid/branch/master/graph/badge.svg)](https://codecov.io/gh/jwkvam/celluloid) +[![pypi](https://badge.fury.io/py/celluloid.svg)](https://pypi.org/project/celluloid/) +[![pypi versions](https://img.shields.io/pypi/pyversions/celluloid.svg)](https://pypi.org/project/celluloid/) + +Easy Matplotlib Animation + +

+ + + +

+ +Creating animations should be easy. +This module makes it easy to adapt your existing visualization code to create an animation. + +## Install + +``` +pip install celluloid +``` + +## Manual + +Follow these steps: + +1. Create a matplotlib `Figure` and create a `Camera` from it: + +```python +from celluloid import Camera +fig = plt.figure() +camera = Camera(fig) +``` + +2. Reusing the figure and after each frame is created, take a snapshot with the camera. + +```python +plt.plot(...) +plt.fancy_stuff() +camera.snap() +``` + +3. After all frames have been captured, create the animation. + +```python +animation = camera.animate() +animation.save('animation.mp4') +``` + +The entire [module](https://github.com/jwkvam/celluloid/blob/master/celluloid.py) is less than 50 lines of code. + +## Examples + +### Minimal + +As simple as it gets. + +```python +from matplotlib import pyplot as plt +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) +for i in range(10): + plt.plot([i] * 10) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +### Subplots + +Animation at the top. + +```python +import numpy as np +from matplotlib import pyplot as plt +from celluloid import Camera + +fig, axes = plt.subplots(2) +camera = Camera(fig) +t = np.linspace(0, 2 * np.pi, 128, endpoint=False) +for i in t: + axes[0].plot(t, np.sin(t + i), color='blue') + axes[1].plot(t, np.sin(t - i), color='blue') + camera.snap() +animation = camera.animate() +``` + +### Images + +Domain coloring example. + +```python +import numpy as np +from matplotlib import pyplot as plt +from matplotlib.colors import hsv_to_rgb + +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) + +for a in np.linspace(0, 2 * np.pi, 30, endpoint=False): + x = np.linspace(-3, 3, 800) + X, Y = np.meshgrid(x, x) + x = X + 1j * Y + y = (x ** 2 - 2.5) * (x - 2.5 * 1j) * (x + 2.5 * 1j) \ + * (x - 2 - 1j) ** 2 / ((x - np.exp(1j * a)) ** 2 + * (x - np.exp(1j * 2 * a)) ** 2) + + H = np.angle(y) / (2 * np.pi) + .5 + r = np.log2(1. + np.abs(y)) + S = (1. + np.abs(np.sin(2. * np.pi * r))) / 2. + V = (1. + np.abs(np.cos(2. * np.pi * r))) / 2. + + rgb = hsv_to_rgb(np.dstack((H, S, V))) + ax.imshow(rgb) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +### Legends + +```python +import matplotlib +from matplotlib import pyplot as plt +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) +for i in range(5): + t = plt.plot(range(i, i + 5)) + plt.legend(t, [f'line {i}']) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +## Limitations + +- The axes' limits should be the same for all plots. The limits of the animation will be the limits of the final plot. +- Legends will accumulate from previous frames. Pass the artists to the `legend` function to draw them separately. + +## Credits + +Inspired by [plotnine](https://github.com/has2k1/plotnine/blob/master/plotnine/animation.py). + + +%package -n python3-celluloid +Summary: Easy matplotlib animation. +Provides: python-celluloid +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-celluloid +# celluloid + +[![Build Status](https://travis-ci.com/jwkvam/celluloid.svg?branch=master)](https://travis-ci.com/jwkvam/celluloid) +[![codecov](https://codecov.io/gh/jwkvam/celluloid/branch/master/graph/badge.svg)](https://codecov.io/gh/jwkvam/celluloid) +[![pypi](https://badge.fury.io/py/celluloid.svg)](https://pypi.org/project/celluloid/) +[![pypi versions](https://img.shields.io/pypi/pyversions/celluloid.svg)](https://pypi.org/project/celluloid/) + +Easy Matplotlib Animation + +

+ + + +

+ +Creating animations should be easy. +This module makes it easy to adapt your existing visualization code to create an animation. + +## Install + +``` +pip install celluloid +``` + +## Manual + +Follow these steps: + +1. Create a matplotlib `Figure` and create a `Camera` from it: + +```python +from celluloid import Camera +fig = plt.figure() +camera = Camera(fig) +``` + +2. Reusing the figure and after each frame is created, take a snapshot with the camera. + +```python +plt.plot(...) +plt.fancy_stuff() +camera.snap() +``` + +3. After all frames have been captured, create the animation. + +```python +animation = camera.animate() +animation.save('animation.mp4') +``` + +The entire [module](https://github.com/jwkvam/celluloid/blob/master/celluloid.py) is less than 50 lines of code. + +## Examples + +### Minimal + +As simple as it gets. + +```python +from matplotlib import pyplot as plt +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) +for i in range(10): + plt.plot([i] * 10) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +### Subplots + +Animation at the top. + +```python +import numpy as np +from matplotlib import pyplot as plt +from celluloid import Camera + +fig, axes = plt.subplots(2) +camera = Camera(fig) +t = np.linspace(0, 2 * np.pi, 128, endpoint=False) +for i in t: + axes[0].plot(t, np.sin(t + i), color='blue') + axes[1].plot(t, np.sin(t - i), color='blue') + camera.snap() +animation = camera.animate() +``` + +### Images + +Domain coloring example. + +```python +import numpy as np +from matplotlib import pyplot as plt +from matplotlib.colors import hsv_to_rgb + +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) + +for a in np.linspace(0, 2 * np.pi, 30, endpoint=False): + x = np.linspace(-3, 3, 800) + X, Y = np.meshgrid(x, x) + x = X + 1j * Y + y = (x ** 2 - 2.5) * (x - 2.5 * 1j) * (x + 2.5 * 1j) \ + * (x - 2 - 1j) ** 2 / ((x - np.exp(1j * a)) ** 2 + * (x - np.exp(1j * 2 * a)) ** 2) + + H = np.angle(y) / (2 * np.pi) + .5 + r = np.log2(1. + np.abs(y)) + S = (1. + np.abs(np.sin(2. * np.pi * r))) / 2. + V = (1. + np.abs(np.cos(2. * np.pi * r))) / 2. + + rgb = hsv_to_rgb(np.dstack((H, S, V))) + ax.imshow(rgb) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +### Legends + +```python +import matplotlib +from matplotlib import pyplot as plt +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) +for i in range(5): + t = plt.plot(range(i, i + 5)) + plt.legend(t, [f'line {i}']) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +## Limitations + +- The axes' limits should be the same for all plots. The limits of the animation will be the limits of the final plot. +- Legends will accumulate from previous frames. Pass the artists to the `legend` function to draw them separately. + +## Credits + +Inspired by [plotnine](https://github.com/has2k1/plotnine/blob/master/plotnine/animation.py). + + +%package help +Summary: Development documents and examples for celluloid +Provides: python3-celluloid-doc +%description help +# celluloid + +[![Build Status](https://travis-ci.com/jwkvam/celluloid.svg?branch=master)](https://travis-ci.com/jwkvam/celluloid) +[![codecov](https://codecov.io/gh/jwkvam/celluloid/branch/master/graph/badge.svg)](https://codecov.io/gh/jwkvam/celluloid) +[![pypi](https://badge.fury.io/py/celluloid.svg)](https://pypi.org/project/celluloid/) +[![pypi versions](https://img.shields.io/pypi/pyversions/celluloid.svg)](https://pypi.org/project/celluloid/) + +Easy Matplotlib Animation + +

+ + + +

+ +Creating animations should be easy. +This module makes it easy to adapt your existing visualization code to create an animation. + +## Install + +``` +pip install celluloid +``` + +## Manual + +Follow these steps: + +1. Create a matplotlib `Figure` and create a `Camera` from it: + +```python +from celluloid import Camera +fig = plt.figure() +camera = Camera(fig) +``` + +2. Reusing the figure and after each frame is created, take a snapshot with the camera. + +```python +plt.plot(...) +plt.fancy_stuff() +camera.snap() +``` + +3. After all frames have been captured, create the animation. + +```python +animation = camera.animate() +animation.save('animation.mp4') +``` + +The entire [module](https://github.com/jwkvam/celluloid/blob/master/celluloid.py) is less than 50 lines of code. + +## Examples + +### Minimal + +As simple as it gets. + +```python +from matplotlib import pyplot as plt +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) +for i in range(10): + plt.plot([i] * 10) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +### Subplots + +Animation at the top. + +```python +import numpy as np +from matplotlib import pyplot as plt +from celluloid import Camera + +fig, axes = plt.subplots(2) +camera = Camera(fig) +t = np.linspace(0, 2 * np.pi, 128, endpoint=False) +for i in t: + axes[0].plot(t, np.sin(t + i), color='blue') + axes[1].plot(t, np.sin(t - i), color='blue') + camera.snap() +animation = camera.animate() +``` + +### Images + +Domain coloring example. + +```python +import numpy as np +from matplotlib import pyplot as plt +from matplotlib.colors import hsv_to_rgb + +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) + +for a in np.linspace(0, 2 * np.pi, 30, endpoint=False): + x = np.linspace(-3, 3, 800) + X, Y = np.meshgrid(x, x) + x = X + 1j * Y + y = (x ** 2 - 2.5) * (x - 2.5 * 1j) * (x + 2.5 * 1j) \ + * (x - 2 - 1j) ** 2 / ((x - np.exp(1j * a)) ** 2 + * (x - np.exp(1j * 2 * a)) ** 2) + + H = np.angle(y) / (2 * np.pi) + .5 + r = np.log2(1. + np.abs(y)) + S = (1. + np.abs(np.sin(2. * np.pi * r))) / 2. + V = (1. + np.abs(np.cos(2. * np.pi * r))) / 2. + + rgb = hsv_to_rgb(np.dstack((H, S, V))) + ax.imshow(rgb) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +### Legends + +```python +import matplotlib +from matplotlib import pyplot as plt +from celluloid import Camera + +fig = plt.figure() +camera = Camera(fig) +for i in range(5): + t = plt.plot(range(i, i + 5)) + plt.legend(t, [f'line {i}']) + camera.snap() +animation = camera.animate() +``` + +

+ + + +

+ +## Limitations + +- The axes' limits should be the same for all plots. The limits of the animation will be the limits of the final plot. +- Legends will accumulate from previous frames. Pass the artists to the `legend` function to draw them separately. + +## Credits + +Inspired by [plotnine](https://github.com/has2k1/plotnine/blob/master/plotnine/animation.py). + + +%prep +%autosetup -n celluloid-0.2.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-celluloid -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot - 0.2.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..f134aa4 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +78da3ef8ff3944f253b16a923e427380 celluloid-0.2.0.tar.gz -- cgit v1.2.3