Skip to content

Commit 0754253

Browse files
author
Matthias Koeppe
committed
src/sage/plot/animate.py: Reformat
1 parent e4e0926 commit 0754253

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/sage/plot/animate.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@
8787
....: (x, -2, 2), (y, -2, 2), (z, -2, 2),
8888
....: plot_points=60, contour=[1,3,5],
8989
....: region=lambda x,y,z: x<=t or y>=t or z<=t)
90-
sage: a = animate([frame(t)
91-
....: for t in srange(.01,1.5,.2)])
90+
sage: a = animate([frame(t) for t in srange(.01, 1.5, .2)])
9291
sage: a[0] # long time
9392
Graphics3d Object
9493
sage: a.show() # long time # optional -- ImageMagick
@@ -99,8 +98,7 @@
9998
illustrated by the following example::
10099
101100
sage: t = SR.var("t")
102-
sage: a = animate((sin(c*pi*t)
103-
....: for c in sxrange(1, 2, .2)))
101+
sage: a = animate((sin(c*pi*t) for c in sxrange(1, 2, .2)))
104102
sage: a.show() # long time # optional -- ImageMagick
105103
106104
@@ -149,8 +147,7 @@ def animate(frames, **kwds):
149147
EXAMPLES::
150148
151149
sage: t = SR.var("t")
152-
sage: a = animate((cos(c*pi*t)
153-
....: for c in sxrange(1, 2, .2)))
150+
sage: a = animate((cos(c*pi*t) for c in sxrange(1, 2, .2)))
154151
sage: a.show() # long time # optional -- ImageMagick
155152
156153
See also :mod:`sage.plot.animate` for more examples.
@@ -163,7 +160,6 @@ class Animation(WithEqualityById, SageObject):
163160
164161
INPUT:
165162
166-
167163
- ``v`` -- iterable of Sage objects. These should preferably be
168164
graphics objects, but if they aren't, then :meth:`make_image` is
169165
called on them.
@@ -178,8 +174,7 @@ class Animation(WithEqualityById, SageObject):
178174
EXAMPLES::
179175
180176
sage: x = SR.var("x")
181-
sage: a = animate([sin(x + float(k))
182-
....: for k in srange(0, 2*pi, 0.3)],
177+
sage: a = animate([sin(x + float(k)) for k in srange(0, 2*pi, 0.3)],
183178
....: xmin=0, xmax=2*pi, figsize=[2,1])
184179
sage: print(a)
185180
Animation with 21 frames
@@ -533,7 +528,7 @@ def graphics_array(self, ncols=3):
533528
sage: a = animate(v, xmin=0, ymin=0, axes=False)
534529
sage: print(a)
535530
Animation with 3 frames
536-
sage: a.show() # optional - imagemagick
531+
sage: a.show() # optional -- ImageMagick
537532
538533
Modify the default arrangement of array::
539534
@@ -615,7 +610,7 @@ def gif(self, delay=20, savefile=None, iterations=0, show_path=False,
615610
sage: a.gif(savefile=td + 'my_animation.gif', # long time # optional -- ImageMagick
616611
....: show_path=True)
617612
Animation saved to .../my_animation.gif.
618-
sage: a.gif(savefile=td + 'my_animation_2.gif', # long time # optional -- ffmpeg
613+
sage: a.gif(savefile=td + 'my_animation_2.gif', # long time # optional -- FFmpeg
619614
....: show_path=True, use_ffmpeg=True)
620615
Animation saved to .../my_animation_2.gif.
621616
@@ -853,15 +848,15 @@ def show(self, delay=None, iterations=None, **kwds):
853848
854849
You can also make use of the HTML5 video element in the Sage Notebook::
855850
856-
sage: # long time, optional - ffmpeg
851+
sage: # long time, optional -- FFmpeg
857852
sage: a.show(format="ogg")
858853
sage: a.show(format="webm")
859854
sage: a.show(format="mp4")
860855
sage: a.show(format="webm", iterations=1)
861856
862857
Other backends may support other file formats as well::
863858
864-
sage: # long time, optional - ffmpeg
859+
sage: # long time, optional -- FFmpeg
865860
sage: a.show(format="flash")
866861
sage: a.show(format="matroska")
867862
sage: a.show(format="avi")
@@ -956,10 +951,10 @@ def ffmpeg(self, savefile=None, show_path=False, output_format=None,
956951
....: for k in srange(0, 2*pi, 0.7)],
957952
....: xmin=0, xmax=2*pi, ymin=-1, ymax=1, figsize=[2,1])
958953
sage: td = tmp_dir()
959-
sage: a.ffmpeg(savefile=td + 'new.mpg') # long time # optional -- ffmpeg
960-
sage: a.ffmpeg(savefile=td + 'new.avi') # long time # optional -- ffmpeg
961-
sage: a.ffmpeg(savefile=td + 'new.gif') # long time # optional -- ffmpeg
962-
sage: a.ffmpeg(savefile=td + 'new.mpg', show_path=True) # long time # optional -- ffmpeg
954+
sage: a.ffmpeg(savefile=td + 'new.mpg') # long time # optional -- FFmpeg
955+
sage: a.ffmpeg(savefile=td + 'new.avi') # long time # optional -- FFmpeg
956+
sage: a.ffmpeg(savefile=td + 'new.gif') # long time # optional -- FFmpeg
957+
sage: a.ffmpeg(savefile=td + 'new.mpg', show_path=True) # long time # optional -- FFmpeg
963958
Animation saved to .../new.mpg.
964959
965960
.. NOTE::
@@ -973,7 +968,7 @@ def ffmpeg(self, savefile=None, show_path=False, output_format=None,
973968
974969
TESTS::
975970
976-
sage: a.ffmpeg(output_format='gif',delay=30,iterations=5) # long time # optional -- ffmpeg
971+
sage: a.ffmpeg(output_format='gif',delay=30,iterations=5) # long time # optional -- FFmpeg
977972
"""
978973
from sage.features.ffmpeg import FFmpeg
979974
FFmpeg().require()
@@ -1152,7 +1147,7 @@ def save(self, filename=None, show_path=False, use_ffmpeg=False, **kwds):
11521147
sage: a.save(td + 'wave.gif') # long time # optional -- ImageMagick
11531148
sage: a.save(td + 'wave.gif', show_path=True) # long time # optional -- ImageMagick
11541149
Animation saved to file .../wave.gif.
1155-
sage: a.save(td + 'wave.avi', show_path=True) # long time # optional -- ffmpeg
1150+
sage: a.save(td + 'wave.avi', show_path=True) # long time # optional -- FFmpeg
11561151
Animation saved to file .../wave.avi.
11571152
sage: a.save(td + 'wave0.sobj')
11581153
sage: a.save(td + 'wave1.sobj', show_path=True)
@@ -1166,7 +1161,7 @@ def save(self, filename=None, show_path=False, use_ffmpeg=False, **kwds):
11661161
Ensure that we can pass delay and iteration count to the saved
11671162
GIF image (see :trac:`18176`)::
11681163
1169-
sage: # long time, optional - imagemagick
1164+
sage: # long time, optional -- ImageMagick
11701165
sage: a.save(td + 'wave.gif')
11711166
sage: with open(td + 'wave.gif', 'rb') as f:
11721167
....: print(b'GIF8' in f.read())

0 commit comments

Comments
 (0)