mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Run proofreading over the whole library (#890)
This commit is contained in:
parent
2faa89e3d3
commit
691db1e461
49 changed files with 140 additions and 140 deletions
|
|
@ -105,7 +105,7 @@ Command line
|
|||
|
||||
#. Output of 'manim --help' has been improved
|
||||
#. Implement logging with the :code:`rich` library and a :code:`logger` object instead of plain ol' prints
|
||||
#. Added a flag :code:`--dry_run`, which doesn’t write any media
|
||||
#. Added a flag :code:`--dry_run`, which doesn't write any media
|
||||
#. Allow for running manim with :code:`python3 -m manim`
|
||||
#. Refactored Tex Template management. You can now use custom templates with command line args using :code:`--tex_template`!
|
||||
#. Re-add :code:`--save_frames` flag, which will save each frame as a png
|
||||
|
|
@ -187,7 +187,7 @@ Of interest to developers
|
|||
|
||||
#. Python code formatting is now enforced by using the :code:`black` tool
|
||||
#. PRs now require two approving code reviews from community devs before they can be merged
|
||||
#. Added tests to ensure stuff doesn’t break between commits (For developers) [Uses Github CI, and Pytest]
|
||||
#. Added tests to ensure stuff doesn't break between commits (For developers) [Uses Github CI, and Pytest]
|
||||
#. Add contribution guidelines (for developers)
|
||||
#. Added autogenerated documentation with sphinx and autodoc/autosummary [WIP]
|
||||
#. Made manim internally use relative imports
|
||||
|
|
|
|||
|
|
@ -604,8 +604,8 @@ Advanced Projects
|
|||
|
||||
class OpeningManim(Scene):
|
||||
def construct(self):
|
||||
title = Tex("This is some \\LaTeX")
|
||||
basel = MathTex("\\sum_{n=1}^\\infty " "\\frac{1}{n^2} = \\frac{\\pi^2}{6}")
|
||||
title = Tex(r"This is some \LaTeX")
|
||||
basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
|
||||
VGroup(title, basel).arrange(DOWN)
|
||||
self.play(
|
||||
Write(title),
|
||||
|
|
@ -617,7 +617,7 @@ Advanced Projects
|
|||
transform_title.to_corner(UP + LEFT)
|
||||
self.play(
|
||||
Transform(title, transform_title),
|
||||
LaggedStart(*map(lambda obj: FadeOutAndShift(obj, direction=DOWN), basel)),
|
||||
LaggedStart(*[FadeOutAndShift(obj, direction=DOWN) for obj in basel]),
|
||||
)
|
||||
self.wait()
|
||||
|
||||
|
|
@ -635,7 +635,7 @@ Advanced Projects
|
|||
self.wait()
|
||||
|
||||
grid_transform_title = Tex(
|
||||
"That was a non-linear function \\\\" "applied to the grid"
|
||||
r"That was a non-linear function \\ applied to the grid"
|
||||
)
|
||||
grid_transform_title.move_to(grid_title, UL)
|
||||
grid.prepare_for_nonlinear_transform()
|
||||
|
|
@ -681,7 +681,7 @@ Advanced Projects
|
|||
self.add(x_axis, y_axis)
|
||||
self.add_x_labels()
|
||||
|
||||
self.orgin_point = np.array([-4,0,0])
|
||||
self.origin_point = np.array([-4,0,0])
|
||||
self.curve_start = np.array([-3,0,0])
|
||||
|
||||
def add_x_labels(self):
|
||||
|
|
@ -696,14 +696,14 @@ Advanced Projects
|
|||
|
||||
def show_circle(self):
|
||||
circle = Circle(radius=1)
|
||||
circle.move_to(self.orgin_point)
|
||||
circle.move_to(self.origin_point)
|
||||
|
||||
self.add(circle)
|
||||
self.circle = circle
|
||||
|
||||
def move_dot_and_draw_curve(self):
|
||||
orbit = self.circle
|
||||
orgin_point = self.orgin_point
|
||||
origin_point = self.origin_point
|
||||
|
||||
dot = Dot(radius=0.08, color=YELLOW)
|
||||
dot.move_to(orbit.point_from_proportion(0))
|
||||
|
|
@ -716,7 +716,7 @@ Advanced Projects
|
|||
mob.move_to(orbit.point_from_proportion(self.t_offset % 1))
|
||||
|
||||
def get_line_to_circle():
|
||||
return Line(orgin_point, dot.get_center(), color=BLUE)
|
||||
return Line(origin_point, dot.get_center(), color=BLUE)
|
||||
|
||||
def get_line_to_curve():
|
||||
x = self.curve_start[0] + self.t_offset * 4
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Configuration
|
|||
Manim provides an extensive configuration system that allows it to adapt to
|
||||
many different use cases. There are many configuration options that can be
|
||||
configured at different times during the scene rendering process. Each option
|
||||
can be configured programatically via `the ManimConfig class`_, or at the time
|
||||
can be configured programmatically via `the ManimConfig class`_, or at the time
|
||||
of command invocation via `command line arguments`_, or at the time the library
|
||||
is first imported via `the config files`_.
|
||||
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ from manim import *
|
|||
# Use -s to skip to the end and just save the final frame
|
||||
# Use the -p to have preview of the animation (or image, if -s was
|
||||
# used) pop up once done.
|
||||
# Use -n <number> to skip ahead to the n'th animation of a scene.
|
||||
# Use -n <number> to skip ahead to the nth animation of a scene.
|
||||
# Use -r <number> to specify a resolution (for example, -r 1080
|
||||
# for a 1920x1080 video)
|
||||
|
||||
|
||||
class OpeningManimExample(Scene):
|
||||
class OpeningManim(Scene):
|
||||
def construct(self):
|
||||
title = Tex("This is some \\LaTeX")
|
||||
basel = MathTex("\\sum_{n=1}^\\infty " "\\frac{1}{n^2} = \\frac{\\pi^2}{6}")
|
||||
title = Tex(r"This is some \LaTeX")
|
||||
basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
|
||||
VGroup(title, basel).arrange(DOWN)
|
||||
self.play(
|
||||
Write(title),
|
||||
|
|
@ -29,7 +29,7 @@ class OpeningManimExample(Scene):
|
|||
transform_title.to_corner(UP + LEFT)
|
||||
self.play(
|
||||
Transform(title, transform_title),
|
||||
LaggedStart(*map(FadeOutAndShiftDown, basel)),
|
||||
LaggedStart(*[FadeOutAndShift(obj, direction=DOWN) for obj in basel]),
|
||||
)
|
||||
self.wait()
|
||||
|
||||
|
|
@ -41,13 +41,13 @@ class OpeningManimExample(Scene):
|
|||
self.add(grid, grid_title) # Make sure title is on top of grid
|
||||
self.play(
|
||||
FadeOut(title),
|
||||
FadeInFromDown(grid_title),
|
||||
FadeInFrom(grid_title, direction=DOWN),
|
||||
ShowCreation(grid, run_time=3, lag_ratio=0.1),
|
||||
)
|
||||
self.wait()
|
||||
|
||||
grid_transform_title = Tex(
|
||||
"That was a non-linear function \\\\" "applied to the grid"
|
||||
r"That was a non-linear function \\ applied to the grid"
|
||||
)
|
||||
grid_transform_title.move_to(grid_title, UL)
|
||||
grid.prepare_for_nonlinear_transform()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ def tempconfig(temp: Union[ManimConfig, dict]) -> _GeneratorContextManager:
|
|||
|
||||
temp = {k: v for k, v in temp.items() if k in original}
|
||||
|
||||
# In order to change the config that every module has acces to, use
|
||||
# In order to change the config that every module has access to, use
|
||||
# update(), DO NOT use assignment. Assigning config = some_dict will just
|
||||
# make the local variable named config point to a new dictionary, it will
|
||||
# NOT change the dictionary that every module has a reference to.
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ def is_valid_style(style: str) -> bool:
|
|||
|
||||
|
||||
def replace_keys(default: dict) -> dict:
|
||||
"""Replaces _ to . and viceversa in a dictionary for rich
|
||||
"""Replaces _ to . and vice versa in a dictionary for rich
|
||||
Parameters
|
||||
----------
|
||||
default : :class:`dict`
|
||||
|
|
@ -98,7 +98,7 @@ def replace_keys(default: dict) -> dict:
|
|||
Returns
|
||||
-------
|
||||
:class:`dict`
|
||||
The dictionary which is modified by replcaing _ with . and viceversa
|
||||
The dictionary which is modified by replacing _ with . and vice versa
|
||||
"""
|
||||
for key in default:
|
||||
if "_" in key:
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ js_renderer_path =
|
|||
png_mode = RGB
|
||||
movie_file_extension = .mp4
|
||||
|
||||
# These can be overriden with any of -l (--low_quality), -m
|
||||
# These can be overridden with any of -l (--low_quality), -m
|
||||
# (--medium_quality), -e (--high_quality), or -k (--fourk_quality). The
|
||||
# overriding values are found in the corresponding sections.
|
||||
frame_rate = 60
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ class ManimConfig(MutableMapping):
|
|||
c = ManimConfig()
|
||||
# Deepcopying the underlying dict is enough because all properties
|
||||
# either read directly from it or compute their value on the fly from
|
||||
# vaulues read directly from it.
|
||||
# values read directly from it.
|
||||
c._d = copy.deepcopy(self._d, memo)
|
||||
return c
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ class ManimConfig(MutableMapping):
|
|||
----------
|
||||
parser : :class:`ConfigParser`
|
||||
An object reflecting the contents of one or many ``.cfg`` files. In
|
||||
particular, it may reflect the contents of mulitple files that have
|
||||
particular, it may reflect the contents of multiple files that have
|
||||
been parsed in a cascading fashion.
|
||||
|
||||
Returns
|
||||
|
|
@ -1012,7 +1012,7 @@ class ManimConfig(MutableMapping):
|
|||
raise ValueError(
|
||||
"It is unclear what it means to set dry_run to "
|
||||
"False. Instead, try setting each option "
|
||||
"individually. (write_to_movie, write_alll, "
|
||||
"individually. (write_to_movie, write_all, "
|
||||
"save_last_frame, save_pngs, or save_as_gif)"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Animation:
|
|||
|
||||
def get_all_mobjects(self) -> typing.Tuple[Mobject, typing.Union[Mobject, None]]:
|
||||
"""
|
||||
Ordering must match the ording of arguments to interpolate_submobject
|
||||
Ordering must match the ordering of arguments to interpolate_submobject
|
||||
"""
|
||||
return self.mobject, self.starting_mobject
|
||||
|
||||
|
|
@ -151,13 +151,13 @@ class Animation:
|
|||
self.interpolate_submobject(*mobs, sub_alpha)
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: Mobject, starting_sumobject: Mobject, alpha: float
|
||||
self, submobject: Mobject, starting_submobject: Mobject, alpha: float
|
||||
) -> None:
|
||||
# Typically implemented by subclass
|
||||
pass
|
||||
|
||||
def get_sub_alpha(self, alpha: float, index: int, num_submobjects: int):
|
||||
# TODO, make this more understanable, and/or combine
|
||||
# TODO, make this more understandable, and/or combine
|
||||
# its functionality with AnimationGroup's method
|
||||
# build_animations_with_timings
|
||||
lag_ratio = self.lag_ratio
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@ class ShowPartial(Animation):
|
|||
super().__init__(mobject, **kwargs)
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: Mobject, starting_sumobject: Mobject, alpha: float
|
||||
self, submobject: Mobject, starting_submobject: Mobject, alpha: float
|
||||
) -> None:
|
||||
submobject.pointwise_become_partial(
|
||||
starting_sumobject, *self._get_bounds(alpha)
|
||||
starting_submobject, *self._get_bounds(alpha)
|
||||
)
|
||||
|
||||
def _get_bounds(self, alpha: float) -> None:
|
||||
|
|
@ -236,14 +236,14 @@ class DrawBorderThenFill(Animation):
|
|||
return [*super().get_all_mobjects(), self.outline]
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: Mobject, starting_sumobject: Mobject, outline, alpha: float
|
||||
self, submobject: Mobject, starting_submobject: Mobject, outline, alpha: float
|
||||
) -> None: # Fixme: not matching the parent class? What is outline doing here?
|
||||
index, subalpha = integer_interpolate(0, 2, alpha)
|
||||
if index == 0:
|
||||
submobject.pointwise_become_partial(outline, 0, subalpha)
|
||||
submobject.match_style(outline)
|
||||
else:
|
||||
submobject.interpolate(outline, starting_sumobject, subalpha)
|
||||
submobject.interpolate(outline, starting_submobject, subalpha)
|
||||
|
||||
|
||||
class Write(DrawBorderThenFill):
|
||||
|
|
|
|||
|
|
@ -189,13 +189,13 @@ class VFadeIn(Animation):
|
|||
)
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: "Mobject", starting_sumobject: "Mobject", alpha: float
|
||||
self, submobject: "Mobject", starting_submobject: "Mobject", alpha: float
|
||||
) -> None:
|
||||
submobject.set_stroke(
|
||||
opacity=interpolate(0, starting_sumobject.get_stroke_opacity(), alpha)
|
||||
opacity=interpolate(0, starting_submobject.get_stroke_opacity(), alpha)
|
||||
)
|
||||
submobject.set_fill(
|
||||
opacity=interpolate(0, starting_sumobject.get_fill_opacity(), alpha)
|
||||
opacity=interpolate(0, starting_submobject.get_fill_opacity(), alpha)
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -204,9 +204,9 @@ class VFadeOut(VFadeIn):
|
|||
super().__init__(mobject, remover=remover, **kwargs)
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: "Mobject", starting_sumobject: "Mobject", alpha: float
|
||||
self, submobject: "Mobject", starting_submobject: "Mobject", alpha: float
|
||||
) -> None:
|
||||
super().interpolate_submobject(submobject, starting_sumobject, 1 - alpha)
|
||||
super().interpolate_submobject(submobject, starting_submobject, 1 - alpha)
|
||||
|
||||
|
||||
class VFadeInThenOut(VFadeIn):
|
||||
|
|
|
|||
|
|
@ -330,9 +330,9 @@ class WiggleOutThenIn(Animation):
|
|||
return self.mobject.get_center()
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: "Mobject", starting_sumobject: "Mobject", alpha: float
|
||||
self, submobject: "Mobject", starting_submobject: "Mobject", alpha: float
|
||||
) -> None:
|
||||
submobject.points[:, :] = starting_sumobject.points
|
||||
submobject.points[:, :] = starting_submobject.points
|
||||
submobject.scale(
|
||||
interpolate(1, self.scale_value, there_and_back(alpha)),
|
||||
about_point=self.get_scale_about_point(),
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class Homotopy(Animation):
|
|||
return lambda p: self.homotopy(*p, t)
|
||||
|
||||
def interpolate_submobject(
|
||||
self, submobject: "Mobject", starting_sumobject: "Mobject", alpha: float
|
||||
self, submobject: "Mobject", starting_submobject: "Mobject", alpha: float
|
||||
) -> None:
|
||||
submobject.points = starting_sumobject.points
|
||||
submobject.points = starting_submobject.points
|
||||
submobject.apply_function(
|
||||
self.function_at_time_t(alpha), **self.apply_function_kwargs
|
||||
)
|
||||
|
|
@ -55,9 +55,9 @@ class Homotopy(Animation):
|
|||
|
||||
class SmoothedVectorizedHomotopy(Homotopy):
|
||||
def interpolate_submobject(
|
||||
self, submobject: "Mobject", starting_sumobject: "Mobject", alpha: float
|
||||
self, submobject: "Mobject", starting_submobject: "Mobject", alpha: float
|
||||
) -> None:
|
||||
Homotopy.interpolate_submobject(self, submobject, starting_sumobject, alpha)
|
||||
Homotopy.interpolate_submobject(self, submobject, starting_submobject, alpha)
|
||||
submobject.make_smooth()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ChangingDecimal(Animation):
|
|||
**kwargs,
|
||||
) -> None:
|
||||
self.check_validity_of_input(decimal_mob)
|
||||
self.yell_about_depricated_configuration(**kwargs)
|
||||
self.yell_about_deprecated_configuration(**kwargs)
|
||||
self.number_update_func = number_update_func
|
||||
super().__init__(
|
||||
decimal_mob, suspend_mobject_updating=suspend_mobject_updating, **kwargs
|
||||
|
|
@ -30,7 +30,7 @@ class ChangingDecimal(Animation):
|
|||
if not isinstance(decimal_mob, DecimalNumber):
|
||||
raise TypeError("ChangingDecimal can only take in a DecimalNumber")
|
||||
|
||||
def yell_about_depricated_configuration(self, **kwargs) -> None:
|
||||
def yell_about_deprecated_configuration(self, **kwargs) -> None:
|
||||
# Obviously this would optimally be removed at
|
||||
# some point.
|
||||
for attr in ["tracked_mobject", "position_update_func"]:
|
||||
|
|
@ -38,7 +38,7 @@ class ChangingDecimal(Animation):
|
|||
warnings.warn(
|
||||
f"""
|
||||
Don't use {attr} for ChangingDecimal,
|
||||
that functionality has been depricated
|
||||
that functionality has been deprecated
|
||||
and you should use a mobject updater
|
||||
instead
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ class Transform(Animation):
|
|||
def interpolate_submobject(
|
||||
self,
|
||||
submobject: Mobject,
|
||||
starting_sumobject: Mobject,
|
||||
starting_submobject: Mobject,
|
||||
target_copy: Mobject,
|
||||
alpha: float,
|
||||
) -> "Transform": # doesn't match the parent class?
|
||||
submobject.interpolate(starting_sumobject, target_copy, alpha, self.path_func)
|
||||
submobject.interpolate(starting_submobject, target_copy, alpha, self.path_func)
|
||||
return self
|
||||
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ class Swap(CyclicReplace):
|
|||
pass # Renaming, more understandable for two entries
|
||||
|
||||
|
||||
# TODO, this may be depricated...worth reimplementing?
|
||||
# TODO, this may be deprecated...worth reimplementing?
|
||||
class TransformAnimations(Transform):
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class Camera:
|
|||
|
||||
def reset_pixel_shape(self, new_height, new_width):
|
||||
"""This method resets the height and width
|
||||
of a single pixel to the passed new_heigh and new_width.
|
||||
of a single pixel to the passed new_height and new_width.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -342,7 +342,7 @@ class Camera:
|
|||
Parameters
|
||||
----------
|
||||
coords_to_colors_func : function
|
||||
The function whose input is an (x,y) pair of coordinats and
|
||||
The function whose input is an (x,y) pair of coordinates and
|
||||
whose return values must be the colors for that point
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -372,7 +372,7 @@ class Camera:
|
|||
Parameters
|
||||
----------
|
||||
coords_to_colors_func : function
|
||||
The function whose input is an (x,y) pair of coordinats and
|
||||
The function whose input is an (x,y) pair of coordinates and
|
||||
whose return values must be the colors for that point
|
||||
"""
|
||||
self.set_background(self.make_background_from_func(coords_to_colors_func))
|
||||
|
|
@ -879,7 +879,7 @@ class Camera:
|
|||
pixel_array[:, :] = new_pa.reshape((ph, pw, rgba_len))
|
||||
|
||||
def display_multiple_image_mobjects(self, image_mobjects, pixel_array):
|
||||
"""Displays multiple image mobjects by modifiying the passed pixel_array.
|
||||
"""Displays multiple image mobjects by modifying the passed pixel_array.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -926,7 +926,7 @@ class Camera:
|
|||
|
||||
# TODO, there is no accounting for a shear...
|
||||
|
||||
# Paste into an image as large as the camear's pixel array
|
||||
# Paste into an image as large as the camera's pixel array
|
||||
full_image = Image.fromarray(
|
||||
np.zeros((self.pixel_height, self.pixel_width)), mode="RGBA"
|
||||
)
|
||||
|
|
@ -1003,7 +1003,7 @@ class Camera:
|
|||
# NOTE: There seems to be an unused argument `mobject`.
|
||||
|
||||
# Subclasses (like ThreeDCamera) may want to
|
||||
# adjust points futher before they're shown
|
||||
# adjust points further before they're shown
|
||||
if not np.all(np.isfinite(points)):
|
||||
# TODO, print some kind of warning about
|
||||
# mobject having invalid points?
|
||||
|
|
@ -1167,7 +1167,7 @@ class BackgroundColoredVMobjectDisplayer:
|
|||
def resize_background_array(
|
||||
self, background_array, new_width, new_height, mode="RGBA"
|
||||
):
|
||||
"""Resizes the pixel array represinting the background.
|
||||
"""Resizes the pixel array representing the background.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class OldMultiCamera(Camera):
|
|||
|
||||
|
||||
# A OldMultiCamera which, when called with two full-size cameras, initializes itself
|
||||
# as a splitscreen, also taking care to resize each individual camera within it
|
||||
# as a split screen, also taking care to resize each individual camera within it
|
||||
|
||||
|
||||
class SplitScreenCamera(OldMultiCamera):
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class MovingCamera(Camera):
|
|||
):
|
||||
"""
|
||||
frame is a Mobject, (should almost certainly be a rectangle)
|
||||
determining which region of space the camera displys
|
||||
determining which region of space the camera displays
|
||||
"""
|
||||
self.fixed_dimension = fixed_dimension
|
||||
self.default_frame_stroke_color = default_frame_stroke_color
|
||||
|
|
@ -165,7 +165,7 @@ class MovingCamera(Camera):
|
|||
|
||||
def get_mobjects_indicating_movement(self):
|
||||
"""
|
||||
Returns all mobjets whose movement implies that the camera
|
||||
Returns all mobjects whose movement implies that the camera
|
||||
should think of all other mobjects on the screen as moving
|
||||
|
||||
Returns
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class MultiCamera(MovingCamera):
|
|||
allow_cameras_to_capture_their_own_display=False,
|
||||
**kwargs
|
||||
):
|
||||
"""Initalises the MultiCamera
|
||||
"""Initialises the MultiCamera
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -85,7 +85,7 @@ class MultiCamera(MovingCamera):
|
|||
MovingCamera.capture_mobjects(self, mobjects, **kwargs)
|
||||
|
||||
def get_mobjects_indicating_movement(self):
|
||||
"""Returns all mobjets whose movement implies that the camera
|
||||
"""Returns all mobjects whose movement implies that the camera
|
||||
should think of all other mobjects on the screen as moving
|
||||
|
||||
Returns
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ class ThreeDCamera(Camera):
|
|||
zs = points[:, 2]
|
||||
for i in 0, 1:
|
||||
if self.exponential_projection:
|
||||
# Proper projedtion would involve multiplying
|
||||
# Proper projection would involve multiplying
|
||||
# x and y by d / (d-z). But for points with high
|
||||
# z value that causes weird artifacts, and applying
|
||||
# the exponential helps smooth it out.
|
||||
|
|
@ -343,10 +343,10 @@ class ThreeDCamera(Camera):
|
|||
center as centerpoint, by default False
|
||||
center_func : func, optional
|
||||
The function which returns the centerpoint
|
||||
with respect to which the mobjec will be oriented, by default None
|
||||
with respect to which the mobject will be oriented, by default None
|
||||
"""
|
||||
# This prevents the computation of mobject.get_center
|
||||
# every single time a projetion happens
|
||||
# every single time a projection happens
|
||||
def get_static_center_func(mobject):
|
||||
point = mobject.get_center()
|
||||
return lambda: point
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class TipableVMobject(VMobject):
|
|||
|
||||
def create_tip(self, tip_shape=None, tip_length=None, at_start=False):
|
||||
"""
|
||||
Stylises the tip, positions it spacially, and returns
|
||||
Stylises the tip, positions it spatially, and returns
|
||||
the newly instantiated tip to the caller.
|
||||
"""
|
||||
tip = self.get_unpositioned_tip(tip_shape, tip_length)
|
||||
|
|
@ -298,7 +298,7 @@ class Arc(TipableVMobject):
|
|||
# Appropriate tangent lines to the circle
|
||||
d_theta = self.angle / (self.num_components - 1.0)
|
||||
tangent_vectors = np.zeros(anchors.shape)
|
||||
# Rotate all 90 degress, via (x, y) -> (-y, x)
|
||||
# Rotate all 90 degrees, via (x, y) -> (-y, x)
|
||||
tangent_vectors[:, 1] = anchors[:, 0]
|
||||
tangent_vectors[:, 0] = -anchors[:, 1]
|
||||
# Use tangent vectors to deduce anchors
|
||||
|
|
@ -407,7 +407,7 @@ class Circle(Arc):
|
|||
|
||||
def surround(self, mobject, dim_to_match=0, stretch=False, buffer_factor=1.2):
|
||||
# Ignores dim_to_match and stretch; result will always be a circle
|
||||
# TODO: Perhaps create an ellipse class to handle singele-dimension stretching
|
||||
# TODO: Perhaps create an ellipse class to handle single-dimension stretching
|
||||
|
||||
# Something goes wrong here when surrounding lines?
|
||||
# TODO: Figure out and fix
|
||||
|
|
@ -816,12 +816,12 @@ class Arrow(Line):
|
|||
self.preserve_tip_size_when_scaling = (
|
||||
preserve_tip_size_when_scaling # is this used anywhere
|
||||
)
|
||||
tipp_shape = kwargs.pop("tip_shape", ArrowTriangleFilledTip)
|
||||
tip_shape = kwargs.pop("tip_shape", ArrowTriangleFilledTip)
|
||||
Line.__init__(self, *args, buff=buff, stroke_width=stroke_width, **kwargs)
|
||||
# TODO, should this be affected when
|
||||
# Arrow.set_stroke is called?
|
||||
self.initial_stroke_width = self.stroke_width
|
||||
self.add_tip(tip_shape=tipp_shape)
|
||||
self.add_tip(tip_shape=tip_shape)
|
||||
self.set_stroke_width_from_length()
|
||||
|
||||
def scale(self, factor, scale_tips=False, **kwargs):
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class Matrix(VMobject):
|
|||
**kwargs
|
||||
):
|
||||
"""
|
||||
Matrix can either either include numbres, tex_strings,
|
||||
Matrix can either either include numbers, tex_strings,
|
||||
or mobjects
|
||||
"""
|
||||
self.v_buff = v_buff
|
||||
|
|
|
|||
|
|
@ -1283,7 +1283,7 @@ class Mobject(Container):
|
|||
|
||||
class BecomeScene(Scene):
|
||||
def construct(self):
|
||||
circ= Circle(fill_color=RED)
|
||||
circ = Circle(fill_color=RED)
|
||||
square = Square(fill_color=BLUE)
|
||||
self.add(circ)
|
||||
self.wait(0.5)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ def always(method, *args, **kwargs):
|
|||
def f_always(method, *arg_generators, **kwargs):
|
||||
"""
|
||||
More functional version of always, where instead
|
||||
of taking in args, it takes in functions which ouput
|
||||
of taking in args, it takes in functions which output
|
||||
the relevant arguments.
|
||||
"""
|
||||
assert_is_mobject_method(method)
|
||||
|
|
@ -80,7 +80,7 @@ def turn_animation_into_updater(animation, cycle=False, **kwargs):
|
|||
the interpolation and update functions of the animation
|
||||
|
||||
If cycle is True, this repeats over and over. Otherwise,
|
||||
the updater will be popped uplon completion
|
||||
the updater will be popped upon completion
|
||||
"""
|
||||
mobject = animation.mobject
|
||||
animation.update_config(**kwargs)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class BackgroundRectangle(SurroundingRectangle):
|
|||
fill_opacity=None,
|
||||
family=True,
|
||||
):
|
||||
# Unchangable style, except for fill_opacity
|
||||
# Unchangeable style, except for fill_opacity
|
||||
VMobject.set_style(
|
||||
self,
|
||||
stroke_color=BLACK,
|
||||
|
|
|
|||
|
|
@ -191,11 +191,11 @@ class Code(VGroup):
|
|||
self.line_numbers.next_to(self.code, direction=LEFT, buff=self.line_no_buff)
|
||||
if self.background == "rectangle":
|
||||
if self.insert_line_no:
|
||||
forground = VGroup(self.code, self.line_numbers)
|
||||
foreground = VGroup(self.code, self.line_numbers)
|
||||
else:
|
||||
forground = self.code
|
||||
foreground = self.code
|
||||
rect = SurroundingRectangle(
|
||||
forground,
|
||||
foreground,
|
||||
buff=self.margin,
|
||||
color=self.background_color,
|
||||
fill_color=self.background_color,
|
||||
|
|
@ -207,11 +207,11 @@ class Code(VGroup):
|
|||
self.background_mobject = VGroup(rect)
|
||||
else:
|
||||
if self.insert_line_no:
|
||||
forground = VGroup(self.code, self.line_numbers)
|
||||
foreground = VGroup(self.code, self.line_numbers)
|
||||
else:
|
||||
forground = self.code
|
||||
height = forground.get_height() + 0.1 * 3 + 2 * self.margin
|
||||
width = forground.get_width() + 0.1 * 3 + 2 * self.margin
|
||||
foreground = self.code
|
||||
height = foreground.get_height() + 0.1 * 3 + 2 * self.margin
|
||||
width = foreground.get_width() + 0.1 * 3 + 2 * self.margin
|
||||
|
||||
rect = RoundedRectangle(
|
||||
corner_radius=self.corner_radius,
|
||||
|
|
@ -234,8 +234,8 @@ class Code(VGroup):
|
|||
)
|
||||
|
||||
self.background_mobject = VGroup(rect, buttons)
|
||||
x = (height - forground.get_height()) / 2 - 0.1 * 3
|
||||
self.background_mobject.shift(forground.get_center())
|
||||
x = (height - foreground.get_height()) / 2 - 0.1 * 3
|
||||
self.background_mobject.shift(foreground.get_center())
|
||||
self.background_mobject.shift(UP * x)
|
||||
if self.insert_line_no:
|
||||
VGroup.__init__(
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ class SVGMobject(VMobject):
|
|||
Returns
|
||||
-------
|
||||
List[VMobject]
|
||||
A list of VMobject reprsented by the group.
|
||||
A list of VMobject represented by the group.
|
||||
"""
|
||||
mob = VGroup(*self.get_mobjects_from(g_element))
|
||||
self.handle_transforms(g_element, mob)
|
||||
|
|
@ -346,7 +346,7 @@ class SVGMobject(VMobject):
|
|||
WHITE
|
||||
):
|
||||
opacity = 0
|
||||
fill_color = BLACK # shdn't be necessary but avoids error msgs
|
||||
fill_color = BLACK # shouldn't be necessary but avoids error msgs
|
||||
if fill_color in ["#000", "#000000"]:
|
||||
fill_color = WHITE
|
||||
if stroke_color in ["", "none", "#FFF", "#FFFFFF"] or Color(
|
||||
|
|
@ -388,7 +388,7 @@ class SVGMobject(VMobject):
|
|||
return mob
|
||||
|
||||
def handle_transforms(self, element, mobject):
|
||||
"""Applies the SVG transform to the specified mobject. Tranforms include:
|
||||
"""Applies the SVG transform to the specified mobject. Transforms include:
|
||||
``rotate``, ``translate``, ``scale``, and ``skew``.
|
||||
|
||||
Parameters
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class SingleStringMathTex(SVGMobject):
|
|||
# Fraction line needs something to be over
|
||||
tex == "\\over",
|
||||
tex == "\\overline",
|
||||
# Makesure sqrt has overbar
|
||||
# Make sure sqrt has overbar
|
||||
tex == "\\sqrt",
|
||||
# Need to add blank subscript or superscript
|
||||
tex.endswith("_"),
|
||||
|
|
@ -406,7 +406,7 @@ class MathTex(SingleStringMathTex):
|
|||
|
||||
def break_up_by_substrings(self):
|
||||
"""
|
||||
Reorganize existing submojects one layer
|
||||
Reorganize existing submobjects one layer
|
||||
deeper based on the structure of tex_strings (as a list
|
||||
of tex_strings)
|
||||
"""
|
||||
|
|
@ -422,7 +422,7 @@ class MathTex(SingleStringMathTex):
|
|||
num_submobs = len(sub_tex_mob.submobjects)
|
||||
new_index = curr_index + num_submobs
|
||||
if num_submobs == 0:
|
||||
# For cases like empty tex_strings, we want the corresponing
|
||||
# For cases like empty tex_strings, we want the corresponding
|
||||
# part of the whole MathTex to be a VectorizedPoint
|
||||
# positioned in the right part of the MathTex
|
||||
sub_tex_mob.submobjects = [VectorizedPoint()]
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ Examples
|
|||
text = Text('Hello world').scale(3)
|
||||
self.add(text)
|
||||
|
||||
.. manim:: TextAlignement
|
||||
.. manim:: TextAlignment
|
||||
:save_last_frame:
|
||||
|
||||
class TextAlignement(Scene):
|
||||
class TextAlignment(Scene):
|
||||
def construct(self):
|
||||
title = Text("K-means clustering and Logistic Regression", color=WHITE)
|
||||
title.scale_in_place(0.75)
|
||||
|
|
@ -412,7 +412,7 @@ class Paragraph(VGroup):
|
|||
Parameters
|
||||
----------
|
||||
line_spacing : :class:`int`, optional
|
||||
Represents the spaning betweeb lines. Default to -1, which means auto.
|
||||
Represents the spacing between lines. Default to -1, which means auto.
|
||||
alignment : :class:`str`, optional
|
||||
Defines the alignment of paragraph. Default to "left". Possible values are "left", "right", "center"
|
||||
|
||||
|
|
@ -499,7 +499,7 @@ class Paragraph(VGroup):
|
|||
return chars
|
||||
|
||||
def set_all_lines_alignments(self, alignment):
|
||||
"""Function to set all line's aligment to a specific value.
|
||||
"""Function to set all line's alignment to a specific value.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -511,7 +511,7 @@ class Paragraph(VGroup):
|
|||
return self
|
||||
|
||||
def set_line_alignment(self, alignment, line_no):
|
||||
"""Function to set one line's aligment to a specific value.
|
||||
"""Function to set one line's alignment to a specific value.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -545,7 +545,7 @@ class Paragraph(VGroup):
|
|||
return self
|
||||
|
||||
def change_alignment_for_a_line(self, alignment, line_no):
|
||||
"""Function to change one line's aligment to a specific value.
|
||||
"""Function to change one line's alignment to a specific value.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -840,7 +840,7 @@ class Text(SVGMobject):
|
|||
return indexes
|
||||
|
||||
# def full2short(self, kwargs):
|
||||
# """Internally used function. Fomats some exapansion to short forms.
|
||||
# """Internally used function. Formats some expansion to short forms.
|
||||
# text2color -> t2c
|
||||
# text2font -> t2f
|
||||
# text2gradient -> t2g
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class AbstractImageMobject(Mobject):
|
|||
raise NotImplementedError()
|
||||
|
||||
def set_color(self):
|
||||
# Likely to be implemented in subclasses, but no obgligation
|
||||
# Likely to be implemented in subclasses, but no obligation
|
||||
pass
|
||||
|
||||
def reset_points(self):
|
||||
|
|
@ -174,11 +174,11 @@ class ImageMobject(AbstractImageMobject):
|
|||
Parameters
|
||||
----------
|
||||
mobject1 : ImageMobject
|
||||
The ImageMobject to tranform from.
|
||||
The ImageMobject to transform from.
|
||||
|
||||
mobject1 : ImageMobject
|
||||
|
||||
The ImageMobject to tranform into.
|
||||
The ImageMobject to transform into.
|
||||
alpha : float
|
||||
Used to track the lerp relationship. Not opacity related.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ class VMobject(Mobject):
|
|||
|
||||
def add_smooth_curve_to(self, *points):
|
||||
"""
|
||||
If two points are passed in, the first is intepretted
|
||||
If two points are passed in, the first is interpreted
|
||||
as a handle, the second as an anchor
|
||||
"""
|
||||
if len(points) == 1:
|
||||
|
|
@ -744,7 +744,7 @@ class VMobject(Mobject):
|
|||
|
||||
for mob in self, vmobject:
|
||||
# If there are no points, add one to
|
||||
# whereever the "center" is
|
||||
# wherever the "center" is
|
||||
if mob.has_no_points():
|
||||
mob.start_new_path(mob.get_center())
|
||||
# If there's only one point, turn it into
|
||||
|
|
@ -1163,7 +1163,7 @@ class VDict(VMobject):
|
|||
my_dict["t"] = Tex("Some other text").set_color(BLUE)
|
||||
self.wait()
|
||||
|
||||
# remove submoject by key
|
||||
# remove submobject by key
|
||||
my_dict.remove("t")
|
||||
self.wait()
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: FunctionPlotWithLabbeledYAxis
|
||||
.. manim:: FunctionPlotWithLabelledYAxis
|
||||
:save_last_frame:
|
||||
|
||||
class FunctionPlotWithLabbeledYAxis(GraphScene):
|
||||
class FunctionPlotWithLabelledYAxis(GraphScene):
|
||||
def __init__(self, **kwargs):
|
||||
GraphScene.__init__(
|
||||
self,
|
||||
|
|
@ -379,7 +379,7 @@ class GraphScene(Scene):
|
|||
def input_to_graph_point(self, x, graph):
|
||||
"""
|
||||
This method returns a coordinate on the curve
|
||||
given an x_value and a the graoh-curve for which
|
||||
given an x_value and a the graph-curve for which
|
||||
the corresponding y value should be found.
|
||||
|
||||
Parameters
|
||||
|
|
@ -427,7 +427,7 @@ class GraphScene(Scene):
|
|||
|
||||
def slope_of_tangent(self, *args, **kwargs):
|
||||
"""
|
||||
Returns the slople of the tangent to the plotted curve
|
||||
Returns the slope of the tangent to the plotted curve
|
||||
at a particular x-value.
|
||||
|
||||
Parameters
|
||||
|
|
@ -656,7 +656,7 @@ class GraphScene(Scene):
|
|||
):
|
||||
"""
|
||||
This method returns a list of multiple VGroups of Riemann
|
||||
Rectangles. The inital VGroups are relatively inaccurate,
|
||||
Rectangles. The initial VGroups are relatively inaccurate,
|
||||
but the closer you get to the end the more accurate the Riemann
|
||||
rectangles become
|
||||
|
||||
|
|
@ -980,7 +980,7 @@ class GraphScene(Scene):
|
|||
side : np.array(), optional
|
||||
|
||||
label : str, optional
|
||||
The label to give the vertline and triangle
|
||||
The label to give the vertical line and triangle
|
||||
|
||||
color : str, optional
|
||||
The hex color of the label.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from ..scene.scene import Scene
|
|||
|
||||
class ReconfigurableScene(Scene):
|
||||
"""
|
||||
Note, this seems to no longer work as intented.
|
||||
Note, this seems to no longer work as intended.
|
||||
"""
|
||||
|
||||
def __init__(self, allow_recursion=True, **kwargs):
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Scene(Container):
|
|||
|
||||
The primary role of :class:`Scene` is to provide the user with tools to manage
|
||||
mobjects and animations. Generally speaking, a manim script consists of a class
|
||||
that derives from :class:`Scene` whose :meth:`Scene.construct` method is overriden
|
||||
that derives from :class:`Scene` whose :meth:`Scene.construct` method is overridden
|
||||
by the user's code.
|
||||
|
||||
Mobjects are displayed on screen by calling :meth:`Scene.add` and removed from
|
||||
|
|
@ -175,7 +175,7 @@ class Scene(Container):
|
|||
def setup(self):
|
||||
"""
|
||||
This is meant to be implemented by any scenes which
|
||||
are comonly subclassed, and have some common setup
|
||||
are commonly subclassed, and have some common setup
|
||||
involved before the construct method is called.
|
||||
"""
|
||||
pass
|
||||
|
|
@ -183,7 +183,7 @@ class Scene(Container):
|
|||
def tear_down(self):
|
||||
"""
|
||||
This is meant to be implemented by any scenes which
|
||||
are comonly subclassed, and have some common method
|
||||
are commonly subclassed, and have some common method
|
||||
to be invoked before the scene ends.
|
||||
"""
|
||||
pass
|
||||
|
|
@ -204,7 +204,7 @@ class Scene(Container):
|
|||
Examples
|
||||
--------
|
||||
A typical manim script includes a class derived from :class:`Scene` with an
|
||||
overriden :meth:`Scene.contruct` method:
|
||||
overridden :meth:`Scene.contruct` method:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ class SceneFileWriter(object):
|
|||
|
||||
def open_movie_pipe(self):
|
||||
"""
|
||||
Used internally by Manim to initalise
|
||||
Used internally by Manim to initialise
|
||||
FFMPEG and begin writing to FFMPEG's input
|
||||
buffer.
|
||||
"""
|
||||
|
|
@ -355,7 +355,7 @@ class SceneFileWriter(object):
|
|||
"-r",
|
||||
str(fps), # frames per second
|
||||
"-i",
|
||||
"-", # The imput comes from a pipe
|
||||
"-", # The input comes from a pipe
|
||||
"-an", # Tells FFMPEG not to expect any audio
|
||||
"-loglevel",
|
||||
config["ffmpeg_loglevel"].lower(),
|
||||
|
|
@ -413,7 +413,7 @@ class SceneFileWriter(object):
|
|||
# viewing the scene as a whole, one of course wants to see it as a
|
||||
# single piece.
|
||||
partial_movie_files = [el for el in self.partial_movie_files if el is not None]
|
||||
# NOTE : Here we should do a check and raise an exeption if partial
|
||||
# NOTE : Here we should do a check and raise an exception if partial
|
||||
# movie file is empty. We can't, as a lot of stuff (in particular, in
|
||||
# tests) use scene initialization, and this error would be raised as
|
||||
# it's just an empty scene initialized.
|
||||
|
|
|
|||
|
|
@ -117,12 +117,12 @@ class ThreeDScene(Scene):
|
|||
):
|
||||
val_tracker_theta = ValueTracker(0)
|
||||
|
||||
def uptate_theta(m, dt):
|
||||
def update_theta(m, dt):
|
||||
val_tracker_theta.increment_value(dt * rate)
|
||||
val_for_left_right = 0.2 * np.sin(val_tracker_theta.get_value())
|
||||
return m.set_value(origin_theta + val_for_left_right)
|
||||
|
||||
self.renderer.camera.theta_tracker.add_updater(uptate_theta)
|
||||
self.renderer.camera.theta_tracker.add_updater(update_theta)
|
||||
self.add(self.renderer.camera.theta_tracker)
|
||||
|
||||
val_tracker_phi = ValueTracker(0)
|
||||
|
|
@ -237,7 +237,7 @@ class ThreeDScene(Scene):
|
|||
"""
|
||||
This method is used to prevent the rotation and movement
|
||||
of mobjects as the camera moves around. The mobject is
|
||||
essentially overlayed, and is not impacted by the camera's
|
||||
essentially overlaid, and is not impacted by the camera's
|
||||
movement in any way.
|
||||
|
||||
Parameters
|
||||
|
|
|
|||
|
|
@ -1073,7 +1073,7 @@ class LinearTransformationScene(VectorScene):
|
|||
|
||||
added_anims : list, optional
|
||||
Any other animations that need to be played
|
||||
simulataneously with this.
|
||||
simultaneously with this.
|
||||
|
||||
**kwargs
|
||||
Any valid keyword argument of a self.play() call.
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ def get_smooth_handle_points(
|
|||
l, u = 2, 1
|
||||
# diag is a representation of the matrix in diagonal form
|
||||
# See https://www.particleincell.com/2012/bezier-splines/
|
||||
# for how to arive at these equations
|
||||
# for how to arrive at these equations
|
||||
diag = np.zeros((l + u + 1, 2 * num_handles))
|
||||
diag[0, 1::2] = -1
|
||||
diag[0, 2::2] = 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Utilities that mught be useful for configuration dictionaries."""
|
||||
"""Utilities that might be useful for configuration dictionaries."""
|
||||
|
||||
__all__ = [
|
||||
"merge_dicts_recursively",
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ class CustomEncoder(json.JSONEncoder):
|
|||
return repr(obj)
|
||||
elif hasattr(obj, "__dict__"):
|
||||
temp = getattr(obj, "__dict__")
|
||||
# MappingProxy is scene-caching nightmare. It contains all of the object methods and attributes. We skip it as the mechanism will at some point process the object, but instancied
|
||||
# Indeed, there is certainly no case where scene-caching will recieve only a non instancied object, as this is never used in the library or encouraged to be used user-side.
|
||||
# MappingProxy is scene-caching nightmare. It contains all of the object methods and attributes. We skip it as the mechanism will at some point process the object, but instantiated.
|
||||
# Indeed, there is certainly no case where scene-caching will receive only a non instancied object, as this is never used in the library or encouraged to be used user-side.
|
||||
if isinstance(temp, MappingProxyType):
|
||||
return "MappingProxy"
|
||||
return self._check_iterable(temp)
|
||||
|
|
@ -204,9 +204,9 @@ def get_camera_dict_for_hashing(camera_object):
|
|||
`Camera.__dict__` but cleaned.
|
||||
"""
|
||||
camera_object_dict = copy.copy(camera_object.__dict__)
|
||||
# We have to clean a little bit of camera_dict, as pixel_array and background are two very big numpy arrays.
|
||||
# They are not essential to caching process.
|
||||
# We also have to remove pixel_array_to_cairo_context as it contains used memory adress (set randomly). See l.516 get_cached_cairo_context in camera.py
|
||||
# We have to clean a little bit of camera_dict, as pixel_array and background are two very big numpy arrays. They
|
||||
# are not essential to caching process. We also have to remove pixel_array_to_cairo_context as it contains used
|
||||
# memory address (set randomly). See l.516 get_cached_cairo_context in camera.py
|
||||
for to_clean in ["background", "pixel_array", "pixel_array_to_cairo_context"]:
|
||||
camera_object_dict.pop(to_clean, None)
|
||||
return camera_object_dict
|
||||
|
|
@ -251,7 +251,7 @@ def get_hash_from_play_call(
|
|||
t_end = perf_counter()
|
||||
logger.debug("Hashing done in %(time)s s.", {"time": str(t_end - t_start)[:8]})
|
||||
hash_complete = f"{hash_camera}_{hash_animations}_{hash_current_mobjects}"
|
||||
# This will reset ALREADY_PROCESSED_ID as all the hashing processus is finished.
|
||||
# This will reset ALREADY_PROCESSED_ID as all the hashing process is finished.
|
||||
ALREADY_PROCESSED_ID = {}
|
||||
logger.debug("Hash generated : %(h)s", {"h": hash_complete})
|
||||
return hash_complete
|
||||
|
|
@ -293,7 +293,7 @@ def get_hash_from_wait_call(
|
|||
hash_camera = zlib.crc32(repr(camera_json).encode())
|
||||
if stop_condition_function is not None:
|
||||
hash_function = zlib.crc32(get_json(stop_condition_function).encode())
|
||||
# This will reset ALREADY_PROCESSED_ID as all the hashing processus is finished.
|
||||
# This will reset ALREADY_PROCESSED_ID as all the hashing process is finished.
|
||||
ALREADY_PROCESSED_ID = {}
|
||||
t_end = perf_counter()
|
||||
logger.debug("Hashing done in %(time)s s.", {"time": str(t_end - t_start)[:8]})
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import numpy as np
|
|||
def remove_list_redundancies(l):
|
||||
"""
|
||||
Used instead of list(set(l)) to maintain order
|
||||
Keeps the last occurance of each element
|
||||
Keeps the last occurrence of each element
|
||||
"""
|
||||
reversed_result = []
|
||||
used = set()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class TexTemplate:
|
|||
documentclass : Optional[:class:`str`], optional
|
||||
The command defining the documentclass, e.g. ``\\documentclass[preview]{standalone}``
|
||||
preamble : Optional[:class:`str`], optional
|
||||
The document's preample, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
||||
The document's preamble, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
||||
placeholder_text : Optional[:class:`str`], optional
|
||||
Text in the document that will be replaced by the expression to be rendered
|
||||
post_doc_commands : Optional[:class:`str`], optional
|
||||
|
|
@ -239,7 +239,7 @@ class TexTemplateFromFile(TexTemplate):
|
|||
documentclass : Optional[:class:`str`], optional
|
||||
The command defining the documentclass, e.g. ``\\documentclass[preview]{standalone}``
|
||||
preamble : Optional[:class:`str`], optional
|
||||
The document's preample, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
||||
The document's preamble, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
||||
placeholder_text : Optional[:class:`str`], optional
|
||||
Text in the document that will be replaced by the expression to be rendered
|
||||
post_doc_commands : Optional[:class:`str`], optional
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ def pytest_addoption(parser):
|
|||
"--skip_slow",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Will skip all the slow marked tests. Slow tests are arbitrarly marked as such.",
|
||||
help="Will skip all the slow marked tests. Slow tests are arbitrarily marked as such.",
|
||||
)
|
||||
parser.addoption(
|
||||
"--show_diff",
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ def get_config_from_video(path_to_video):
|
|||
|
||||
def save_control_data_from_video(path_to_video, name):
|
||||
"""Helper used to set up a new test that will compare videos. This will create a new .json file in control_data/videos_data that contains
|
||||
informations tested of the video, including its hash. Refer to the wiki for more informations.
|
||||
information tested of the video, including its hash. Refer to the wiki for more informations.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ def test_background_color():
|
|||
|
||||
|
||||
def test_digest_file(tmp_path):
|
||||
"""Test that a config file can be digested programatically."""
|
||||
"""Test that a config file can be digested programmatically."""
|
||||
with tempconfig({}):
|
||||
tmp_cfg = tempfile.NamedTemporaryFile("w", dir=tmp_path, delete=False)
|
||||
tmp_cfg.write(
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class LineTest(Scene):
|
|||
self.play(Animation(a))
|
||||
|
||||
|
||||
class Elbowtest(Scene):
|
||||
class ElbowTest(Scene):
|
||||
def construct(self):
|
||||
a = Elbow()
|
||||
self.play(Animation(a))
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class GraphicalUnitTester:
|
|||
return np.load(frame_data_path)["frame_data"]
|
||||
|
||||
def _show_diff_helper(self, frame_data, expected_frame_data):
|
||||
"""Will visually display with matplotlib differences between frame generared and the one expected."""
|
||||
"""Will visually display with matplotlib differences between frame generated and the one expected."""
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.gridspec as gridspec
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ def logs_comparison(control_data_file, log_path_from_media_dir):
|
|||
Parameters
|
||||
----------
|
||||
control_data_file : :class:`str`
|
||||
Name of the control data file, i.e. .log that will be compared to the outputed logs.
|
||||
Name of the control data file, i.e. .log that will be compared to the outputted logs.
|
||||
.. warning:: You don't have to pass the path here.
|
||||
.. example:: "SquareToCircleWithLFlag.log"
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ def logs_comparison(control_data_file, log_path_from_media_dir):
|
|||
tests_directory = os.path.dirname(
|
||||
os.path.dirname(os.path.abspath(__file__))
|
||||
)
|
||||
controle_data_path = os.path.join(
|
||||
control_data_path = os.path.join(
|
||||
tests_directory, "control_data", "logs_data", control_data_file
|
||||
)
|
||||
path_log_generated = tmp_path / log_path_from_media_dir
|
||||
|
|
@ -80,7 +80,7 @@ def logs_comparison(control_data_file, log_path_from_media_dir):
|
|||
False
|
||||
), f"'{parent.name}' does not exist in '{parent.parent}' (which exists). "
|
||||
break
|
||||
_check_logs(controle_data_path, str(path_log_generated))
|
||||
_check_logs(control_data_path, str(path_log_generated))
|
||||
return result
|
||||
|
||||
return wrapper
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue