diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 05:10:07 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 05:10:07 +0000 |
commit | 95cc856e821ab0ac4936a8bfffdb133e627c5441 (patch) | |
tree | 5c256762bdf55e61f16d0fc55472af0c7bab19b9 | |
parent | 3a364f74cbcc82c63abec62451bbb135a698a204 (diff) |
automatic import of python-celluloidopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-celluloid.spec | 568 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 570 insertions, 0 deletions
@@ -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 + +[](https://travis-ci.com/jwkvam/celluloid) +[](https://codecov.io/gh/jwkvam/celluloid) +[](https://pypi.org/project/celluloid/) +[](https://pypi.org/project/celluloid/) + +Easy Matplotlib Animation + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/sines.py"> + <img src="https://user-images.githubusercontent.com/86304/48657442-9c11e080-e9e5-11e8-9f54-f46a960be7dd.gif"> + </a> +</p> + +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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/simple.py"> + <img src="https://user-images.githubusercontent.com/86304/48666133-66660980-ea70-11e8-9024-b167c21a5e83.gif"> + </a> +</p> + +### 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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/complex.py"> + <img src="https://user-images.githubusercontent.com/86304/48747098-f483f080-ec26-11e8-9734-c409e9b0c9ec.gif"> + </a> +</p> + +### 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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/complex.py"> + <img src="https://user-images.githubusercontent.com/86304/48750564-9100bf80-ec34-11e8-87fb-bc5c7ddcc6e7.gif"> + </a> +</p> + +## 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 + +[](https://travis-ci.com/jwkvam/celluloid) +[](https://codecov.io/gh/jwkvam/celluloid) +[](https://pypi.org/project/celluloid/) +[](https://pypi.org/project/celluloid/) + +Easy Matplotlib Animation + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/sines.py"> + <img src="https://user-images.githubusercontent.com/86304/48657442-9c11e080-e9e5-11e8-9f54-f46a960be7dd.gif"> + </a> +</p> + +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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/simple.py"> + <img src="https://user-images.githubusercontent.com/86304/48666133-66660980-ea70-11e8-9024-b167c21a5e83.gif"> + </a> +</p> + +### 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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/complex.py"> + <img src="https://user-images.githubusercontent.com/86304/48747098-f483f080-ec26-11e8-9734-c409e9b0c9ec.gif"> + </a> +</p> + +### 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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/complex.py"> + <img src="https://user-images.githubusercontent.com/86304/48750564-9100bf80-ec34-11e8-87fb-bc5c7ddcc6e7.gif"> + </a> +</p> + +## 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 + +[](https://travis-ci.com/jwkvam/celluloid) +[](https://codecov.io/gh/jwkvam/celluloid) +[](https://pypi.org/project/celluloid/) +[](https://pypi.org/project/celluloid/) + +Easy Matplotlib Animation + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/sines.py"> + <img src="https://user-images.githubusercontent.com/86304/48657442-9c11e080-e9e5-11e8-9f54-f46a960be7dd.gif"> + </a> +</p> + +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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/simple.py"> + <img src="https://user-images.githubusercontent.com/86304/48666133-66660980-ea70-11e8-9024-b167c21a5e83.gif"> + </a> +</p> + +### 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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/complex.py"> + <img src="https://user-images.githubusercontent.com/86304/48747098-f483f080-ec26-11e8-9734-c409e9b0c9ec.gif"> + </a> +</p> + +### 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() +``` + +<p align="center"> + <a href="https://github.com/jwkvam/celluloid/blob/master/examples/complex.py"> + <img src="https://user-images.githubusercontent.com/86304/48750564-9100bf80-ec34-11e8-87fb-bc5c7ddcc6e7.gif"> + </a> +</p> + +## 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 <Python_Bot@openeuler.org> - 0.2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +78da3ef8ff3944f253b16a923e427380 celluloid-0.2.0.tar.gz |