Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

use correct types numpy

Syrus Dark3296c3e76e3e
diff --git a/manim/_config/utils.py b/manim/_config/utils.py
index 4eb0011f0..1ba9e3ef4 100644
--- a/manim/_config/utils.py
+++ b/manim/_config/utils.py
@@ -21,7 +21,6 @@ from pathlib import Path
import colour
import numpy as np
-import numpy.typing as npt
from .. import constants
from ..utils.tex import TexTemplate, TexTemplateFromFile
@@ -1315,7 +1314,7 @@ class ManimFrame(Mapping):
"left_side",
"right_side",
}
- _CONSTANTS: dict[str, npt.ArrayLike] = {
+ _CONSTANTS: dict[str, np.ndarray] = {
"UP": np.array((0.0, 1.0, 0.0)),
"DOWN": np.array((0.0, -1.0, 0.0)),
"RIGHT": np.array((1.0, 0.0, 0.0)),
diff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.py
index 11577da84..bc7278f15 100644
--- a/manim/mobject/vector_field.py
+++ b/manim/mobject/vector_field.py
@@ -14,7 +14,7 @@ __all__ = [
]
from typing import Callable
-import numpy.typing as npt
+
import numpy as np
import os
import itertools as it
@@ -71,10 +71,10 @@ def get_rgb_gradient_function(
max_value: int = 1,
colors: list = [BLUE, RED],
flip_alphas: bool = True, # Why?
-) -> Callable[[npt.ArrayLike], float]:
+) -> Callable[[np.ndarray], float]:
rgbs = np.array(list(map(color_to_rgb, colors)))
- def func(values: npt.ArrayLike):
+ def func(values: np.ndarray):
alphas = inverse_interpolate(min_value, max_value, np.array(values))
alphas = np.clip(alphas, 0, 1)
# if flip_alphas:
@@ -91,7 +91,7 @@ def get_rgb_gradient_function(
def get_color_field_image_file(
- scalar_func: Callable[[npt.ArrayLike], np.ndarray],
+ scalar_func: Callable[[np.ndarray], np.ndarray],
min_value: int = 0,
max_value: int = 2,
colors: list = DEFAULT_SCALAR_FIELD_COLORS,