From 5c0bbbc4be4faa1269ef52541f32b7780843d676 Mon Sep 17 00:00:00 2001 From: Sridhar Ramesh Date: Thu, 15 Feb 2018 15:35:37 -0800 Subject: [PATCH 1/2] Removed range_via_num_steps, which was redundant on top of np.linspace --- helpers.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/helpers.py b/helpers.py index 43d8a7f9..80ee9e33 100644 --- a/helpers.py +++ b/helpers.py @@ -689,10 +689,6 @@ class DictAsObject(object): def fdiv(a, b): return np.true_divide(a,b) -def range_via_num_steps(start, end, num_steps, include_end = True): - num_points = num_steps + (1 if include_end else 0) - return [interpolate(start, end, fdiv(i, num_steps)) for i in range(num_points)] - # For debugging purposes def print_mobject_family(mob, n_tabs = 0): From 4c6af541c13a13550987f26145a97ee92fbb922d Mon Sep 17 00:00:00 2001 From: Sridhar Ramesh Date: Thu, 15 Feb 2018 15:37:19 -0800 Subject: [PATCH 2/2] Switched WindingNumber to use np.linspace; also, fixed missing colon in extract_scene.py --- active_projects/WindingNumber.py | 4 ++-- extract_scene.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/active_projects/WindingNumber.py b/active_projects/WindingNumber.py index b9b2faa4..4035ef8a 100644 --- a/active_projects/WindingNumber.py +++ b/active_projects/WindingNumber.py @@ -1041,8 +1041,8 @@ class VectorField(Scene): x_min, y_min = num_plane.point_to_coords(SPACE_WIDTH * LEFT + SPACE_HEIGHT * UP) x_max, y_max = num_plane.point_to_coords(SPACE_WIDTH * RIGHT + SPACE_HEIGHT * DOWN) - x_points = range_via_num_steps(x_min, x_max, self.granularity) - y_points = range_via_num_steps(y_min, y_max, self.granularity) + x_points = np.linspace(x_min, x_max, self.granularity) + y_points = np.linspace(y_min, y_max, self.granularity) points = it.product(x_points, y_points) sized_arrows = Group() diff --git a/extract_scene.py b/extract_scene.py index 82e7a250..0d21e8a7 100644 --- a/extract_scene.py +++ b/extract_scene.py @@ -73,7 +73,7 @@ def get_configuration(): if args.output_name != None: output_name_root, output_name_ext = os.path.splitext(args.output_name) expected_ext = '.png' if args.show_last_frame else '.mp4' - if not output_name_ext in ['', expected_ext] + if not output_name_ext in ['', expected_ext]: print "WARNING: The output will be to (doubly-dotted) %s%s"%output_name_root%expected_ext output_name = args.output_name else: